How to Build: Arduino Self-Driving Car

22,079

26

12

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

You can order most of the components from Amazon. I placed the link for the Car Chassis Kit I bought.
  1. 1x Car Chassis Kit: YIKESHU 2WD Smart Motor Robot Car Chassis
    • 2x Gear Motor
    • 1x Car Chassis
    • 2x Car Tire
    • 1x 360° Wheel
  2. 1x Arduino Nano
  3. 1x Mini Breadboard
  4. 1x Motor Drive L293D
  5. 3x Ultrasonic Sensor HC SR04
  6. 3x Sensor support - 3D printed (see drawing below)
  7. 1x 9v Battery
  8. 1x On-off switch
  9. 5x 100uF capacitors
  10. 2x 0.1uF capacitors
  11. 1x IR Receiver
  12. 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.

Step 7: More Pictures of the Final Result

1 Person Made This Project!

Recommendations

  • Make it Glow Contest

    Make it Glow Contest
  • First Time Author Contest

    First Time Author Contest
  • PCB Challenge

    PCB Challenge

12 Discussions

1
JScars8
JScars8

12 months ago

Very nice! Do you have any control over where it's going, or is it just random?

0
vitor_vs
vitor_vs

Reply 11 months ago

It's random. It turns right or left depending on which side has more free space

0
Red Right Hand ARTS
Red Right Hand ARTS

Reply 2 months ago

that would be cool if you could bump it left and right with the remote

0
JScars8
JScars8

Reply 11 months ago

Ok thank you!

0
Red Right Hand ARTS
Red Right Hand ARTS

2 months ago

nice, thanks for the print files. im working with a friend on a self driving car, and we are using parts of your code.

0
Mutant101
Mutant101

11 months ago

If anyone, has actually made it successfully, please provide a neat breadboard wired picture using 'Fritzing' or 'TinkerCAD'.
Also i am unable to understand where to place Capacitors, please also elaborate that.

0
vitor_vs
vitor_vs

Reply 11 months ago

The schematic has all the information you need to wire the circuit. For the capacitors, they all go across the 5V and ground rails, just make sure to place them physically close to the components mentioned in the schematic.

Any other specific doubt?

0
TTP Project
TTP Project

1 year ago

Thank you for sharing! I was wondering if you happen to have a breadboard diagram to go along with your wiring diagram.

1
sunil9901
sunil9901

Question 1 year ago on Step 1

What is the purpose of ir receiver?

1
vitor_vs
vitor_vs

Reply 1 year ago

Oh, the IR receiver is there just to be able to start and stop the car with a remote controller so I dont have to be chasing it all the time

2
sunil9901
sunil9901

Reply 1 year ago

Thank you sir

2
Swansong
Swansong

3 years ago

That's a fun car design, it looks like it's pretty adaptable :)