[ Play Video ]

Most of my Instructables are based on renewable energy,battery or recycling used materials.In this Instructable, I have tried something new i.e making a simple Arduino based robot car.This is my first try to make a robot in my life. If you have never tried to make robot, you must be thinking its a difficult hobby to jump into, but the Arduino and the 2WD / 4WD Robot Chassis make it easy for you to build an awesome robot without any struggle.

I always love to share my knowledge learned from my experience.So writing this guide, it will make easy for you to learn the basics of robotics and applications of the Arduino.

Update on 25th Oct 2016

Many people request me to make a tutorial on Obstacle Avoiding Rover.So I made it finally.

You can watch the video.

The code is attached below.

Step 1: Parts and Tools Required

Parts :

1. 4WD Robot Chassis kit ( GearBest)

2. Arduino Nano (GearBest )

3. LM298 H bridge Module (GearBest)

4. Bluetooth Module HC-06 ( Amazon )

5. 2 x 18650 Li Ion Battery ( Gear Best )

6. 2x 18650 Battery Holder ( Gear Best )

7. Mini Bread Board ( Gear Best )

8. 0.5 sqmm Wires

9. Male-Female Jumper Wires ( Amazon )

10. Male-Male Jumper Wires ( Amazon )

11. Duct Tape or any other tape ( Amazon )

For Obstacle Avoiding Robot :

HC - SR04 Ultrasonic Distance Measuring Module ( GearBest )

Tools Required :

1. Soldering Iron ( Amazon )

2. Wire Cutter ( Amazon )

3. Wire Stripper ( Gear Best )

4.Glue Gun ( GearBest )

Step 2: What Is a Robot ?

Robot is an electromechanical device which is capable of reacting in some way to its environment, and take autonomous decisions or actions in order to achieve a specific task.

A robot is consists of following components

1. Structure / Chassis

2. Actuator / Motor

3. Controller

4. Inputs / Sensors

5. Power Supply

In the next steps I will describe each of the above components, so that you can understand easily.

Step 3: Structure / Chassis

The structure consists of physical components. A robot has one or more physical components that move in some way to perform the task.In our case the Chassis and wheels are the structure of the robot.

Step 4: Actuator

An “actuator” can be defined as a device that converts energy (in robotics, that energy tends to be electrical) into physical motion. Most of the actuators produce either rotational or linear motion.

In our case the actuator is DC gear motor.It is basically a DC motor combined with a gearbox that works to decrease the motor’s speed and increase the torque.

