Easy Arduino Robot Tutorial - Part I
UPDATE: I decided to remove the H-Bridge part, now the motors are directly connected to the AA batteries, and the Arduino is connected to the 9V battery. This little bot will move only forward.
In Part II, I will add an H-Bridge and two SPDT Bump Switches. The robot will move in both directions and void obstacles.
------------------------------------------------------------
Hi! And Welcome to the Easy Arduino Robot Tutorial - Part I !!
For your own sake read this before you move further : ]
Index:
1 - Introduction
2 – Before Start
3 – Parts List
4 – Hello Hardware!
5 – Assemble Process
5.1 – First Car
5.2 – Second Car
5.3 – Servo and front wheels
5.4 - Batteries
5.5 - The Circuit
5.6 - The Servo
5.7 - LDR
6 - Program!!!
---------------------------------------------------
1 - Introduction
In this tutorial you will see that you don´t have to be an electronic guru, or a super skilled programmer to make a simple, easy and funny robot.
It won´t have any IR sensor or ultrasonic.
So what will this robot do.. you may ask..
It will be an insane light seeker!!

If you decide to follow this tutorial, at least you should be able to use a breadboard, and if possible to do a little solder, and a bit of hot glue.
--------------------------------------------------
2 – Before Start
-------------
Have you ever used one BREADBOARD ?
Here you have a nice tutorial and explanation on the way it works:
http://letsmakerobots.com/node/596
-------------
In section 4 I will show you how to read analog inputs and how to make one servo move but..
If you don´t know:
- how to blink an LED;
- read a potenciomenter analog input;
- use the Serial command;
- understand the basics of OOP (Object Oriented Program).
I advice you to visit this links:
Here is a nice set of tutorials:
http://itp.nyu.edu/physcomp/Tutorials/Tutorials
http://todbot.com/blog/bionicarduino/
http://todbot.com/blog/spookyarduino/
-------------
NOTE:
Always take one step at the time. Every time you assemble something test it, and if successful, move to the next step.
This is a good practice, and it will make you save precious time and patience.
---------------------------------------------------
3 - Parts list:
Generic parts:
1 Arduino Diemicila
1 Breadboard
1 Servo
2 LDR (Light Dependant Resistance)
2 10k resistors
2 On / off switchs
5 - 1 Ohm resistor
Prototype Wires (colored if possible)
Customizable parts:
Batteries - it depends on your motors needs
I will use:
1 9V battery with power plug to connect to the Arduino
3 AA NiMh to power the motor
------------
I choosed to use toys instead of premade parts. It is faster to get them and they are also cheap, and fun to work with, the other reason is: it enhances your criativity and you get used to be a solution finder.
------------
In 1 Euro stores, or chinese stores you can find lots of cheap toys, waiting to be vandalized! : )
This was 5€ and I will use it´s chassis as platform

This little car was 2€ and I will use it´s front wheels for steering.
--------------------------------------------------------
4 - Hello Hardware:
LDR - Light Dependant Resistors
This part is for beginners in Arduino, I will show briefly how to move a servo, and read analog inputs through LDR´s.
-----------
Reading LDR analog inputs:
The LDR can be placed in either way and also the resistors. This means they don´t have a + or - .

Take one wire and connect into one Arduino Analog Pin of your choice
-----------
Now for the Servo:
Before you use the servo code, you must install Servotimer1 library. Unpack it into your hardware/libraries folder to add the library. Then restart the Arduino Software.
Take the black wire that comes from the servo and plug it into the black line on the breadboard, the Red wire into the red line on the breadboard, and the Yellow wire into the Arduino pin 9.
Take two more wires and connect the 5V on the Arduino into the red line on the breadboard and the GND on the Arduino into the black line on the breadboard.
The Arduino can be powered from USB cable.

Now that you are more familiar with Arduino bits and bytes, LET THE FUN BEGIN :D
---------------------------------------------------------
5 – Assemble Process
5.1 – First Car
Disassemble the car wich will provide platform for components and also traction system, and remove all the parts except the rear wheels and the motor.

