Introduction: How to Build: Arduino Self-Driving Car
The Arduino Self-Driven Car is a project comprised by a car chassis, two motorized wheels, one 360° wheel (non-motorized) and a few sensors. It is powered by a 9-volt battery using an Arduino Nano connected to a mini breadboard to control the motors and sensors. When it is turned on, it starts driving straight forward. When it finds an obstacle ahead, it looks for both sides, and turn to the side where it has more free space. If there is no free space ahead or on both sides, it reverses the motors to drive backward.
PS: don't mind the dog :)
Step 1: Components
- 1x Car Chassis Kit: YIKESHU 2WD Smart Motor Robot Car Chassis
- 2x Gear Motor
- 1x Car Chassis
- 2x Car Tire
- 1x 360° Wheel
- 1x Arduino Nano
- 1x Mini Breadboard
- 1x Motor Drive L293D
- 3x Ultrasonic Sensor HC SR04
- 3x Sensor support - 3D printed (see drawing below)
- 1x 9v Battery
- 1x On-off switch
- 5x 100uF capacitors
- 2x 0.1uF capacitors
- 1x IR Receiver
- 1x Remote Control
Step 2: 3D Printed Sensor Support
The supports for the Ultrasonic Sensors can be printed on a 3D printer. The drawings are as below:
Side supports: print two of this
Front support: print one of this
PS: the holes have to be adapted according to your chassis. The chassis might have some small differences regarding its holes.
Step 3: Assembling the Chassis
- Assemble the chassis according to the manual.
- The breadboard can be fixated at the back of the chassis.
- It is important that the battery is placed on the front part of the chassis due to its weight.
- Screw or glue the sensor supports on the front of the chassis
- The sensor can be placed with pressure on its supports. It's not necessary to glue or screw it.
Please refer to the picture to understand the components position better.
Step 4: Wiring
Wire the components as the diagram. Refer to the picture to understand capacitors placement.
Step 5: Code
Here you will find the code I used for my project. You can always make small adjustments if you want to change its behavior.
Step 6: Ready!!! Start the Engines
Now that the car is ready you can start playing with it.
When the car is placed on the ground, turn on the switch to power it. After that, use the PLAY button on the remote control to start the motors. When you need to turn it off, press the PREV button on the remote controller and turn off the switch on the car. While it is on, it keeps driving and avoiding obstacles, however, it is important to prevent it from going to places where there are stairs or holes.