Everything to know about our 4-in-1 Robot Car using Arduino, Sensors etc. to build Line Follower, Obstacle Avoider, Remote Control and Edge Detector Robot

This robot has 4 modes which are pre-programmed on the microprocessor based development kit. All we need to do is connect the wires and configure the app. The robot has a line following mode, an obstacle avoiding mode, an edge detection mode and a remote controlled Bluetooth robot.

(I) Bluetooth controlled robot car


In this mode we can control the direction and the
movement of the car via an app. The car can move in all 4 directions and can be stopped whenever we want all with the press of a button.


(II) Obstacle avoiding robot car


In this mode the robot is capable of detecting an obstacle at a particular distance and changing it’s path accordingly.


(III) Line following robot


In this mode the robot follows a particular pre-defined path, in this case the path is made up of a black tape which the IR sensors are capable of detecting easily.


(IV) Edge detection robot


In this mode the robot detects the edge if kept on an  elevated surface. However we need to make sure that there is a sufficient amount of contrast between the two surfaces, for this purpose we use a white chart paper and calibrate the IR sensors accordingly.


Connections: -


• Connect the positive terminal of the 12V battery pack to the 12V terminal of the L298N motor driver and the negative terminal of the battery pack to the GND of the motor driver.
• Connect the GND of the Arduino NANO to the GND of the motor driver.
• Connect the positive terminal of the 7.5V battery pack to the Vin pin of the Arduino NANO, and the negative terminal of the 7.5V battery pack to the GND of the Arduino NANO.
• Connect the motor terminals to the output pins of the driver as shown in the circuit diagram below.

• Connect ENA pin of the motor driver to digital pin 6 of the Arduino.
• Connect IN1 pin of the driver to the digital pin 2 of the Arduino.
• Connect the IN2 pin of the driver to the digital pin 3 of the Arduino.
• Connect the IN3 pin of the driver to the digital pin 4 of the Arduino.
• Connect the IN4 pin of the driver to the digital pin 5 of the Arduino.
• Connect the ENB pin of the motor driver to the digital pin 11 of the Arduino.
• Connect the HC05 Bluetooth module to the Arduino.
• Connect the TX pin of the HC05 module to the RX pin of the Arduino NANO.
• Connect the RX pin of the HC05 module to the TX pin of the Arduino NANO.
• Connect the GND of the HC05 module to the GND of the Arduino.
• Connect the VCC of the HC05 module to the 3.3V pin of the Arduino.
• Connect the GND pin of the servo motor to the GND of the Arduino.
• Connect the VCC pin of the servo motor to the 5V pin of the Arduino.
• Connect the signal pin of the servo motor to digital pin 10 of the Arduino.
• Connect the VCC pin of the HCSR04 ultrasonic sensor to the 5V pin of the Arduino.
• Connect the GND of the ultrasonic sensor to the GND pin of the Arduino.
• Connect the trigger pin of the ultrasonic sensor to A2 pin of the Arduino.
• Connect the Echo pin of the ultrasonic sensor to A3 pin of the Arduino.
• Connect the VCC and GND pins of both the IR sensor modules to the 5V pin and the GND pin of the Arduino respectively.
• Connect the OUT pin of the right IR sensor to the A0 pin of the Arduino.
• Connect the OUT pin of the left IR sensor to the A1 pin of the Arduino.
• Assemble the robot car chassis properly using the correct screws, and mount the ultrasonic sensor on the servo motor using an ultrasonic sensor bracket.
• We can either screw the IR sensor on the chassis or use double sided tape to stick the sensor.

Semantic diagram for 4 in 1 Robot Car

 

How to calibrate the IR sensors?


(i) Line following robot: -


When we use a black tape on a white chart paper to make a path for the robot to follow, we need to calibrate the IR  sensor accordingly. We can adjust the IR sensor by  varying the potentiometer using a screwdriver. When we place the sensor on the white chart paper ensure that both the LED’s are glowing, when the sensor is on the white chart paper, and while the sensor is on top of the black tape make sure that only one LED is glowing on
the IR sensor. If the above configuration is not achieved, use a screwdriver to vary the potentiometer resistance until the above mentioned settings are achieved. Calibrate the second sensor in a similar fashion, now our robot is ready to be used in line follower mode.


(ii) Edge detection robot: -


Make sure that there is contrast between the two surfaces, for this purpose we will use a chart paper on the table, to ensure that the robot does not fall down. To calibrate the IR sensors we need to adjust the potentiometer resistance. When the IR sensor is on a white chart paper both the LED’s on the sensor should be glowing, and when the
sensor is at the edge or not on the white chart paper only one LED on the IR sensor should be glowing.


How to configure the application?


• Download the following application, open your mobile phone’s Bluetooth and pair it to HC05, use either 0000 or 1234 as the password.

 

How to configure the application?, Arduino Bluetooth Controller app, How to install Arduino Bluetooth Controller app, How to connect HC05 to phone

 

• Open the application and select the HC-05 device to connect to the paired module.
• Click on controller mode to access the controller to drive the robot in various modes.

 

How to configure the application?, Arduino Bluetooth Controller app, How to install Arduino Bluetooth Controller app, How to connect HC05 to phone

• Once in controller mode click on the settings option on the right hand corner of the screen to set up the joystick commands.

 

How to configure the application?, Arduino Bluetooth Controller app, How to install Arduino Bluetooth Controller app, How to connect HC05 to phoneHow to configure the application?, Arduino Bluetooth Controller app, How to install Arduino Bluetooth Controller app, How to connect HC05 to phone

• Initially when we open the application there will be all the buttons will have no value and hence will display a not set value. We need to provide specific  alphabetic values to the keys on the app in order to use the robot.
• Here we will give the triangle button a value of the capital letter ‘M’. Just click on the triangle button
once in the settings menu, type a capital letter M on the screen and press the save arrow.
• Similarly assign the letter F to the upward arrowhead, O to the downward arrowhead, L to the left arrowhead, R to the right arrowhead and X to the start button.
• Similarly we assign A to the square button, Z to the X button and Y to the circle button.
• Initially when we power the robot, it will not do anything, once we have configured the application we can control the robot.
• When we press the triangle button on the controller, we can control the movement of the robot, by using the arrow keys, press any of the directional keys to move the robot in that direction and press the start button to apply brakes to the car. To get out of the manual mode press the triangle button again, now the car is not receiving any input and is completely stationary, so pressing the arrow keys won’t work.
• Press the square button to operate the robot in obstacle avoiding mode, here the robot will move automatically without any need for control, detect obstacle’s in it’s path and change it’s route accordingly. To exit the obstacle avoiding robot press the square button again and the car will stop in it’s position.
• Before we operate the robot in line follower mode please ensure that you have calibrated the IR sensor modules accordingly. Make a path using black electrical tape on a surface, keep the robot close to the tape and press the X button, the robot will start following the specific path. To exit the line following mode, press the X button again.
• Before we operate the robot in edge detection mode, please ensure that the IR sensor modules are calibrated accordingly. Press the circle button to operate the robot in edge detection mode, the robot will not fall off the surface (however ensure that the surface is not too small or too narrow). To exit the edge detection mode press the circle button once again.
Robotics