Solder two cables to the motor pins.

Also soldered one black wire to the Ground pin on the battery case and one red wire to the power switch.
This was the first and the last time you see solder in this tutorial. :)
-----------
5.2 - Second Car

Another little car was vandalized, this time I will use the front wheels to have the steerings.
-----------
5.3 - Servo and Front Wheels:

This is not a very pretty glue work i know.. try to center the wheels the best you can.
Next, I used hot glue to place the servo next to the chassis.
ATTENTION: Certify that both wheels touch the ground when turning, otherwise you might have problems.

Left wheel doens´t touch the ground = PROBLEM

Both wheels touch the ground = Problem solved : ]
-----------
5.4 - Batteries
I was lucky with this little car. The 9V battery fits perfectly inside the chassis, and I can use the 3 AA batteries case, and save space to put the breadboard on the top.


-----------
5.5 - The Circuit
The Arduino is plugged from the 9V battery.
Red and black wires connect the 5V and Ground from the Arduino to the breadboard main row´s.

Now connect the Red wire from the AA batts into one row of the breadboard

Next, I will use five resistor´s of 1 ohm between the motor and the 3 AA batts.
This is low value resistors, each one of this resistors will make the motor go slower.
I could use only one resistor of 5 ohms, but using five of 1 ohm, I can have more control on the motor power.
If I want less or more motor power, I will remove or add another 1 ohm resistor.
This way the motor won´t burn out and it still have a good speed.


Note the Ground wire is connect to another row.

And this way I connect the motor wires. Turn on the power and see if it moves forward and if has enough power to drive your robot.
-----------
5.6 - The Servo

Connect the Servo to the breadboard.

Grab two wires and connect it into the breadboard main row´s 5V and Ground.
Grab another wire and connect the Servo Signal wire into Digital Pin 9 on the Arduino.
-----------
5.7 - LDR
Final step:

Place the LDR and resistors, they don´t have + or -. So you can place them in any direction.
The green wires to connect them into the Arduino Analog Input Pins 4 and 5.
------------------
( test the LDR as you did before)

This is the final look of our circuit.
Every physical steps are done! So now let´s upload some code into the Arduino.
-------------------------------------------------------
6 - Program!!!
---------------------------------------------------------

I´ve made the LDR antennas longer so it can be more sensitive to light variations.
-------------------------------------------------------




@ Mon, 2010-04-05 22:07
I was wondering...
Hey guys. I have a problem finding any Arduino...so i was wondering if i do find one miracalously, but isnt diecimila would it still work?
@ Mon, 2010-04-05 23:16
yes
yes
@ Thu, 2010-02-25 06:11
Chip switching
@ Mon, 2010-04-05 23:16
Yes, then on the Arduino
Yes, then on the Arduino software go to - Tools - Board - and select Diecimila, Duemilanove w/ ATMega168
@ Sun, 2010-02-14 21:15
Okay
Okay thanks, I got it i think.
Thanks again.
@ Sun, 2010-02-14 20:02
One more
@ Sun, 2010-02-14 20:53
you can do thisor if you
you can do this


