Week 6 – Photoresistor

Reading a Photo resistor


Introduction
In experiment 2, you got to use a potentiometer, which varies resistance based on the twisting of a knob. In this circuit, you’ll be using a photo resistor, which changes resistance based on how much light the sensor receives. Since the RedBoard and Arduino Uno R3 can’t directly interpret resistance (rather, it reads voltage), we need to use a voltage divider to use our photo resistor. This voltage divider will output a high voltage when it is getting a lot of light and a low voltage when little or no light is present.


Parts Needed
You will need the following parts:

⦁ 1x Breadboard
⦁ 1x RedBoard or Arduino Uno
⦁ 1x LED
⦁ 1x 330Ω Resistor
⦁ 6x Jumper Wires
⦁ 1x Photo resistor
⦁ 1x 10k Resistor

Hardware Hookup
Ready to start hooking everything up? Check out the Fritzing diagram below, to see how everything is connected.
Fritzing Diagram for RedBoard

What You Should See
You should see the LED grow brighter or dimmer in accordance with how much light your photo resistor is reading. If it isn’t working, make sure you have assembled the circuit correctly and verified and uploaded the code to your board or see the troubleshooting section.
Program
To turn on the LED connected to pin 9 when the LDR reads a value less than 600 and turn off the LED if the value of LDR falls below 600.

Challenges
⦁ Write a program to do the following
⦁ Turn ON the green light when the LDR value is less than<400
⦁ Turn ON the Yellow light when the LDR value is greater than 400 but less than 650
⦁ Turn ON the Blue light when the LDR value is greater than 650 but less than 900
⦁ Turn ON the Red light when the LDR value is greater than 900