Light chaser

This little vehicle is on an impossible, never ending mission to catch the light. You can make it follow you by pointing a flashlight at it. (The one on your mobile phone eg.) It will always turn towards the light.


  • 1 Arduino Uno board
  • 1 Basic Education shield
  • 2 continuous servo motor
  • 1 100 µF capacitor
  • 2 LDR sensor
  • 2 1k ohm resistor
  • 6 colored jumper wires
  • 2 black jumper wires
  • 8 AA batteries
  • 1 AA battery holder
  • 1 power connector
  • 1 Light Chaser kit
  • 1 ping pong ball


  1. Connect the shield to the top of your Arduino board.
  2. Connect an 1k ohm resistor between GND and analog pin A0 across the breadboard.
  3. Connect a LDR between Analog Pin A0 and 5V. Place it on the left side of the vehicle.
  4. Connect another LDR as shown in the following images. Use the Analog Pin A2.
  5. Connect the 100 µF capacitor between GND and 5V. Connect the short leg to GND and the long one to 5V.
  6. Connect Arduino to the computer and upload the example: File -> Examples -> Castilla -> Robots -> LightChaser.
  7. Build the vehicle with the vehicle kit.
  8. Connect the left servo motor to D10.
  9. Connect the right servo motor to D9.
  10. Place the electronics in the vehicle. Make the LDRs point outward from the vehicle.
  11. Connect the battery pack to the power jack.


You can find the code at: File -> Examples -> BasicEducationShield -> Robots -> LightChaser

How it works

The program checks the left LDR sensor to see if the light is higher than the threshold. If so, turn the left wheel backward and right wheel forward so the vehicle turns left. It does the same for the right LDR sensor, but turns the wheels in the opposite direction to turn right. If neither of the LDRs passes the threshold, the Vehicle simply moves forward turning both wheels at the same rate.


  1. Vehicle is not turning towards light? See LDR reference about how to debug LDRs.
  2. Motors are not working/Vehicle is not going straight? See the reference about how to debug servo motors.

Experiment further

  • Can you turn it into a “Vampire Vehicle” so that it runs away from light?
  • Modify the example so the Vehicle only moves when there is a light pointed at it.