Picture of LDR Robot
LDR Robot with IR and a Servo

The LDR/IR Robot is designed to seek out light and avoid obstacles. The robot uses the Light Dependent Resistor to seek out light and the Infrared Sensor to detect and avoid objects in its path. The following are instructions with pictures to show exactly how we built our robot. Your robot can be designed the way you desire and in your own order. At the end of this manual you will find some pictures of various robots built with this kit. Use your imagination and make your robot unique. Have fun!

Here is a video of the robot in action!

Here are the parts that our kit contains. Our kit can be purchased here:

You will find that not all parts have to be used.

1 x Arduino  
1 x Battery Holder
1 x Acrylic Chassis  
1 x  On/Off Switch
2 x Motor Gearbox and Wheel  
1 x Power Jack
3 x LDR  
1 x IR Receiver
12 x LED  
2 x IR LED
14 x Resistor 
1 x Servo
4 x NPN Transistor  
1 x Ping Pong Ball
4 x Diode  
2 x Screw
1 x Bread Board  
2 x Velcro
1 x Straw  
1 x Wire Pack

The tools used in this project are:
Hot Glue Gun
Small Screwdriver
Needle Nose Pliers
Wire Stripper
Electrical Tape
Soldering Iron(can be done without)
Remove these adsRemove these ads by Signing Up
tasfia2 months ago

hey... how do u run the motors . what is the code for running it ? pls answer asap kindly..plsssss

EGRobotics (author)  tasfia2 months ago
Hi Tasfia,

The motor are connected to transistors which are switched by pins 8 and 9 on the Arduino. This can be seen in Step:10

After you have declared pins 8 and 9 as OUTPUT in void setup()
eg. pinMode(8, OUTPUT);

You can turn the motor on in void loop by digitalWrite(9, HIGH);

You can turn the motor off by digitalWrite(9, LOW);

If you are still having trouble after this I would suggest going through:

EG Robotics

Nursultan10 months ago

Hello! Iam tryed to make the same, but is not work. How i can contact with you?

EGRobotics (author)  Nursultan10 months ago

Hi Nursultan,

You can email me with whatever problems you are having and I can take a look and get back to you! My email is Looking forward to hearing from you!


Sir,,This look pretty good!!
My question being,, is the transitor work just as an amplifier to amplify the input signal??
and if i am not wrong then here we are not controlling the speed of motor, right??
can we control its speed using pwm pins(analog o/p)??
and How can we increase the sensitivity of LDR?

i would be delighted if 'm acknowledged by your suggestion, SIR!!
EGRobotics (author)  garry_magnanimous1 year ago
Hi Garry,

The transistor's works to amplify the Arduino's output to the motors. The Arduino's digital outputs can only do a around 50 mA or something. The transistors use that tiny amount to open a gate to the Arduino's 5V which can do around 500 mA.

Yes you are correct, in that we can use analogWrite to control the speed of the motor if you wish to change it.

You can change the sensitivity of the LDR by either narrowing the the SensorDifference value or changing the 10K resistor for another value.

Goodluck! If you make one we'd love to see it!

ikochar2 years ago
which diode have u used here
EGRobotics (author)  ikochar1 year ago
Hi ikochar,

I missed your reply, sorry. In case you are still wondering we just used what we had around I believe they are 1N4007. Hope you figured something out by now though.

EG Robotics
topek_251 year ago
for step 10, where do i put the 2 diodes?
EGRobotics (author)  topek_251 year ago
Hi Topek_25,

Sorry for the late reply. Here is a quickly made picture of where the diodes go. The diodes go between the motor leads. This keeps any voltage created by the motor spinning from momentum or any other force from being a nuisance. Good Luck!

EG Robotics
ikochar2 years ago
it is all fine but which transistor have you used here?
EGRobotics (author)  ikochar2 years ago
We use 2N2222 transistors. Their only rated at around 600 - 800mA so be sure to use them through the Arduino so that it bogs down the voltage regulator instead of destroying the transistors. Have Fun!
curious062 years ago
hey i connected everything the way you described and the left wheel rotates while the right wheel doesn't..they have exactly the same kind of set up and connected to the right pins..but if i switched the left motor pin in to the right transistor the left one work, any suggestion?
EGRobotics (author)  curious062 years ago
Hi Curious

Do you have the IR and IR Sensor attached? Or just the light seeking part? If you have the IR sensor attached what code are you using and did it work before attaching the IR Sensor?

The Right transistor works because you tested plugging the left motor into it. Is that what you are saying? Did you plug the Right motor directly into the power source to ensure connections between wires and motor? If so did the motor work? if it didn't check connections at the motor especially if you used the hot glue method. Double check your diode set up on that motor as well.

Let me know if you have any more questions! also post the solution to help others in the future! Also did you buy the kit from us? if not are you using the exact same motors? You can always email us from our sites email for additional help as well!

EG Robotics
This is great! It's like you read my mind are are a few weeks ahead of me. I have planned this same project almost exactly and just received all my parts. Even the ping ping ball caster, LDR, and IR. Your instructions have cleared up some details I was working out. I was building my son a robot for Christmas. Thank you so much.
EGRobotics (author)  matt.e.jenkins2 years ago
Thats great! Have fun with it!
great instructable! I like how you put code in each step of the process. I like your simple design, do you think it's possible to do this with out a microcontroller? have the output from the resistors drive the motors directly?
EGRobotics (author)  amandaghassaei2 years ago
To have the output from the Light Dependent Resistors Drive the motor directly would not be possible because of the high resistance of the LDR.

My battery Box is 6 rechargeable AAA's so thats 1.2V * 6 = 7.2 Volts.
My LDR is putting out 1500 Ohms in Normal Light and the motor is 5 ohms. To find the amps add up the ohms = 1505.

Amps = Volts/Resistance Amps = 7.2/1505 = .0047 A which isn't enough to move our motors.
Also the voltage usage of each Volts = Amps * Resistance
Volts = .0047 * 5 = .023 Volts which also isn't enough volts.

However if there was such thing as a LDR that was like 5 or 6 Ohms when it was bright and 4 or 3 ohms when it was dark that would probably work. Instead of using a full blown micro-controller you can do like Higgs Boson did in this Instructable and use a 555 IC. Which you made me want to do now! Maybe I'll add how I did it to mine later! Thanks!
what if you just use a transistor to step up the current but control the voltage with the LDR?
EGRobotics (author)  amandaghassaei2 years ago
So I set up a circuit like the one below and it worked in a brighter setting. If I had some potentiometers lying around could have played with it a bit more. Lower resistance LDRs would have worked better as well. However I am interested in your opinion, how would you set it up?
yes, this is exactly what I was thinking! And yes, the high resistance of the LDRs will make the range of the voltage divider somewhat limited. There is a way to get around this: set up another transistor as an amplifier.

Start with a circuit like this one.  Set up a pot and the LDR as R1 and R2.  (You can forget about the capacitor since we are not working with an AC signal).  Then use another pot for RC.  You will need to mess around with the pots a little to figure out what gives you a signal centered around 2.5V with a good amplitude (ideally extending from 0 and 5V) from Vout.  Eventually, you should replace the pot in series with the LDR with a resistor, and you can use the RC pot to adjust sensitivity.  Then send Vout to a second transistor set up as an emitter-follower (just like what you have in the image above).  Simply connect Vout to the base of this transistor and drive the motor from the emitter.

let me know how that works!