🧰 Project 2D: LED Fade with Photoresistor | myBetabox

🧰 Project 2D: LED Fade with Photoresistor

This Project is an Example of…


AUTOMATIC NIGHT LIGHTS
Say goodbye to midnight scaries! Automated night lights use photoresistors, which detect the amount of light, to activate once it becomes dark.

This seems much like the last project, and is similar in some ways. But this project uses a more complicated switching mechanism called a light-dependent resistor (LDR), also called a photoresistor.

The LDR changes its resistance based on how much light is hitting it at any given moment. We can use the Arduino to monitor how the resistance varies and map that resistance to a scale.

By setting "trip points" in the Arduino at certain points, we can tell the Arduino to turn something on or off based on how much light is hitting the LDR at any given moment.

Required Components

Add Sketch to Editor


Download the Sketch

Fritzing Diagram

Now that you've wired up a few projects, try to build this one just by looking at the diagram above.

    Building Tips

    • Wire this project according to the Fritzing diagram for Project 2D.
    • This is a more complicated build than the previous two projects; take your time and make sure all the breadboard connections are in the right places.
    • Route the jumper wires away from the LDR so it has a clear view of the light above it.
    • IMPORTANT: Make sure to plug the long leg of the LED next to the resistor, and the short leg of the LED into the ground power column that the black jumper wire is connected to.
    • Make sure to use Digital Pin 10 for the color jumper wire to the LED.
    • Double-check your connections before powering up.
    • UPLOAD AND SAVE the correct/current sketch to your Arduino from the Web Editor.

    Expand Your Learning

    • Think about how you could use a sensor that does something when the area around it gets either brighter or darker.
    • Experiment with holding your hand or a piece of paper over the LDR to see how sensitive it is.
    • Try changing how much ambient light is in the room around the LDR. How does this change how it reacts to being covered? Does it behave differently at night than it does during the day?

    Troubleshooting