What you will make:
This tutorial will guide you through the steps required to make your robotic car autonomous, meaning it will change direction whenever something comes directly in front of it. Let’s get started
What you will need:
For this project you will need:
- Assembled Robotic Car chassis. For assembly guide, go here.
- Arduino UNO.
- L298N, guide to which is provided here.
- Ultrasonic Sensor, aka distance sensor. Learn how to use this sensor here.
- Battery with snap connector
- DC Jack Male
- Jumper wires
(IF an obstacle is 10cm or less than 10cm away from the sonar sensor then the car will stop and turn right otherwise move forward)
Hint: make a new variable with name distance from Data&Blocks tab as shown below
- Connect the components as shown in schematic.
- Upload the code.
Trouble shooting: If your wheels are moving in opposite direction then switch wires of one of the DC motor.
Note: After uploading, you can unplug the Arduino from the laptop and can connect battery to it using the DC Jack. Remember to unplug the Arduino from the laptop first.
Circuit diagram with 9V battery and DC jack
Circuit diagram with cell holder case and DC jack
Circuit diagram with cell holder case and without DC jack