Color Changing LED Light



This Arduino project uses a Light Dependent Resistor (LDR) to measure light levels. When the light level drops below a set number (700 for this project), an RGB LED begins flashing through a sequence of colors. This project is a good way to learn how to code and LDR, calling on functions, and coding LEDs. Skills like these will be especially important to have if you are thinking of a career in computer science or coding.
Supplies

- 1 x Arduino Uno R3 - runs the code for this project.
- 1 x RGB LED - flashes the colors that are set in the code.
- 1 x LDR (Light Dependent Resistor) - detects the light level, determining if the LED will be on or off.
- 1 x Bread Board
- 9 x Jumper Wires - Go for Male to Male wires
- Resistors:
- 3 x 220Ω resistors - for each of the RGB LED pins.
- 1 x 10kΩ resistor - for the LDR.
- 1 x Paper Cube Cut Out (Optional)
Connect the Arduino to the Breadboard

5V → Bread Board positive strip (+)
GND → Bread Board negative strip (-)
Connect the LDR


Terminal 2→ 5V
Terminal 1 → A0 and one end of the 10kΩ resistor
Other end of the resistor → GND
Connect the RGB LED


The order of pins will be one of three ways:
- RCBG
- RCGB
- BRCG
The Cathode pin will always be the longest pin on an RGB LED.
- Red Pin (R) → 220Ω Resistor → Digital Pin 11
- Cathode Pin (C) → GND
- Blue Pin (B) → 220Ω Resistor → Digital Pin 10
- Green Pin (G) → 220Ω Resistor → Digital Pin 9
Download Arduino IDE (If You Don't Have It)

- Open Arduino IDE.
- Install the program if you don't already have it.
- Make a new sketch and name it, try naming it something that describes the project.
Upload the Code




- Paste the code into your Arduino IDE sketch.
- Connect your Arduino Uno via USB Cable.
- Upload the code to the Arduino.
Downloads
Add the Paper Cube (Optional)

This step is not required, but LED lights can be very bright so I'd recommend it:
- Cut out the net of a 3d shape of choice
- Fold the net into the 3d shape
- Test with trying to put the 3d shape on top of the LED to see where to cut out space for the jumper wires.
Troubleshooting

If the circuit isn't working, try:
- Double checking that everything is connected to the correct places.
- Adjust how dark it needs to be for the light to turn on.
- Put a finger over the LDR to see if it's just too bright.