or this is how I am connecting the servo on the tutorial:
use 3 wires, solder 3 pins on each side of the wires, one side goes to the servo connector, other side goes to the breadboard
@ Sun, 2010-02-14 07:40
How did you
How did you connect the servo to the breadboard? What connnecters/cords?
Great tutorial, explains circuitry well.
@ Sun, 2010-02-14 13:06
I used 3 male pins to
I used 3 male pins to connect to the breadboard, and then 3 colored wires to connect to the arduino.
If you don't have male pins you can only the wires:
red - +5v
black - ground
yellow - signal
@ Mon, 2009-12-28 16:00
Great tutorial
Awesome tutorial, it really helped me to build my first robot, Charruino 1.0 ;) You can find a video here http://www.youtube.com/watch?v=InTHxxQV_hg
As you may see, I used an H-bridge to control the front DC motor and re-use the car chasis.
@ Mon, 2009-12-28 20:11
Awesome!! It's so cool!!!!
Awesome!! It's so cool!!!! Good work!! :D
Ought to post the Charruino as a robot!!! ;-)
@ Tue, 2009-11-24 10:14
Using cars turning mechanism
Hi, Inside the car I have taken apart there is a motor which controls the steering. Is it possible to wire this up in the same way as a servo ? There is only two wires coming out of it though .... Obviously there is no data cable.
@ Tue, 2009-11-24 10:37
If there are only 2 wires it
@ Tue, 2009-11-24 18:24
DC motor
Hi, as far as I know it is just a regular DC motor but I was thinking that it might be possible to make a servo with that motor so I can keep the original motor. Does anyone have any experience with this or know how I can do it ?
Thanks
@ Tue, 2009-11-24 21:27
making a servo from a
making a servo from a regular DC motor would be a bit hard to achieve, at least to a regular hobbyist.. if you want the motor to just turn the wheel why not leaving it there making its function?
can you send us a picture?
@ Wed, 2009-11-25 22:09
Hi
Hi, thanks for the reply ! I think that it might be easier for me if I use a normal servo, but supposing I did try to use the motor how would I go about incorporating it into this robot to replace the servo ?? (I can't post a picture as I don't have a camera with me) Also in terms of the resistors I need will the ones in the image be okay (they are 1 ohm ) ?
Thanks,
Ben
@ Thu, 2009-11-26 02:06
1 ohm resistor is ok to tune
1 ohm resistor is ok to tune the motor speed
I never tried to build a servo motor from scratch, mas someone did: http://letsmakerobots.com/node/1524
@ Sat, 2009-08-15 22:38
I know the websites, i have
I know the websites, i have the book "Getting started wth arduino" i didn't have the board yet. All i'm saying is that how can it be possible to have the program editor if people bought the arduino diecimila and duemilanove plus the usb cable. IF they don't even know how to find the editor on the computer.
@ Sat, 2009-08-15 08:51
Say
Say what?
Computerreasearcher... the whole Arduino software setup is free. You should have gotten that first, before you got your board. :P
http://arduino.cc
Then click download, then choose your operating system. Also, if this is your first board, I HIGHLY reccomend you start with all the tutorials on the Arduino website, before you start making the robot. Makes understanding things 94% easier.
Also here's a good PDF for tutorials,
http://earthshinedesign.co.uk/ASKManual/Site/ASKManual.html
There's also a few more links at the bottom of that page for more great tutorials.
@ Sat, 2009-08-15 08:19
how can you upload the codes
how can you upload the codes from your computer to your robot if you bought an arduino with usb cable and no program editor.
@ Mon, 2009-08-10 21:43
Just wondering...
@ Mon, 2009-08-10 21:11
I was wondering...
instead of using the Arduino Diemicila, Can i use the Arduino Duemilanove?
and i have a hitec hs 311 servo... will that work for this project???
@ Mon, 2009-08-10 21:47
The Arduinos are 100%
The Arduinos are 100% compatible, only differences (I'm sure there's a few more), they added the auto-power select, auto-reset when you're uploading a sketch. And an upgraded chip (depending on how recent you got your Duemilanove), but as far as your servo goes, I'm not really sure on that one, I'll leave that up to someone else! :D
Best of luck, and remember to post some pictures and info when you get it poppin!:)
@ Sat, 2009-07-25 07:03
Interesting........ I'll add
@ Fri, 2009-07-24 02:54
Does the arduino have pins
@ Fri, 2009-07-24 03:06
The stock standard Arduino
@ Fri, 2009-02-06 01:16
Part II
just to say it won´t be any part I, I apologize for this.
I´ve done it, but its a bit wacky, too many wires and connections just to achieve a stupid goal... it was a good intention tough..
sorry mates
@ Fri, 2009-02-06 05:09
it stil has some great info
@ Thu, 2009-01-15 15:46
That's a nice tutorial
@ Thu, 2009-01-15 16:47
the original toy used to
@ Wed, 2009-01-14 22:10
Is the part 2 still in the
@ Thu, 2009-01-15 01:41
sorry mate, still haven´t
@ Thu, 2009-01-15 05:44
cant wait to see your
cant wait to see your H-bridge tutorial,
a couple days ago i ordered this, and it looks promissing maybe you could use this schematic to build a prototype
@ Thu, 2009-01-15 09:14
good shield
I started with one too, but unfortunately it got burned due to a stupid mistake and this accident made me work on a prototype, you can see it here. But wait for an update, because this HBridge prototype i´ve made, can and should be done in a more 'techy' fashion.. (with capacitors and so) ... :-)
@ Sat, 2008-10-11 05:27
It seems like an awful waste
@ Sat, 2008-10-11 12:34
good for you
why don´t you make one of those? :]
in case you haven´t noticed, the main purpose on this tutorial is to teach the basics of Arduino programming and setup
@ Sat, 2008-10-11 14:35
But your not even making a
But your not even making a robot that can avoid obstacles all it's doing is fumbling around a room till it hit somthiing and then maybe it turns a bit what I'm really saying is that we need an arduinobot more on the lines of FRITSL's first robot project see my post here: (http://letsmakerobots.com/node/2420)
Also whats the poit of having an spdt. switch if you have I believe to be photoresistors for eyes is it for those chance occasions when the photoresistors fail? If that's the case qhy not position them to the front of the robot?
P.S. I'm not trying to be horribly mean.
@ Sat, 2008-10-11 17:08
The keyword when we
The keyword when we discussed about an Arduino tutorial was to be EASY, and this was what I came up with, you don´t have to buy any expensive part and you almost don´t have to solde ..
The PART I is where the bot only moves in the light direction, the PART II will have a basic obstacle detection (the spdt switches)
If you follow it you will be able to give first steps with Arduino and move further on to more complex setups.
I´ve seen your track record, and I don´t see any robot project of your own, so maybe this could be a good starting point for you,
otherwise if you don´t like it whait untill someone make a better one, or you can make your own and share it with us
no hard feelings :]
@ Wed, 2008-10-22 19:24
i think this is an excellent
@ Wed, 2008-10-22 20:26
LOL
LOL
@ Thu, 2008-10-09 14:46
Nice work, but since it is a
Nice work, but since it is a Start Here project i would include some other things:
-explanation of the coding part
-explanation of how a breadboard works, since you are using one (this one with a few lines below it would be enough imo: http://en.wikipedia.org/wiki/Image:Breadboard-144dpi.gif)
-saying that 5 resistor of 1 ohm in series is like using a single resistor of 5 ohms
@ Fri, 2008-10-10 01:52
hi! Everything you say makes
hi!
Everything you say makes great sense, I will update this text as soon as possible
thank you for giving feedback
by the way, I found this walkthrough about breadboarding :)
EDIT: the text is done, only is missing the code explanation..
@ Sat, 2008-09-27 20:53
5 1ohm resistor ?
@ Sun, 2008-09-28 00:47
I found that if I use 1 ohm
I found that if I use 1 ohm resistors I could be more precise setting the motor speed
@ Tue, 2008-09-23 01:06
I have everything working
I have everything working and i was pretty impressed, but i noticed that my motor driver gets hot, ist that normal or is there something i should worry about.
@ Tue, 2008-09-23 08:42
I think it´s normal, I
Is it really hot that you almost can´t touch it? Or is it just warm?
@ Tue, 2008-09-23 19:04
They are just kinda warm. I
@ Tue, 2008-09-23 19:29
That is quite normal.. :)
@ Tue, 2008-09-23 20:37
Sink
@ Wed, 2008-09-24 09:37
Speaking of heatsinks. Does