Introduction: Photoresistors

What does is do:

A Photoresistor is a variable resistor that let current flow easy when it is exposed to light. It's most used as a sensor to detect changes in brightness. Streetlights often use a photoresistor to detect when it should turn on.


Other names:

Photocells
CdS Cells
Light Dependent Resistors (LDR)
Photoconductive cell

What does this instructable say:

We got a task to study the photoresistor and play around with it. In the end we should present our findings on Instructables, so this is the instructable and all our findings.

Content:

Step 1 - Data sheets and explanation on how it works.

Step 2 - Facts and Findings

Step 3 - List of good tutorials

Step 4 - Calibrating sensor

Step 5 - Example: Light LED when dark

Step 6 - Example: Light theremin

Step 7 - Example: Controlling a servo

Step 8 - Example: Line tracker

Step 9 - Example: Laser Tripwire

Step 10 - Example: Light painting with LEDs

Step 11 - Example: Tea / timer

Step 12 - BlowOut robot

Step 1: Data Sheets and Explanation

There is a lot of different photoresistors, some of them have different values of resistance at different lux levels. We have used the photoresistors that comes with the Arduino Starterkit, witch is the VT90N2, and the data sheet that follows with it (http://arduino.cc/documents/datasheets/LDR-VT90N2....

We have marked what applies for the photoresistor we are using.

It says:

The resistance from the photoresistor, when exposed to 10 LUX, is typically 24 kΩ, but can vary from min 12kΩ to max 36kΩ. That does not mean that 10 LUX is the brightest reading, just a point where they measure it.

In the dark, 0 LUX the resistance will be 500kΩ.

Out of that information you can make a graph like the one in the picture. We have marked the line for our sensor with red. It shows how much resistance you will typically get at the different levels of brightness(LUX).

Response on different colors:

Photoresistors, particularly the common CdS cells that you're likely to find, are not sensitive to all light. In particular they tend to be sensitive to light between 700nm (red) and 500nm (green) light. In the relative spectral response chart you can see which colors the photoresistors are most responsive to.



This information and some of the pictures are from: https://learn.adafruit.com/photocells/overview

Step 2: Facts and Findings

Facts

- Non-polarized (does not matter which pin is + and -)

- Can't connect more than 6 photoreistors to the arduino uno(they will interfere with each other)

- Photoresistors are very solid, only weak point is breaking the pins near to the sensor head.

- You need a pull-down resistor to get information to the analog inputs. Should be between 1kΩ and 10kΩ.

- A smart trick is to use a potentiometer as a pulldown resistor and use the serial-port to find the biggest range of information.

- Remember that it conduct current when it’s light. So if you connect it directly to a led, the led will light up when it’s a lit environment, often you want the opposite effect.

Typical uses:

- Street-lights

- window blinds

- Yard lights

- Sport timing set

- Line trackers

- The apple watch (to sense your pulse)

- Cd-readers (uses laser sensitive resistors)

Step 3: Good Tutorials

Fading a led (beginner tutorial)

http://playground.arduino.cc/Learning/PhotoResisto...

Conecting photocensor to LCD display

http://www.dreamdealer.nl/tutorials/connecting_a_1...

Calibration:

http://arduino.cc/en/Tutorial/WhileLoop

Laser Trip Wire:

--http://www.youtube.com/watch?v=jbS2WK5Ap0Y

Instead of hacking the laser, we just stabilised the button to be on all the time.

Light Meter:

https://www.youtube.com/watch?v=ys6k5vrQ31c

Motor Speed:

https://www.youtube.com/watch?v=ZQdlVsk-Urg

Step 4: Calibrating

The photoresistor is a sensor with low accuracy and a variety in different readings depending on the environment and the pull-down resistor. Often when using photoreistors you want a clean value, a minimum value and a maximum value for the current environment. So you can map it to control a led, servo, piezo and other stuff.

A claibration tutorial from arduino:

http://arduino.cc/en/Tutorial/WhileLoop

Separate calibration and smoothing code:

You can put this code in a separate tab so it does not mess up your main code.There are some instructions that needs to be followed.

The code file is called SMOOTH_CALIBRATE.ino

Code for autoadjust:

This code atoadjust your sensor-input so it will work the same in different environments witout claibration.

The code file is called autoadjust_sketch.ino

Step 5: EX: Light When Dark

- Easy

- Turn LED on when it is dark.

- Can be altered to turn LED on if it detects light as well.

CODE FILE: LightWhenDark.ino

Step 6: EX: Light Theremin

- Intermediate level

- The photoresistor controlling a piezo speaker.

- Uses the separate calibration code.

CODE FILE: code_Piezo.zip

Step 7: EX: Controlling a Servo

- Intermediate level

- The photoresistor controlling a 180 deg. Servo.

- Uses the separate calibration code.

CODE FILE: code_Servo.zip

Step 8: EX: Line Tracker

- Intermediate level

- The photoresistor detects reflection from different surfaces.

- Then uses a 180 deg. Servo to point where the "car" should turn.

- Uses internal calibration code.

CODE FILE: codeReflectionDetection.ino

Step 9: EX: Laser Tripwire

- Easy (can be a little tricky to set up)

- You'll need: one laser, photoresistor, piezo 8 bit speaker, jumpers

- The laser beam triggers the photo resistor and when someone walks by and cuts the connection, the speaker makes a sound

CODE FILE: TripWire_photoresistor.ino

Step 10: EX: Light Painting With LEDs

- Intermediate level

- Uses a camera with 30 sec. or longer shutterspeed.

Alternative1:
- when the light of the LED is over a certain level, the LED turns off.

- Resluts in a picture of a black area around the sensor.

Alternative2:
- When the light of the LED is beneath a certain level, the LED turns off.

- Results in a picture of a fan of light around the sensor.

CODE FILES: code_off_when_detected.ino

code_off_when_out_of_reach.ino

Step 11: EX: Tea Timer

- Easy

- Alternative 1:

Place something to hold the cup you are measuring with. And use the first code "Photoresistor_tea_experiment" to see how much light the resistor can read through different beverages.

-Alternative2:

Time you tea with a photo resistor. It will tell you when your tea is done by reading the light through the water to a certain strength of your wish. When the resistor reads the value of your wish, a LED will turn on. You can program this yourself with the Arduino code "Photoresistor_Tea_timed"

The movie shows how different and teas and last coffee, are effecting the photo resistor by showing the highest and lowest readings.

CODE FILES:

Alternative1: Photoresistor_tea_experiment.ino

Alternative 2: Photoresistor_Tea_timed.ino

Step 12: Blow-out-a-flame-Bot

- Intimidating level

- Using the separate calibration code

- Using not only Arduino parts

- It's a small robot that senses the light of a flame witch turns on a fan that blows it out.

FILE CODE: RobotCode

Comments

author
Luis Doporto (author)2016-08-19

Thanks for sharing the idea - Luis Doporto

author
rbusch (author)2015-08-03

the blowout bot is pretty funny :) a lot of good info too!

author
seamster (author)2014-10-10

Cool, thanks for sharing this.