(w/ Video) Basic Arduino Robot, Light Seeker!

 by Chowmix12
Contest WinnerFeatured
P1060969.JPG
P1060972.JPG
P1060976.JPG
Many times I have Googled for "Arduino Robot" in hopes of finding a robot to build. I end up finding many versions of a obstacle avoiding robot that uses either an infrared or a sonar range finder sensor mounted on a servo to detect objects in its way while randomly roaming the area around it. The problem with this robot is it is expensive and very advanced in some aspects for a "first robot" to make with an Arduino board. The cost of a servo is about $10, and a range finder sensor runs from about $10 - $30.

This instructable will cover how to make a light seeking robot (Photovore), and some robotics and motor control basics. This robot can be built with parts found at the nearest Radio Shack, if you already have an Arduino board and a robotic base. The cost for a five pack of CdS cells (Light dependent resistors) cost $2.99 at Radio Shack. and a 15 pack of NPN transistors (very useful later on) are also $2.99. Of all these parts, we will only need two NPN transistors and two CdS cells.

Please remember, this is my first instructable.
I really appreciate criticism, comments, questions, and suggestions.
Your feedback will help me improve this instructable and future instructables created by me.


Check out our website

Note: by posting any pictures in the comments, you are giving me full rights to the posted image (disclaimer to post robot pictures on the last step.)



If you have a robot base, with and Arduino and full motor controller, you can use it to control your robot with a computer:



If you're bored or want to support us (students), watch this fun video:
 
Remove these adsRemove these ads by Signing Up

Step 1: Materials

