Introduction: This Should Be Your First Car *avoids Obstacles*

About: My name is Wojtek and I am 21 years old student of electronic high school. I am passionate about electronics as well as recording and editing movies. I follow the rule: "Do not delay, do it today".

In this tutorial, I would like to show you how I made a mini-car that avoids the obstacles in its path. This car uses an ultrasonic sensor mounted on a servo to detect obstacles. The sensor sends the appropriate data to the Arduino, and the Arduino communicates with the motor controller to control the motors in the right way. I made the chassis on a 3D printer and the printing time was about 15 hours.

Step 1: Let's Get Started!

In the beginning, I made a schematic of my device. Two DC motors will be responsible for propelling and maneuvering the vehicle, and the L293D for controlling the motors. Without the proper driver or transistors, the Arduino would burn. The HCSR04 sensor will detect the distance from obstacles, and if it is too small, it will use the servo to compare the distance from the right and left sides and go where it will be greater. I also added a battery power module that will power the whole thing. Then I placed the components on the PCB, exported it to GERBER files, and ordered it as always from PCBWay.

Step 2: Ordering PCBs

I went to PCBWay and clicked "Quote Now", "Quick Order PCB" and "Upload Gerber File". I chose my file and all parameters were loading themselves. Then I clicked "Save To Card", provided shipping details, and paid for the order. After two days my order was sent, and after another two days, it was already on my desk.

Step 3: 3D Design

The next step was to design a 3D printing enclosure. I transferred the previously created PCB to a new project and based on it I dimensioned the place where I would place my PCB. I also added a hole through which I will pass the wires to the engine and battery. And, of course, a servo holder, and finally a closure so that the PCB is secured. When I finished designing, I saved these files, put them in Cura, saved them on an SD card and started 3D printing.

Step 4: Soldering

While the printer was doing its job, I got down to the electronics. The first to be soldered was the motor driver: I put it in the right place and soldered the two extreme pins first, then the other ones. I did a similar thing by soldering the goldpins from the Arduino and those to which I will attach the distance sensor. As the last one, I soldered the battery charging module and the ARK connectors. I put the power wires in the appropriate connector and plugged in the power supply to make sure that the power section is working properly.

Step 5: The Code

When the printed parts were ready, I put them all together and put the motors in the right place, plugged them into the connectors, and proceeded to write the code.

As usual, it is very simple: when the car is to go straight, both wheels are to spin forward. For this reason, both motors give 5V to the first connector and 0V to the second. When the car is about to reverse, the situation is reversed. When turning left, the right wheel turns forward and the left wheel turns backward, and similarly when turning right. Several conditions in the program and the car is ready to drive.

Step 6: Thanks!

This is how I made a car that can drive forever, or at least until its battery runs out. How about reducing its size a bit?

My Youtube: YouTube

My Facebook: Facebook

My Instagram: Instagram

Get 10 PCBs for only $5: PCBWay