Hello guys, welcome back to my SriTuHobby blog. Today we are going to talk about a topic that everyone likes. That is, today we are going to talk about how to build a robot car. Making robots is a big dream of many Arduino learners. This is a topic I like a lot too. For this, we need the knowledge of the previous few articles. If you are new to Arduino. Please read my previous articles. Today we are going to talk about how to make an obstacle avoidance robot car. For this, we can mainly use an ultrasonic sensor. Because we know we can get the distance with the ultrasonic sensor. We also need a few components but this sensor is special. We discuss these components below.
How does this robot car work?
Once this robot car is activated, a slight delay begins to activate. The first time the ultrasonic sensor is shaking slightly. That way we can see that the robot is active. It also increases the robot’s attractiveness. Afterward, the ultrasonic sensor is activated. At the same time, the four motors begin to rotate forward. That’s how the robot car starts to move forward. Going forward, when the sensor value is less than 10 cm, the four motors stop and rotate backward for half a second. Later, this robot car stops. The sensor is then rotated left and right to calculate the distance. For that uses a servo motor. Next, this servo motor stops at the starting point. Then, using the distance obtained by looking left and right, the robot car turns to the long-distance and goes forward. To turn the car, the motors must rotate backward on one side and the motors rotate forward on the other side. Okay, now we talked about how the robot car works. Let’s look at the components required for this project.
Please use the Arduino Uno board for this project. Because this is good for this project.
Motor driver shield
This component is used to control the four motors. Click this link for more details.
This component is used to get the distance. Click this link for more details.
This is used to rotate the ultrasonic sensor. Click this link for more details.
Gear motors and wheels.
These components we want to move the robot car.
Next, we need a robot car chassis. For that, I use the dot board. But you can use any car chassis.
Li-ion battery and holder
You can use any kind of power source. But remember to use a power source from 7 to 12 DC.
Use these jumper wires to connect the ultrasonic sensor to the motor shield.
First, attach the four gear motors to the dot board. For that, I used a glue gun. You can use any method.
Then, connect the motor drive shield to the Arduino board and attach it to the center of the dot board.
Next, connect these four motors to the motor driver shield. For that, use the circuit diagram below.
Attach the servo motor to the dot board and connect it to the motor shield. Then, attach the ultrasonic sensor to the top of the servo motor and connect it to the driver shield using the jumper wire. To do this, use the circuit diagram above.
Finally, attach the power source to this robot car. For that, I used two li-ion batteries. You can use any type of battery. But you have to keep in mind that its voltage ranges from 7 to 12 VDC.
For the first time, we need a library to control the motor driver shield. Please download it using this link and add it to your Arduino IDE. The other codes are described in my previous posts. Please read those articles and understanding them.
Select the correct board and port.
Upload this code and enjoy it.
Now we can remove the USB cable and give it the power we set. It’s easy for you if you use a switch. Now we can see the Robot car moving. Below is a video related to this project. Please watch it. Please comment below on your issues. So we will meet in the next post. Have a good day. Bye-bye.