Lesson 9 Photoresistor
A photoresistor or photocell is a light-controlled variable resistor. The resistance of a photoresistor decreases with increasing incident light intensity; in other words, it exhibits photoconductivity. A photoresistor can be applied in light-sensitive detector circuits, and light- and darkness-activated switching circuits.
- 1 * SunFounder Uno board
- 1 * USB data cable
- 1 * Photoresistor
- 1 * Resistor (10KΩ)
- 8 * LED
- 8 * Resistor (220Ω)
- Jumper wires
-1 * Breadboard
The resistance of a photoresistor changes with incident light intensity. If the light intensity gets higher, the resistance decreases; if it gets lower, the resistance increases.
In this experiment, we will use eight LEDs to show the light intensity. The higher the light intensity is, the more LEDs will light up. When the light intensity is high enough, all the LEDs will be on. When there is no light, all the LEDs will go out.
Step 1: Build the circuit
The schematic diagram
Step 3: Compile the code
Step 4: Upload the sketch to the SunFounder Uno board
Now, shine some light on the photoresistor, and you will see several LEDs light up. Shine more light and you will see more LEDs light up. When you place it in a dark environment, all the LEDs will go out.
In addition to the above experiment, you can replace the photoresistor with a microphone to use LEDs to indicate sound intensity. The higher the sound intensity is, the more LEDs are lit. You can realize this effect by yourself. Try now!
const int NbrLEDs = 8;//8 leds
Copyright © 2012 - 2016 SunFounder. All Rights Reserved.