Light Dependent Resistors

The resistance of a Light Dependent Resistors is determined by how much light falls on them. If lots of light falls on them then lots of current is allowed through. If little light falls on them then little current gets through.

Have a look at the below circuit. Here, you use a 10K Ohm resistor (much stronger than the one we used with LED lights). Position the green wire last. (Note: you can get more detailed information over here).


Now, all we are going to do is read the Light Dependent Resistor value:

void setup(void) {
 Serial.begin(9600); // This allows the Arduino to send info back to the computer, for debugging
int photocellReading = 0;
void loop(void) {
 photocellReading = analogRead(0); // make sure that your photoresistor is connected to pin 0
 Serial.print("Analog reading = ");
 Serial.println(photocellReading); // the raw analog reading

Notice the code:

Serial.print("Analog reading = ")

This line tells the Arduino to send information back to the computer, so that you can see it. To see it, however, you ned to open a new window. In the Arduino IDE, go to Tools > Serial Monitor. A new window will pop up which will show you all of your print outs.

What kind of values are you getting?

If you are working in a room that is very bright, and you are more interested in measuring the differences in bright lights, try using a different resistor: a 1K Ohm (instead of a 10K Ohm)