The materials you need are:
2 CdS cells
2 NPN transistors
2 current limiting resistors for the transistors (I used 1k ohm (brn - blk - red) )
2 flyback diodes. (1n4001 - 1n4003). You can scavenge these out of AC to DC converters. (shown in the third picture)
1 Arduino development board (I used a duemilinove, but an Uno, diecimila, NG, etc. will work.)
1 robot base. (Go to step 2 for more info if you don't already have one)
1 Arduino supply battery pack (usually 9 volt batteries.)
1 Motor supply battery (2-4 AA batteries work well.)
1-40 of 132Next »
FLIPminoman says: Mar 29, 2013. 9:06 PM
If you get lost in a cave it's light seeker to the rescue! +1 for practical application! Or you can use it to find the best spot for a light-requiring plant!
softenersreviews says: Mar 2, 2013. 4:03 AM
Ah! i've got it working! thank you so much!
arduino 123 says: Feb 26, 2013. 4:35 PM
can you transfer the code on an attiny?
theargha says: Feb 16, 2013. 1:26 AM
Pls include some pics during assembly
axz1 says: Feb 1, 2013. 7:12 AM
Hi.. Can you please give more instructions on the assembling of hardware?
curious06 says: Dec 5, 2012. 9:38 AM
Hey great tutorial and im currently building the same thing...i have a problem though...i'm using the tamiya gearbox and instead of npn transistor, im using TIP120. however, after doing all the connection the motor just move a bit and stops. i guess it needs more torque to move forward. could you please help me out or suggest i do something?
rashtekar says: Oct 20, 2012. 3:07 AM
i am not able to get the aurduino with proto shield.. :-(
solarstudent says: Oct 5, 2012. 6:14 AM
what is the name of your robot base, or can you recommend where to buy one online? Instructable is awesome, thanks man.
NinjaCrow says: Jul 17, 2012. 7:48 AM
Ahh this brings me back, My first robot was surprisingly similar :)

I absolutely adore the Tamiya base. I remember seeing it at Fry's one day and buying it with the express intent to build a robot :)

Never did finish the sensor package I wanted for mine so it just took a range reading on objects in front of it. Then took the last bid from that reading to decide on turning right or left. Always meant to go back and finish it but alas my cat had other plans ...... like puking on it ~.~
something1 says: Jul 3, 2012. 7:54 AM
Hello what where the transistors and diodes and resistors for.

And I have a problem i cant get the same readings from both sensors they are very different i tried using 2 5k pots the change the values but they dont work well at all. I was thinking about constraining the values and mapping them to 0 - 255 but i cant figure out a code for that. I am using the LDRs for a Line Follower.
NinjaCrow in reply to something1Jul 17, 2012. 7:33 AM
Quick speculation.

The transistors are being used to drive the motors. The Arduino cant source enough power on its own, the transistors are acting essentially like a light switch that the Arduino can flip on and off that connects directly to the power supply.

I'm rusty but the resistors are either acting for biasing or to limit the current, maybe both.

A lot of times you will see both a capacitor and a diode hooked up to a DC motor, the caps help with the initial power draw that the motor can place on your supply.

The diodes are there to prevent reverse power flow from the motors. Motors are act a lot like inductors. primarily because both are essentially wire windings. When you power an inductor it induces a magnetic field. When you stop the power flow to the inductor that field collapses and you are going to get a negative voltage spike.

As for the sensors the question is how different are the readings and are you taking readings under the same conditions? Just to decide if they are working properly you should probably take a multimeter and get a resistance reading. First by covering the sensor then by saturating it with as much light as you can. As long as those readings are similar and within spec for the part then you are fine.

The rest of the time the readings should be different. That is how the robot decides which direction to go.
emdarcher says: Jun 1, 2012. 6:24 PM
i am making a robot using your instructable, but i am using a base just like in this instructable, http://www.instructables.com/id/RC-Car-to-Robot/.
it is an rc car and is using the arduino motor shield which has an H-bridge.
over serial it appears to work fine, but when driving it's steering wheels keep turning back and forth rapidly and randomly, sometimes stopping a bit in the left turn position.
i don't really know the problem, the left and right turning codes have worled otherwise in non-sensor tests.
i really want this to work, it is my first arduino robot, so i am kinda a noob.
i chose the rc car as a chassis because it was easier to obtain than the tamiya, although i might get that when i have more money.
also i was using the makershield, and now a full sized breadboard to maximize the space between the two sensors but has not helped,

anybody know the problem or how to fix it,

my rc car was also modified to be switched from rc or arduino control, so it still has a rc board within its body, but the motors are connected to both the arduino and rc board. the power is from the on-board battery holder with 4 AA batteries. the power connections are to the Vin and ground screw holes on the arduino motor shield.

any help will be greatly appreciated
electrokid101 says: May 28, 2012. 7:21 PM
You should DEFINATELY add a bluetooth module to this robot... everything is a little more fun when you have an extent of control over a device.
2+2=4 says: May 11, 2012. 4:07 PM
Great tutorial for beginners- Thanks

How were you able to connect the Protoboard to the motors?

I am currently following this tutorial (in my spare time), and right now I have completed the base, platform, and building the protoboard. What is the next step?

I appreciate any help I can get
rhuk says: May 5, 2012. 11:24 AM
Hi, did you use the gear in standard speed (58:1) or in low speed (203:1)?
Thank you.
jhuang16 says: May 3, 2012. 1:29 AM
hi could you provide more detail about making the suspension system on the tank? thank you
LinuxWunderbar says: Apr 18, 2012. 10:04 PM
Would it affect the light sensing ability if I were to put a cover over the top?
singh1234 says: Apr 8, 2012. 1:48 AM
hi guys, I want to build a robot like this but instead of any sensors, I want to pre-program a route into an Arduino, so when i turn it on, the robot follows the route I program in Arduino. Can somebody please help me with the program. I dont know where to start. I do know c++. thanks in advance.
DHTArduinoNerd says: Mar 20, 2012. 1:46 AM
A question.... Can an adafruit motor shield be used for this one. Is the circuit design for it the same. The Adafruit Motor Shield is an H Bridge shield used for controlling dc motors, servos and steppers.

http://www.ladyada.net/make/mshield/index.html here it is.
Chowmix12 (author) in reply to DHTArduinoNerdMar 20, 2012. 3:06 PM
Yes it can! The Adafruit Motor Shield is perfect for this project!
DHTArduinoNerd in reply to Chowmix12Mar 21, 2012. 9:34 PM
could you post instructions on how to install the components through the adafruit.
Chowmix12 (author) in reply to DHTArduinoNerdMar 26, 2012. 7:40 PM
I don't have any experience with the adafruit shield, but you should connect the motor leads to the shield, and then you will be able to control the two motors using the specific pins. look for more info on adafruit's website.
Bl1ZzARd7 says: Mar 19, 2012. 6:04 PM
Did you have to cut the drive shafts for the dual motor to work on the tamiya Chassis kit? Or is the dual motor compatible to work with the chassis out of the box
Chowmix12 (author) in reply to Bl1ZzARd7Mar 20, 2012. 3:07 PM
I didn't have to cut the drive shafts for the Chassis, but i did have to make two notches in the wood Chassis for the mounting screws.
Bl1ZzARd7 in reply to Chowmix12Mar 21, 2012. 2:25 PM
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!
tim127 says: Feb 28, 2012. 4:54 PM
Nice robot, im thinking of making something similar. I have a question though, in the second vodio you plug something into some pins on the robot and it runs wirelessly, what is it and what are the pins?
Chowmix12 (author) in reply to tim127Mar 12, 2012. 8:44 PM
I just noticed my first reply didn't come through.. So! The module I plugged in was a Bluetooth module. It acts just like a serial connection like the one in a USB plug. I suggest getting used to Serial connection and building up your robot to be controlled through the USB cable. Then, when you are ready, you can use a Bluetooth module. The RX of a Bluetooth Module connects to the TX pin (pin 1 on Arduino), The TX pin of the Bluetooth module goes to the RX pin (pin 0 on Arduino) . Make sure that the Bluetooth module operates at TTL levels, which is 5 volts.
tim127 in reply to Chowmix12Mar 13, 2012. 5:09 PM
Thank you, i have never used bluetooth before to connect to a computer, is there a specific module that you prefer/ Or they all the same if they operate at TLL levels.
hhhh1997 says: Jan 20, 2012. 2:26 PM
My motor needs more current what should i do? (2A Per Motor)
Chowmix12 (author) in reply to hhhh1997Jan 20, 2012. 2:56 PM
Try a dedicated motor driver.
hhhh1997 in reply to Chowmix12Jan 20, 2012. 3:24 PM
what do u mean ? i'm new to arduino..
vadipp in reply to hhhh1997Feb 3, 2012. 9:21 AM
There are separate boards available which can be plugged into the arduino board and control the motors. You can search for "arduino motor shield" on your favourite internet search engine.
vadipp says: Feb 3, 2012. 9:16 AM
There is a bug in your code:
SensorDifference = abs(SensorRight = SensorLeft);
should have - instead of =, like this:
SensorDifference = abs(SensorRight - SensorLeft);
Maki_mx says: Dec 15, 2011. 1:17 PM
Thanks!! I have been having problems connecting, the negative terminals and the ground, it just wont work, could you repeat in a different way how to connet the emmiter and the collector? Everything else works fine.
Maki_mx says: Dec 10, 2011. 4:08 PM
Hey, could you pleace help me out (dummie style) and tell me how to use the bluetooth modem? do I have to change the code? How do I connect the modem to the arduino. Thanks :D
pnova8 says: Dec 2, 2011. 10:09 PM
Hey, great I'ble, I was able to follow your instructions easily, but am having one small issue and thought you might be able to help. Only one of my motors, the left one, actually runs. However, both light sensors respond in a logical way; when the right one is covered or the left is exposed to bright light, the motor stops, so both work. I know the right motor works too, because when I switch the outputs, the other motor runs (so that shows the output circuitry works on both sides as well). Perhaps it's something with the inputs? But both light sensors work properly, so I'm not sure it's that either... Anyway, I think you did a great job on this and if you have any ideas I'd really appreciate them!
Chowmix12 (author) in reply to pnova8Dec 3, 2011. 11:46 AM
If I understand you correctly, both transistors are working, but you aren't able to use them with a certain pin. You may want to try using a different pin for your motor, incase one pin is defective. You will have to change the code a little bit though. Give it a try..
pnova8 in reply to Chowmix12Dec 3, 2011. 12:59 PM
That was it! It works now. Thanks for the tip, and great I'ble! 5*
wunderdog317 says: Nov 11, 2011. 3:05 PM
i did something like this but with one photoresistor 3 servos 2 continiuos rotation and one not and no transistors
arunkatrina says: Oct 3, 2011. 6:13 AM
hi chowmix
it was wonderful to c ur robot
can u give me more details about how to connect the components in bread board
my id is kaifarun@gmail.com
help me friend
1-40 of 132Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!