Introduction: Radar No Telefone Móvel - Radar on Mobile Phone

About: A curiosidade e a vontade de ser útil, isso me motiva. Curiosity and the desire to be useful, it motivates me.

Olá.

Gostaria de contribuir com a comunidade e apresentar algumas partes de um projeto que venho desenvolvendo há alguns anos.

Há cerca de 4 anos venho desenvolvendo um robô para o mapeando de ambiente, podendo ser um labirinto, achando uma saída ou ponto pré-determinado.

O robô foi construído na plataforma Tamiya, chassi para o veículo com esteira e caixa de engrenagem com motor duplo. A placa foi utilizada no Garagino VER 1 Básico, com um Dual Motor Garagino, ambos descontinuados. O Garagino é semelhante ao Arduino Uno. Mais informações em http://labdegaragem.com.

Um dos módulos é o sensor de obstáculos. Sensor do sensor ultrassônico ultra-sônico HC-SR04 movimentado por um Micro servo motor SG90.

Para fazer uma comunicação do robô com o celular, usei o Módulo Bluetooth RS232 - HC-06.

Desenvolvi um Sketch Arduino para movimentar o radar e ler o sensor. Esse Esboço comunica com um App, desenvolvido no App Inventor 2.

Vamos à construção do de sensor de obstáculos.

_____________English

Hello.

I would like to contribute to the community and present some parts of a project that I have been developing for some years.

For about 4 years I have been developing a robot for mapping environment, it could be a labyrinth, finding a predetermined exit or point.

The robot was built on the Tamiya platform, chassis for the vehicle with mat and gearbox with double engine. The plate was used in the Garagino VER 1 Basic, with a Dual Motor Garagino, both discontinued. The Garagino is similar to the Arduino Uno. More information at http://labdegaragem.com.

One of the modules is the obstacle sensor. Ultrasonic Ultrasonic Sensor Sensor HC-SR04 moved by a Micro Servo Motor SG90.

To communicate the robot with my cell phone, I used the RS232 Bluetooth Module - HC-06.

I developed an Arduino Sketch to move the radar and read the sensor. This Outline communicates with an App, developed in App Inventor 2.

Let's build the obstacle sensor.

Step 1: Montagem Do Hardware - Hardware Assembly

Material:

1 - Protoboard;

1 - Arduino Uno ou genérico;

1 - Sensor ultra-sônico HC-SR04;

2 - Resistores de 10kΩ;

1 - Micro servo motor SG90;

1 - Módulo Bluetooth RS232 - HC06.

As portas TRIG e ECHO do SR04 vão conectadas os pinos A3 e A2 do Arduino, respectivamente.

As portas TX e RX do HC06 se conectam nos pinos D3 e D2 do Arduino, respectivamente.

Entre as portas D3 e RX existem 2 Resistores de 10kΩ ligados entre si e no pino GND do Arduino.

O SG90, se liga ao pino D9 do Arduino.

As portas GND e VCC são conectadas aos seus respectivos pontos.

_____________English

Material:
1 - Protoboard; 1 - Arduino Uno or generic; 1 - Ultrasonic Sensor HC-SR04; 2 - 10kΩ resistors; 1 - Micro servo motor SG90; 1 - Bluetooth module RS232 - HC06.

The TRIG and ECHO ports of the SR04 are connected to the Arduino A3 and A2 pins, respectively. The TX and RX ports on the HC06 connect to the Arduino D3 and D2 pins, respectively. Between the D3 and RX ports there are 2, 10kΩ resistors connected to each other and to the Arduino's GND pin. The SG90 attaches to the Arduino's D9 pin. The GND and VCC ports are connected to their respective points.

Step 2: Código Arduino - Arduino Code

Agora vamos programar o Arduino de acordo com o fluxo abaixo.

Também segue uma cópia do arquivo ".ino" em anexo.

1º - Inclusão das bibliotecas;

2º - Definições dos pinos de acordo com a descrição da etapa anterior.

3º - Declaração de variáveis para enviar dados via bluetooth.

4º - Declaração de variáveis para o sensor de distancia.

