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

FeaturedContest Winner
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:

Remove these adsRemove these ads by Signing Up
ram_woj1 month ago

what is the alternative of tamiya tracked vehicle chassis?

ishan5532 months ago

please tell me which wire to attach where.

you can mail me at

plz inform me.

and dude awesome project

neklausk4 months ago
gimme da code
exia004 months ago
this is my mini project. thanks to Chowmix12 for the coding, I only made some adjustment on the LDR reading, and change where the motors connected to pin because I'm using motor driver.

and on the top of the board I put Xbee to send the reading wirelessly to MatLab and plot some graph.
ecc2065 months ago
Hi, does it crash often?
Ouranos6 months ago
ive got a question does the code on this page work the same for arduino uno?
impressive project. this show us what wonderful robot can be built with a simple light sensor
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!
Ah! i've got it working! thank you so much!
can you transfer the code on an attiny?
theargha1 year ago
Pls include some pics during assembly
axz11 year ago
Hi.. Can you please give more instructions on the assembling of hardware?
curious061 year ago
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?
rashtekar1 year ago
i am not able to get the aurduino with proto shield.. :-(
what is the name of your robot base, or can you recommend where to buy one online? Instructable is awesome, thanks man.
NinjaCrow1 year ago
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 ~.~
something11 year ago
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.
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.
emdarcher1 year ago
i am making a robot using your instructable, but i am using a base just like in this instructable,
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
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=41 year ago
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
rhuk1 year ago
Hi, did you use the gear in standard speed (58:1) or in low speed (203:1)?
Thank you.
jhuang161 year ago
hi could you provide more detail about making the suspension system on the tank? thank you
Would it affect the light sensing ability if I were to put a cover over the top?
singh12342 years ago
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.
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. here it is.
Chowmix12 (author)  DHTArduinoNerd2 years ago
Yes it can! The Adafruit Motor Shield is perfect for this project!
could you post instructions on how to install the components through the adafruit.
Chowmix12 (author)  DHTArduinoNerd2 years ago
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.
Bl1ZzARd72 years ago
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)  Bl1ZzARd72 years ago
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.
tim1272 years ago
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)  tim1272 years ago
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.
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.
hhhh19972 years ago
My motor needs more current what should i do? (2A Per Motor)
Chowmix12 (author)  hhhh19972 years ago
Try a dedicated motor driver.
what do u mean ? i'm new to arduino..
vadipp hhhh19972 years ago
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.
vadipp2 years ago
There is a bug in your code:
SensorDifference = abs(SensorRight = SensorLeft);
should have - instead of =, like this:
SensorDifference = abs(SensorRight - SensorLeft);

Get More Out of Instructables

Already have an Account?


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!