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!!

2870155214_51cabbcd4a.jpg

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:
https://www.robotshop.com/letsmakerobots/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:

Getting Started with Arduino

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! : )

2870153318_2decc88a44.jpg

This was 5€ and I will use it´s chassis as platform

2869326231_c444bd6d70.jpg

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 - .

LDR.jpg

Take one wire and connect into one Arduino Analog Pin of your choice

LDR CODE

-----------

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.

SERVO CODE

2870154746_56769ab226.jpg

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.

2869326171_801e11be65.jpg

Solder two cables to the motor pins.

2869326113_82a708389b.jpg

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

2869326231_c444bd6d70.jpg

Another little car was vandalized, this time I will use the front wheels to have the steerings.

-----------

5.3 - Servo and Front Wheels:

2870154832_4236268678.jpg

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.

2870154930_6294664734.jpg

Left wheel doens´t touch the ground = PROBLEM

2869365113_00aec2cfce.jpg

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.

2889740373_e72e6941a5.jpg


2870153520_cbd46c6ff5.jpg

-----------

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.

2889690009_7968cf945e.jpg

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

2889690253_497dedb098.jpg

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.

2890525724_fd654746f0.jpg


2889690423_dab3d0122b.jpg

Note the Ground wire is connect to another row.

2889690515_117fb9c0b8.jpg

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

2889690713_b8bd04b919.jpg

Connect the Servo to the breadboard.

2889690809_d74a66dee1.jpg

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:

2889690889_09ed16f351.jpg


Place the LDR and resistors, they don´t have + or -. So you can place them in any direction.

2889690997_e3a5c1c4d4.jpg

The green wires to connect them into the Arduino Analog Input Pins 4 and 5.

------------------

( test the LDR as you did before)

2889691095_1ca5537590.jpg

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!!!

Robot Program

---------------------------------------------------------

2890526796_a634dc7c38.jpg


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

-------------------------------------------------------

2869327939_803da02f8c.jpg


I hope you find this tutorial usefull!! And I hope to see your Arduino robots posted soon :wink:https://www.youtube.com/watch?v=K93qAywU6H0
1 Like

Nice
Great tuturial and robot. looks like a bug. lol

Thanks silva_p!!!you seem to

Thanks silva_p!!!

you seem to be portuguese!! at least you have portuguese name :slight_smile:

very good this tutorial,
very good this tutorial, congratulations, and that works very well. Thanks!
greetings from Guatemala

Thanks :slight_smile:

Thanks :slight_smile:

yay thank you so much i will
yay thank you so much i will get one of the motor drivers and my bot will be posted

**Cool Nebster!!!Go for it **

Cool Nebster!!!
Go for it :slight_smile:

I´ve been thinking, and I

I´ve been thinking, and I would like to know your opinion.

I´ve made the H-Bridge in this tutorial so it would be a good start, but, since the bot only moves forward it is not completely needed.

I could make a PART I, without the H-Bridge where we connect the AA batteries wires directly to the motors (with one or two resistors) and this tutorial would be a lot easier for beginners.

Than in PART II, I could add two SPDT bump switches to detect obstacle colision and here I would add the H-Bridge since the motor bot would need to move backwards and than move forward to change its direction

I would love to know what do you think about this :wink:
guibot

sim

sim sou. lol

I tink you could do both parts but i think the second would be more usefull.

Cool!! :)Yes the second

Cool!! :slight_smile:

Yes the second part would be more interesting and usefull!!

The first part would be something like "First Steps with Arduino".

I think I will move on with this :wink:


The breadboard scares me!!

Thank you so very much for making this. I can see that it has taken a lot of efford, and I will link to it from the start-here-page…

I promised that I would make the robot from a simple Arduino startup-project, and I was just about to order the parts… but this stuff scares me. I am not ging to dig into so many wires on a breadboard. I am simply too stupid to manage so many wires & connectins, I may learn a lot, but it will take for ever, and I hate that!

Could this not be done with a seperate motor driver on a board, no breadboard, and twice as simple at least?

PS: I like the way it is steering :slight_smile:

PPS: Sorry that I am too stupid.

**LoLNo need to be scared! **

LoL
No need to be scared! Breadboards don´t byte! :)))

I have a lot of fun doing this, and maybe I will break the tutorial in two parts, first part without h-bridge, second part with the h-bridge. It will be very beginner oriented!

Yes you can use a motor driver of your choice and no breadboard as well… It´s up to you :wink:

OK, so I know the serial
OK, so I know the serial parts of the code are important for visualizing the values, but is it really necessary?

OK, so I know the serial
OK, so I know the serial parts of the code are important for visualizing the values, but is it really necessary?

Serial is necessary to

Serial is necessary to comunicate with other devices that supports Serial comunication.

If I only use the Serial command to visualize data, I comment it before uploading into the Arduino.

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.

I think it´s normal, I
I think it´s normal, I don´t have the habbit of touching IC´s …

Is it really hot that you almost can´t touch it? Or is it just warm?

They are just kinda warm. I
They are just kinda warm. I only touched it cause i was picking the thing up and i was like, "Hmmmmm… Thats starnge."

That is quite normal… :slight_smile:
That is quite normal…   :slight_smile:

Sink
Every where i have read it is recommended to put a heat sink on this motor driver chip. i recommend RAM Heat sink’s for PC’s and Thermal Glue.