5º - Declaração de variáveis do calculo de distância.

6º - Setup, definindo a saída para o Bluetooth e definindo o pino do servo motor.

7º - No Loop, colocar o servo para frente; fazer a leitura do bluetooth; receber um comando definido no App e ativa o sensor; parar o sensor.

8º - Criar um Void() para a leitura do sensor.

Esse Void() faz a varredura do sensor, dos ângulos 10º ao 170º, colhendo as distancias; estabelece 45 cm como a maior distancia a ser lida; organiza as variáveis diferentes para enviar para o App; gera as saídas formatadas, interpolando variáveis a uma string de formatação; especifica a utilização de buffer para armazenamento; faz a leitura a cada 50 milissegundos, mesma do temporizador do App.

9º - Criar um Void() para parar o sensor.

_____________English

Now let's program the Arduino according to the stream below.

A copy of the ".ino" file is also attached.

1 - Inclusion of libraries; 2º - Definitions of the pins according to the description of the previous step. 3º - Declaration of variables to send data via bluetooth. 4º - Declaration of variables for the distance sensor.

5º - Declaration of variables of distance calculation.

6 - Setup, setting the output for Bluetooth and setting the servo motor pin.

7º - In the Loop, place the servo forward; make bluetooth reading; receive a command defined in the App and activate the sensor; stop the sensor.

8º - Create a Void () for reading the sensor. This Void () scans the sensor, from angles 10º to 170º, harvesting the distances; establishes 45 cm as the longest distance to be read; organizes the different variables to send to the App; generates formatted outputs by interpolating variables to a formatting string; specifies the use of buffer for storage; it reads every 50 milliseconds, same as the App timer.

9º - Create a Void () to stop the sensor.

Step 3: Código App Inventor - Inventor App Code

Segue o arquivo ".aia" do App Inventor para análise, alterações e utilização.

No App Inventor vamos primeiro fazer o designer da tela.

Observações importantes:

- Na paleta Desenho e Animação, vamos utilizar a Pintura, com as seguintes propriedades: Cor De Fundo, preto; Imagem De Fundo, nenhum; Tamanho Da Fonte, 14.0; Altura, 150 pixels; Largura, 300 pixels; Largura Da Linha, 2.0; Cor De Pintura, Verde; Alinhamento Do Texto, centro : 1.

- Na paleta Sensores, vamos utilizar o Temporizador, com as propriedades de Disparos Contínuos, marcado; Ativado, marcado e Intervalo, 50 (que significa 50 milissegundos, em acordo com o Sketch do Arduino)

Nos blocos, temos 6 blocos com o controle "Quando" e 4 blocos com declaração de variáveis. 1 bloco trata da tela inicial; 2 blocos controlam a lista de pareados do bluetooth; 1 bloco cuida do temporizador; 1 bloco do botão RADAR e 1 bloco do botão PARAR O RADAR.

A maior dificuldade encontrada foi no desenho das linhas do radar, que deveriam seguir o sensor e apresentar as distâncias.

_____________English

Follows the ".aia" file of App Inventor for analysis, changes, and usage.
In App Inventor let's first do the screen designer. Important notes: - In the Drawing and Animation palette, we will use Paint, with the following properties: Background Color, black; Background Image, None; Font Size, 14.0; Height, 150 pixels; Width, 300 pixels; Line Width, 2.0; Color Of Paint, Green; Text Alignment, center: 1.

- In the Sensors palette, we will use the Timer, with the properties of Continuous Shooting, marked; Enabled, Dialed, and Interval, 50 (which means 50 milliseconds, according to the Arduino Sketch)

In the blocks, we have 6 blocks with the "When" control and 4 blocks with variable declarations. 1 block deals with the home screen; 2 blocks control bluetooth pairing list; 1 block takes care of the timer; 1 block of the RADAR button and 1 block of the STOP RADAR button.

The greatest difficulty was found in the design of the lines of the radar, which should follow the sensor and present the distances.

Step 4: Final - Conclusion

Por fim, temos o módulo sensor do robô funcionando conforme figuras.

_____________English

Finally, we have the sensor module of the robot running according to figures.