Example : A DC motor having speed 3000 rpm and torque 0.002 N•m . Now we add a gear to it with gear ratio 1:48.The new speed is reduce by a factor 48 ( resulting 3000/44 = 68 rpm ) and the torque increased by a factor of 48.( resulting 0.002 x 48 = 0.096 N.m.

Step 5: Prepare the Motors Terminal

Cut 4 pieces of red and black wires with length approximately 5 to 6 inch.I was using 0.5 sqmm wires.

Strip out the insulation from the wires at each end

Solder the wires to the motor terminal.

You can check the motor polarity by connecting it to the battery pack.If it rotates in forward direction ( red wire with positive and black wire with negative terminal of the battery) then the connection is ok.

Step 6: Mount the Motor

[ Assembling Video ]

Attach the two acrylic fastener to each motor using two long bolts and two nuts.You can watch the assembling video to know the details.

Note that the wires on each motor are pointing toward the centre of the chassis.

Join the two red wires and black wires of the motor on each side of the chassis.

So after joining, you have two terminals on left side and two terminal on right side.

Step 7: Install the Top Roof

After mounting the 4 motors on the bottom floor , you have to mount trhe top roof.

Mount the 6 copper stand off by using the M3 nuts

Pull out the terminal wires towards the top roof.

Step 8: Controller

Now the robot chassis and actuator are added but controller is missing.Chassis without controller means nothing will happen. Your robot will sit in one place.Its just like a human without life.

So a controller ( brain ) is needed to move the robot from one place to another.It is a computing device capable of executing a program and is responsible for all computations, decision making, and communications.In our case, we are using an Arduino Nano microcontroller as a Controller.

The controller takes input ( sensors, Remote etc ) , process it and then gives a command to the actuator ( motor ) to do the desired task.

If you take a battery hook the positive side to one side of your DC motor. Then you connect the negative side of the battery to the other motor lead. The motor spins forward. If you swap the battery leads the motor spins in reverse. You can use your microcontroller to rotate the motor in one direction.But if you want to be able to control the motor in both forward and reverse with your microcontroller, you will need more circuitry. You will need an H-Bridge

In the next step I will explain what exactly H-bridge is.

Step 9: H Bridge ( LM 298 Module )

What is H- Bridge ?

The term H bridge is derived from the typical graphical representation of such a circuit .It is a circuit which can drive a DC motor in forward and reverse direction.

Working : See the above picture for understanding the working of the H bridge.It is consists of 4 electronics switches S1,S2,S3 and S4 ( Transistors / MOSFETs/ IGBTS ).

When the switches S1 and S4 are closed (and S2 and S3 are open) a positive voltage will be applied across the motor.So it rotates in the forward direction.Similarly when S2 and S3 are closed and S1 and S4 are opened a reverse voltage is applied across the motor, so rotates in revers direction.

Note : The switches in the same arm ( either S1,S2 or S3,S4) are never closed at a same time, it will make a dead short circuit.

H bridges are available as integrated circuits, or you can built your own by using 4transistors or MOSFETs.

In our case we are using LM298 H-bridge IC that can allows to control the speed and direction of the motors.

Pin Description :

Out 1: DC motor 1 "+" or stepper motor A+

Out 2: DC motor 1 "-" or stepper motor A-

Out 3: DC motor 2 "+" or stepper motor B+

Out 4: Motor B lead out

12v :12V input but you can use 7 to 35V

GND: Ground

5v: 5V output if 12V jumper in place, ideal for powering your Arduino (etc)

EnA: Enables PWM signal for Motor A (Please see the "Arduino Sketch Considerations" section)

IN1: Enable Motor A

IN2: Enable MotorA

IN3: Enable MotorB

IN4: Enable MotorB

BEnB: Enables PWM signal for Motor B (Please see the "Arduino Sketch Considerations" section)

Step 10: Input / Sensors

Unlike humans, robots are not limited to just sight, sound, touch, smell and taste. Robots use different sensors to

interact with the external world.

A sensor is a device that detects and responds to some type of input from the physical environment. The specific input could be light, heat, motion, moisture, pressure, or any one of a great number of other environmental phenomena.

The inputs may be from sensors,Remote or Smartphone.

In this basic tutorial I am using Smartphone as a input device to control the Rover.

Step 11: Power Source

A robot needs a power source to drive the actuators ( motors ) and the controller. Most of the robots are powered by a battery.When we talk about battery, there are lot of options

1. AA Alkaline Battery ( Non Rechargeable )

2. AA NiMh or NiCd Battery ( Rechargeable )

3. Li Ion Battery

4. LiPo Battery

So according to the requirement choose the suitable one.In my opinion, always choose a rechargeable and sufficient capacity battery.I used 2nos of 2600mAh LiIon Battery ( 18650 Samsung Brand ).If you need more power for autonomy you can choose a large battery pack like 5A turnigy.

Battery Holder :

The battery holder that I am using is ordered from china.It is not suitable for flat top battery like Samsung. So I attached two neodymium magnets on the positive terminal of the battery to fit perfectly.

Charging :

You need a good charger to charge the battery pack.As per my experience these are few good chargers

1.PowerEx AA Charger-Analyzer ( Amazon )

2. XTAR LiIon Battery Charger ( Amazon )

3. Turnigy LiPo Battery Charger ( Amazon )

Step 12: Mount the Components

On the top roof mount the entire circuit.

I used hot glue to mount the Battery Holder, Motor Driver (LM 298 ) and Mini Bread Board.You can also screw it.

Mount the Bluetooth module by using duct tape.

Insert the Arduino Nano on to the mini bread board.

Step 13: Electrical Wiring

For wiring you need some jumper wires.

Connect the red wires of two motors ( on each side )together and black wires together.So finally you have two terminals in each side.

MOTORA is in charge of two right side motors, correspondingly two left side motors are connected to MOTORB

Follow the instruction below to connect everything.

Motors Connection:

Out1 -> Left Side Motor Red Wire (+ )

Out2 -> Left Side Motor Black Wire ( - )

Out3 -> Right Side Motor Red Wire ( + )

Out4 -> Right Side Motor Black Wire ( - )

LM298 - > Arduino

IN1 -> D5

IN2-> D6

IN2 ->D9

IN2-> D10

Bluetooth Module -> Arduino

Rx-> Tx

Tx ->Rx


Vcc -> 3.3V


12V - > Connect Battery Red Wire

GND -> Connect Battery Black wire and Arduino GND pin

5V -> Connect to Arduino 5V pin

Step 14: Control Logic

To understand the working, I made this logic table.It is very useful during writing of the code.

Step 15: Software

The software part is very simple,it does not need any library.If you understand the logic table in the earlier steps then you can write you own code. I didn't spend much time on writing the code, so just using a code written by someone else.To control the Robot Car, I am using my smartphone.The smartphone is connected to the controller via a Bluetooth module ( HC -06)

Download the App

After installing the app, you have to pair it with the Bluetooth module.The password for pairing is " 1234 ".

Arduino code is attached below.

Step 16: Testing

To test the Robot Car, I placed it on a cardboard box.So that the wheels will rotate but not move.

Then check it by pressing the all keys.

If all the functions work perfectly, then its ready for actual operation.

Note : If the motors are rotate in wrong directions, just swap the wires.

Step 17: Future Plan

In this guide I have explained how to make a simple Rover .Now the next task is to add more features in it.

You can add different sensors according to the requirements. These are some ideas to be implemented in future

1. Adding Ultrasonic Ping Sensors for obstacle avoiding

2. Using WiFi Module like ESP8266 or Node MCU instead of Bluetooth for long range control.

3. Adding a solar panel for charging the battery pack

If you enjoyed this article, don’t forget to pass it along!

Follow me for more DIY projects and ideas. Thank you !!!

Can you pls send me the code <br>pikit2016@gmail.com
<p>hello bro! i want to get code can you give me. plzz to me Phanithson.phal@gmail.com</p>
Plzz send me code singhharshdeep687@gmail.com
<p>did u get the code?</p>
No bro
<p>send the code to dhruvaggarwal010@gmail.com</p>
Sir plzz send the code ?? thanking you in advance ??
Bro send a code my gmail add.<br><br>09rajathakur@gmail.com
Bro send a setup (code)
<p>Please send me the code to:devansh.verma20@gmail.com</p>
<p>please send me code to sanskarkakde13@Gmail.com</p>
<p>My 5th grade class made two of the obstacle avoidance robot cars and they work perfectly. Very exciting. Thanks for a great instructable.</p>
plz send me code on my email muhammadfaheem265@gmail.com
<p>i really want to block diagram of arduino nano of this project </p>
<p>Sir, can i get a circuit diagram for this prototype?</p>
<p>please send me android codes for app of smartphone as soon as possible.</p>
<p>Hello Dear,</p><p>is it possible use your code with a 2wd?</p><p>Regards</p>
Hi can you mail the code for arduino4wd remote control car to<br>Shammukeloth@gmail.com<br>Thanks
<p>A 2WD would work just as well. That's because the inputs for both front and back motors are connected to the same outputs from the L298N</p>
<p>Hey sir, can you give me the script of arduino nano, because i need to upload to arduino nano. Can you email it to my email : ciptadent_boy@yahoo.com</p><p>Thanks</p>
<p>You can down the code from here.</p>
<p>Hai sir, i allready make it and i use your instrucsion, and i follow your code.</p><p>after i allready done to conect&quot; the wire, i connect it with my bluetooth andriod. and than connect, after that i open my apps and i connect it the bluetooth, and i turn on, and that i press the button up , why the motor dont want work</p>
Hi can you mail the code for arduino4wd remote control car to<br>Shammukeloth@gmail.com<br>Thanks
Bro can u send me the code,pls,my mail id is swathish11@gmail.com
sir send me code please I already Bought Every thing Just Waiting For code send me please <br>mubeen.kamboh911@gmail.com
Could u plz send me the code on sujalchavda14@gmail.com
How we get Code
<p>Friends Open this Link through ur Laptop or Pc u will get Download Link Below the video of this Project...</p><p>For My Friends all the best....</p>
Bro, collect thid code???
Send the code pls this is my email id <br>Sathishsuvan@gmail.com
hlw bro, could you collect this program????
<p>Open the this link through your Lapi or Pc then you can see Download Link below the video this Project....</p>
<p>if anyone has the coding pleses send it to me </p>
<p>12dad12</p><p>Hi just finished your smartphone car robot it worked first time.l am 63 next birthday . Just had a go at robotics and loved it, looking forward to bigger projects you may see me on robot wars ha,ha</p>
Plz mail me codes at mayurnilajkar66@gmail.com
<p>sir i need the code please send me at binalbijupe@gmail.com</p>
Sir please mail me the code to this id.<br>sanu001john@gmail.com
<p>mail me at moorthy483@gmail.com</p>
<p>sir i don't know how to check if the L298 H-Bridge is working or not.can you suggest the me instructions to check it</p>
i need a code please mail me at <br>praa1996@gmail.com
Hii sir, i can't get the code.... Please send the code in this email address - - debjyotiroychowdhury3@gmail.com
Sir sample question software how Mach cost plz sand answer email :yakkalapavankumar357@gmail.com
Hi ,sir iam pavan from khammamm total product is radi but software iam not under standing +code and software which process to download plz sand link my email ID:yakkalapavankumar357@gmail.com
Hi sir,I need Arduino code,pls mail that,my mail id is swathish11@gmail.com
<p>Sir, can you please do it with an arduino uno board? arduino nano is not available in our stores.. thanks'</p>
Just use an UNO, pins will remain same
<p>Looking at the code, what does izqA and izqB mean? I thought they were brakeA and brakeB but I'm not so sure.</p>
<p>What about discharge protection for your 18650 batteries? If you run your robot too long the batteries will be over discharged and broken.</p>

About This Instructable




Bio: I am an Electrical Engineer.I love to harvest Solar Energy and make things by recycling old stuffs. I believe &quot;&quot;IF YOU TRY YOU MIGHT ... More »
More by deba168:Solar Powered WiFi Weather Station  3 Useful Things From an Old Laptop DIY Mobile Boombox 
Add instructable to: