Robô Spy Rover implementado usando câmera IP que permite transmissão de longa distância

Spy Rover robot implemented using IP camera that allows long-distance transmission

In this tutorial, a Bluetooth controlled spy rover is designed. It is a surveillance robot that will be used to monitor and monitor areas that are difficult for humans to access. Surveillance is the process of monitoring a situation, an area or a person. It is generally practiced in a military scenario where surveillance of enemy borders and territory is essential for the country's security.
Human surveillance is achieved by placing personnel near sensitive areas in order to constantly monitor changes. But humans have their limitations and deployment in inaccessible locations is not always possible. There are also additional risks of loss of personnel in the event of being caught by the enemy. With advances in technology over the years, it is now possible to remotely monitor important areas using robots instead of humans.
The control mechanism is provided along with the video transmission feature. This spy rover has a cell phone mounted and the phone's camera is used to record the surroundings. IP camera app is used on mobile phone to use mobile phone camera as IP camera. The mobile camera that will capture the scene in front of you and transfer it to the server on which the user will be watching the live broadcast.
The robot is controlled and maneuvered using another cell phone that has a custom app installed to control the robot. The cell phone that controls the robot connects to the robot using a Bluetooth interface. The robot has a HC-05 Bluetooth module connected to the control circuit to connect the cell phone.
The four-wheeled robot has two-wheel drive, so a pair of geared DC motors are mounted on the rear wheels. The robot's control circuit is built around the Arduino Pro Mini. Arduino is the most popular and easiest to program prototyping board due to strong community support. The Pro Mini was chosen for this robotic project due to its compact size and enough features to make the robot. The reception and interpretation of commands via Bluetooth and the control of DC motors through the L293D motor driver IC are managed by Arduino Sketch. Arduino code is written and burned onto the board using the Arduino IDE. The custom application to control the robot's movement is built using MIT App Inventor.

Required components –

Lista de componentes necessários para o Spy Rover controlado por Bluetooth baseado em Arduino
Fig. 1: List of components required for Arduino-based Bluetooth controlled Spy Rover

Block diagram –

Diagrama de blocos do Spy Rover controlado por Bluetooth baseado em Arduino
Fig. 2: Block diagram of Arduino-based Bluetooth controlled Spy Rover

Circuit Connections –

The electronic circuit that controls the robot is built around the Arduino Pro Mini. The L293D motor driver IC and HC-05 Bluetooth module interface with the controller board. A pair of geared DC motors are attached to the rear wheels that interface with the motor driver IC. A cell phone whose camera is used as an IP camera is mounted on the robot's body.
Imagem mostrando Spy Rover controlado por Bluetooth
Fig. 3: Image showing Spy Rover controlled by Bluetooth
The robot control circuit can be divided into the following circuit sections –
Power supply – In the circuit, the Arduino Pro Mini and the Bluetooth module need a regulated 5V DC for their operation, while the motor driver IC needs 12V DC. A 12V NIMH battery is used as the primary power source. The battery power is regulated to 5V and 12V using 7805 and 7812 ICs. Pin 1 of both voltage regulator ICs is connected to the battery anode and pin 2 of both ICs is connected to ground. The respective voltage outputs are taken from pin 3 of the respective voltage regulator ICs. An LED along with a 10K Ω pull-up resistor is also connected between the common ground and the output pin to get a visual cue of power continuity. Despite using a 12V battery, the 7812 is used to provide a regulated and stable power supply to the motor driver IC.
Arduino Pro Mini – Arduino Pro Mini is a microcontroller board based on Atmega 168. It has 14 GPIO pins, 6 analog inputs, 6 PWM pins, 2 external interrupts and integrated UART, SPI and I2C. The board is just 1.3 inches by 0.7 inches in size, six times smaller than the Arduino UNO. With these features in a small size, this board is ideal for any robotics project. In this project, 4 input and output pins of the Pro Mini are used to interface with the motor driver IC and the Bluetooth module interfaces with the RX and TX pins available for serial communication via UART.
HC-05 Bluetooth Module – The HC-05 Bluetooth module is a serial port protocol module. Operates in the 2.4 GHz ISM band with V2.0+EDR (enhanced data date). It can work in Master and Slave modes. The Bluetooth module has six pins – Enable, VCC, Ground, Transmit Data (TxD), Receive Data (RxD) and State. The Enable and State pins are unused and therefore not connected to the circuit. The VCC and Ground pins are connected to common VCC and Ground. The TxD and RxD pins of the module are connected to the RX and TX pins of the Arduino Pro Mini respectively. These connections are summarized in the table below –
Tabela de listagem de conexões de circuito entre o módulo Bluetooth HC-05 e o Arduino Pro Mini
Fig. 4: Table listing the circuit connections between the HC-05 Bluetooth module and the Arduino Pro Mini
L293D DC Motor Driver IC – The L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers in that they receive a low current control signal and supply a higher current signal. This higher current signal is used to drive the motors. It has 16 pins with the following pin configuration:
Tabela de listagem de configuração de pinos do IC do driver do motor L293D
Fig. 5: Table listing the pin configuration of the L293D motor driver IC
There are two DC motors used to make the robotic car. DC motors interface between pins 3 and 6 and pins 14 and 11 of the motor driver IC.
IC L293D controls DC motors according to the following truth tables:
Tabela verdade do IC do driver do motor L293D
Fig. 6: Truth table of L293D motor driver IC
Tabela verdade do IC do driver do motor L293D
Fig. 7: Truth table of L293D motor driver IC
Pins 4, 5, 13 and 12 of the L293D are grounded while pins 1, 16 and 9 are connected to 5 VDC and pin 8 is connected to 12 VDC. Pins 15, 2, 7 and 10 of the motor driver IC are connected to pins 8, 2, 3 and 7 of the Arduino board. The DC motor connected to the right wheel is connected to pins 11 and 14, while the motor connected to the left wheel is connected to pins 3 and 6 of the motor driver IC.
Geared DC Motors – In this robot, 12V geared DC motors are attached to the wheels. Geared DC motors are available with a wide range of RPM and Torque, which allows a robot to move based on the control signal it receives from the motor driver IC.
Cell Phones – A cell phone is mounted on the robot for live streaming of the video recording. The phone has an IP camera app installed that records and transmits the live recording to a remote server. The application automatically uses your cell phone camera as an IP camera. Another cell phone will be used to control the robot via Bluetooth. It has a custom app installed that can move the robot forward, backward, left or right. Custom application development using MIT App Inventor is discussed in the programming guide section.
Imagem do circuito de controle montado na carroceria do Spy Rover
Fig. 8: Image of the control circuit mounted on the Spy Rover body

How the circuit works –

Once the robot's control circuit is turned on, it initializes the controller and begins reading data from the Bluetooth module. Control commands can be passed to the robot using a custom app running on an Android phone. The application has a user interface that allows you to move the robot forward, backward, turn left, turn right and stop. The user simply taps the direction buttons to transfer commands. Commands are passed by the application to the Bluetooth module connected to the control circuit in the form of single character sequences. The following strings are passed to transfer the control commands –
Tabela de listagem de comandos de string usados ​​para movimento do robô Arduino
Fig. 9: Table listing string commands used for Arduino Robot movement
These command strings are interpreted in the Arduino sketch to control the DC motors. The robot can be moved forward, backward, left or right by implementing the following input logic on the motor driver pins –
Tabela lógica do IC do driver do motor L293D para o robô Arduino
Fig. 10: Logic table of L293D motor driver IC for Arduino robot
Upon receiving the string commands, the Arduino sketch just changes the digital output on the input pins of the motor driver IC to control the movement of the robot.
An Android smartphone is mounted on the robot to transmit video and audio from the robot to the control interface (computer). There are many IP webcam apps available on the Google Play Store, but two apps are very good – one is Alfred and the second is IP webcam. An Internet Protocol (IP) camera is a type of digital video camera, typically used for surveillance, that can send and receive data over a computer network and the Internet. Any of the apps mentioned above can be used to use your phone as an IP camera.
In this project Alfred is used for transmission. IP webcam also becomes easy when the cell phone is connected to a laptop through the same server, such as through a regular Wi-Fi connection. As the Alfred app is used, you need to log in with an email ID and once done, the camera will be turned on on the cell phone mounted on the robot. Then the user has to go to alfred.computer on the pc or laptop and login with the mail id and the video will be streamed live. After starting the live broadcast, the user can operate and control the robot with another cell phone connected to the circuit via the Bluetooth module.

Programming guide –

The custom application used to control the robot's movement is built using MIT App Inventor. There are also many Bluetooth Android apps available on the Play Store that can be used. If any app available on Play Store is used, the Arduino sketch needs to be modified or changed accordingly. MIT App Inventor 2 is used to build the application.
Captura de tela do aplicativo personalizado projetado usando o MIT App Inventor
Fig. 11: Screenshot of custom application designed using MIT App Inventor
MIT Inventor app is an easy platform to create an Android app. The platform uses logic blocks to create an application. A guide for using the MIT app inventor 2 is provided on the platform's official website. There are also many YouTube tutorials available for reference. The robot control application created in this project has the following logics that are formed with the help of blocks –
Captura de tela dos blocos lógicos do aplicativo personalizado projetado usando o MIT App Inventor
Fig. 12: Screenshot of the logic blocks of the custom application designed using MIT App Inventor
Captura de tela dos blocos lógicos do aplicativo personalizado projetado usando o MIT App Inventor
Fig. 13: Screenshot of the logic blocks of the custom application designed using MIT App Inventor
More features can be added to the application by including additional logic blocks.
In the robot control circuit, the Arduino sketch running on the Pro Mini controls the robot mechanism. The Arduino sketch starts with declaring constants. The following #define directives are used to determine the Arduino pins that should be connected to the motor driver IC.
#define LM1 2
#define LM23
#define RM17
#define RM2 8
The following code block lists the function prototypes that are used to determine the engine's task.
character data = 0;
void advance ;
void rewind;
void turn left ;
void turn right ;
void robostop;
The following code block is the setup function where it is used to determine whether the connected pins are used as input or output and serial communication with the Bluetooth module is enabled. Here Serial.begin is used to establish serial communication between Bluetooth and Arduino and the pins connected to the input pins of the motor driver IC are declared as output.
null configuration
{
Serial.begin(9600);
pinMode(LM1, OUTPUT);
pinMode(LM2, OUTPUT);
pinMode(RM1, OUTPUT);
pinMode(RM2, OUTPUT);
}
The main operation in the code is implemented by a decision-making loop that is called in the main function. It checks whether serial data is available and if any data is available, it reads the serial data using the UART interface. The Read method of the Serial object is used to read data and the data is then stored in a variable.
if(Serial.available >0)
{
data = Serial.read;
Serial.print(data);
Serial.print(“n”);
The received serial data is compared with predetermined string commands in if statements and consequently the logic on the input pins of the motor driver IC is changed. As if the received serial data is 'F', the moveforward function is called to move the robot forward.
The full Arduino sketch for the Bluetooth controlled Spy Rover can be found in the source code tab.
Note : Find the rar file of the Bluetooth controlled application below.

Project source code

###

 //Program to

 #define LM1 2 //define the pins number for motor connection

 #define LM2 3

 #define RM1 7

 #define RM2 8


 char data = 0;

 void moveforward; // function prototype

 void movebackward;

 void turnleft ;

 void turnright ;

 void robostop;


 void setup //setup function to define pinmode is input or output

 {

 Serial.begin(9600);

 pinMode(LM1, OUTPUT);

 pinMode(LM2, OUTPUT);

 pinMode(RM1, OUTPUT);

 pinMode(RM2, OUTPUT);

 }

 
void loop //Infinite loop function

 {

 if(Serial.available >0) //condition check for serial data is available or not

 {

 data = Serial.read; //if available read the data

 Serial.print(data);

 Serial.print("n");

 if(data == 'F')

 {

 Serial.println("Forward");

 moveforward;

 }

 else if(data == 'B')

 {

 Serial.println("Backward");

 movebackward;

 }

 else if(data == 'L')

 {

 Serial.println("Left");

 turnleft ;

 }

 else if(data == 'R')

 {

 Serial.println("Right");

 turnright ;

 }

 else if(data == 'S')

 {

 Serial.println("Stop");

 robostop;

 }

 }

 }


 void moveforward // function definition to move robot forward

 {

 digitalWrite(LM1, HIGH);

 digitalWrite(LM2, LOW);

 digitalWrite(RM1, HIGH);

 digitalWrite(RM2, LOW);

 }


 void movebackward // function definition to move robot backward

 {

 digitalWrite(LM1, LOW);

 digitalWrite(LM2, HIGH);

 digitalWrite(RM1, LOW);

 digitalWrite(RM2, HIGH);

 }

 
void turnleft // function definition to turn robot left

 {

 digitalWrite(LM1, HIGH);

 digitalWrite(LM2, LOW);

 digitalWrite(RM1, LOW);

 digitalWrite(RM2, LOW);

 }


 void turnright // function definition to turn robot right

 {

 digitalWrite(LM1, LOW);

 digitalWrite(LM2, LOW);

 digitalWrite(RM1, HIGH);

 digitalWrite(RM2, LOW);

 }


 void robostop // function definition to stop the robot

 {

 digitalWrite(LM1, LOW);

 digitalWrite(LM2, LOW);

 digitalWrite(RM1, LOW);

 digitalWrite(RM2, LOW);

 }

###

Circuit diagrams

Circuit-Diagram-Arduino-Bluetooth-Controlled-Spy-Rover

Project video

Related Content

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.