Introduction: RC Car to Autonomous Arduino Robot

Have you ever desired to construct a simple autonomous Arduino robot? I was inspired to build a basic Arduino robot in order to aid my understanding of the Arduino, the Arduino IDE, and the operation of ultrasonic sensors and motor drivers. And so, I have built such a robot with the intent to teach others as well.

Please note that throughout the course of this project, I changed the wiring a few times due to the fact that:

-Some wires were messily too long

-Some wires were not color coded accurately

-Some wires that needed PWM were not in the right Arduino pins

With this being said, following the wiring explanation in step 7 and the sketch comments will give you the correct wiring description.

*If you enjoyed this Instructable, please vote in the 'Make it Move' or the 'Robotic' contest*

Step 1: Necessary Materials

To begin the construction of this robot, only a few, low-cost materials are required. Now, I have not located the stores I have bought them at, due to the fact that I have purchased the following on sites such as Ebay and Amazon, in which sales end unpredictably, and others begin with the same abruptness. By purchasing at these stores, this robot can be made for around $40, provided ALL materials are bought at this time. Or else, the cost should be significantly less. Any who, the materials necessary are:


-An L298N motor driver

This motor driver is a duel-channel H-bridge circuit, which will provide the power for both motors, and the ability for both of the motors to run forwards and backwards. Enabled with PWM (Pulse-Width Modulation), the user can change each motor's speed to fit their needs.

-An HC-SR04 Ultrasonic sensor

This module is a sensor that detects objects at 'n' distance by preforming mathematical operations based on the reception time of the initial frequency it emits. (Waves are emitted, bounce off said object, and return to be processed by this unit)

-A Microcontroller

The brains of the robot. In this case, I am using an official Arduino Uno R3 microcontroller board.

-A power supply for the microcontroller and the motor driver

A 7-12 VDC power jack is needed to run the Arduino microcontroller, and the motor driver requires at least 5 VDC for this project. You can use the battery box in the RC car for both however, so no other power supply is needed.

-A cheap RC car

This is the platform in which to modify for our needs. Keep in mind that for our purposes, we will only be dealing with two DC motors, one for the rear wheels, and one to steer, which are found in cheap RC cars. More luxurious RC cars feature more complex systems such as servos, which can work, if one so desires, but will be forced to greatly modify the code and hardware intended for this basic project.

Step 2: Algorithm Development

In order to build this robot, I decided first to create a general idea of how it would respond to objects, with simplicity in mind, through the form of a flowchart. Above, you can see that if an object is equal to or less than n centimeters away, then the robot will reverse to the left for x seconds, or else it will drive for y seconds straight forward. With this principle, let's move on to the actual assembly.

Step 3: Chassis Preparation

On the RC car's underside, screws hold the exterior to the actual chassis. You will need to locate these screws and remove them. Try not to lose them for a further step. Once the exterior is removed, flip the chassis so it is in proper orientation. Note both motor casings, along with the main controller casing. (Typically in the direct middle of the chassis) You will need to play around with the visible screws and such in order to reveal the motor and controller casings.

Step 4: Controller Transplant

Begin by locating both wires of the rear motor, both wires of the front motor, and both wires of the battery box. There should be six total. Cut each wire as close to the controller as possible to make their leads as long as possible. Then, of course, strip the ends for easier use if necessary.

Step 5: Preparation and Motor Driver Installation

You will need to plan where you will mount each component. When you have found the location where you want to mount the Arduino, clear any obstruction to allow the microcontroller to lay flat. I have chosen directly above the battery box to mount mine.

Look for a good location for the motor driver as well. I chose the overhanging front-most edge to mount mine. I originally used twist ties, but have since then switched to screws. How I did this was by measuring out and drilling two screw holes in the plastic shelf, and then loosely secured the motor driver to the plastic shelf. I will give the pictures of this installation in the next step.

Step 6: Motor Driver Basic Tutorial

The pictures may not be as clear, so I will elaborate on each of the motor driver's 13 pins.

A motor driver is an electronic module that allows the polarity of two terminals to be reversed. When coupled with PWM, H-bridges can control both motor revolution direction, and speed.

What is PWM? (Pulse Width Modulation) PWM is a way of controlling the duration of an electronic pulse. The on-off cycle of the pulse is called a duty cycle. The larger the ratio of on to off results in a faster motor rotation. An analogy of this is found in the every day wind turbine. The quicker the pulse of wind on the turbine, the faster the revolution of the turbine.

There are 13 pins on the motor driver that you need to know:

Out 1: Motor A lead out

Out 2: Motor A lead out

Out 3: Motor B lead out

Out 4: Motor B lead out

5v: 5v input (unnecessary if your power source is 7v-35v, if the power source is 7v-35v then it can act as a 5v out)

GND: For ground. Have all of your grounds tied together; the Arduino, the battery box, and the motor driver.

12V/Power input: The power input. It can actually be from 5v-35v, but is just marked as 12v. The battery box will provide enough power, and the positive terminal of the battery box will go in here.

EnA: Enables PWM signal for Motor A

In1: Enable Motor A

In2: Enable Motor A

In3: Enable Motor B

In4: Enable Motor B

EnB: Enables PWM signal for Motor B

Step 7: Complete Installation and Wiring

This is the big step. Find and secure a location for the Arduino and the ultrasonic sensor. The pictures above show my process for mounting the components.

Now comes the wiring.

*I apologize, my wiring is inconsistent, as I changed it up and the colors many times due to changing circumstances and new discoveries. Resorting to the pictures for the wiring will NOT be clear, except for the Fritzing model above. I am going to write each wiring connection that must be made below as well. These descriptions are the latest, most accurate.*

The wiring is first from the motor driver:

ENA - Arduino digital pin 5

IN1 - Arduino digital pin 6

IN2 - Arduino digital pin 7

IN3 - Arduino digital pin 8

IN4- Arduino digital pin 9

ENB - Arduino digital pin 10

5V - Arduino 5V pin and ultrasonic sensor VCC pin

GND - Battery box negative terminal and Arduino GND. (I inserted the Arduino GND and the battery box negative terminal into the motor driver GND socket, and then tightened the screw carefully.12V - Battery positive pin

Now for the ultrasonic sensor:

GND - Arduino GND

ECHO - Arduino digital pin 4

TRIGGER - Arduino digital pin 3

VCC - Motor driver 5V

Once the wiring is done, pop back on the RC car's exterior if you choose, turn it on and have fun!

Step 8: Programming

I have the code in a file, I couldn't paste the text version so unfortunately you will have to download it. If you need further wiring hints, please read my sketch comments.

Step 9: You're Done!

Congratulations, you're done! If you have any problems or tips, please feel free to share.

The wiring has since been changed, but I have many pictures that document the wiring I used before I changed it, if you wanted to look at them.

*If you enjoyed this Instructable, please vote in the 'Make it Move' or the 'Robotic' contest*

Comments

author
VarunJ20 (author)2017-05-28

While uploading it shows the error

avrdude: ser_open(): can't open device "\\.\COM1": The system cannot find the file specified.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#up... for suggestions.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

Please help...

author
EnuraD (author)2017-05-06

Programe where can download

author
SaiV41 (author)2016-12-28

Can you build it so that it can be controlled by a controller also? And can you also build it to have it go through a path or follow a line? Please tell me, since this is for a science fair.

author
teknohawk (author)SaiV412016-12-29

You definitely could, and using an RC car as a pre-built base model is a quick and durable platform to build on. Personally, I haven't implemented an RC or line following function, but that sounds like an awesome challenge for yourself :)

author
Rohan Pillai (author)2016-08-16

i checked your video,i noticed that your front wheel is not turning totaly....why is that

author
Rohan Pillai (author)2016-08-11

thanks

author
Rohan Pillai (author)2016-08-09

can we use a 9v instead of 7vdc jack?

author
teknohawk (author)Rohan Pillai2016-08-10

I'm not quite sure what you are referring to, but 9v for this situation should be good

author
Rohan Pillai (author)2016-08-09

jumper wire.....m-m or m-f or f-f.

which is used?

author
teknohawk (author)Rohan Pillai2016-08-10

It really depends on your situation. Whichever wire type lets you make the connections is the right one.

author
Rohan Pillai (author)2016-08-09

pls reply.............i am a nubee

author
muddog15 (author)2016-04-22

Going to revisit this with wifi control, and joystick control.

author
theredbryophyte (author)muddog152016-04-24

I suppose you can link it up so you override it and control it via a 2.4Ghz controller:

http://playground.arduino.cc/InterfacingWithHardwa...

author
muddog15 (author)2016-04-22

To solve the dragging problem, bend the pins back slightly

author
teknohawk (author)muddog152016-04-22

The headers are plastic, and thus too brittle to bend, I would think. But if it works for you, awesome.

author
gmhoovler (author)2016-04-22

I did this same kind of project with my son on his el cheapo RC monster truck that was collecting dust. Going to be modding the RC Nerf dart spider next! Great fun to be had taking my kids unused toys apart and adding arduinos!

author
teknohawk (author)gmhoovler2016-04-22

Oh yea, its a lot of fun

author
muddog15 (author)2016-04-22

Also, your sensors wires will meet an unfortunate death while dragging on the ground.

author
teknohawk (author)muddog152016-04-22

Good observation! I measured it before hand, so the four wires actually don't touch the ground. If you were to build an off road version, however, that would definetly be something to look at!

author
Dav22 (author)2016-04-21

Thanks...love arduino instructables.
if interested i get my parts here >
http://insanedeals4u.com/shopcategory/makers-crafters/
cheaper than most places.

author
teknohawk (author)Dav222016-04-21

Sweet, I'm excited to check it out! Thank you.

author
TheThinker (author)2016-04-20

Thanks! And there is no voting button.

author
teknohawk (author)TheThinker2016-04-21

Thank you for looking! Mine wasn't approved yet yesterday, but has been accepted today.

About This Instructable

10,372views

157favorites

License:

Bio: I'm currently a student, and playing around with ideas and plans for things to build keeps me preoccupied.
More by teknohawk:RC Car to Autonomous Arduino RobotEasy Dust Bomb!
Add instructable to: