Color Changing LED Light

by Nat King in Circuits > Arduino

32 Views, 0 Favorites, 0 Comments

Color Changing LED Light

20250714_100116.jpg
1000002868.jpg
Screenshot 2025-07-21 at 9.36.48 AM.png

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

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

Connect the Arduino to the Breadboard

Screenshot 2025-08-06 at 2.43.33 PM.png

5V → Bread Board positive strip (+)

GND → Bread Board negative strip (-)

Connect the LDR

Screenshot 2025-08-06 at 2.48.11 PM.png
20250807_093254.jpg

Terminal 2→ 5V

Terminal 1 → A0 and one end of the 10kΩ resistor

Other end of the resistor → GND

Connect the RGB LED

Screenshot 2025-08-06 at 2.51.20 PM.png
20250807_092434.jpg

The order of pins will be one of three ways:

  1. RCBG
  2. RCGB
  3. BRCG

The Cathode pin will always be the longest pin on an RGB LED.

  1. Red Pin (R) → 220Ω Resistor → Digital Pin 11
  2. Cathode Pin (C) → GND
  3. Blue Pin (B) → 220Ω Resistor → Digital Pin 10
  4. Green Pin (G) → 220Ω Resistor → Digital Pin 9

Download Arduino IDE (If You Don't Have It)

Screenshot 2025-08-06 at 2.54.18 PM.png
  1. Open Arduino IDE.
  2. Install the program if you don't already have it.
  3. Make a new sketch and name it, try naming it something that describes the project.

Upload the Code

Screenshot 2025-08-07 at 9.41.31 AM.png
Screenshot 2025-08-07 at 9.43.51 AM.png
Screenshot 2025-08-07 at 10.29.30 AM.png
Screenshot 2025-08-07 at 10.36.00 AM.png
  1. Paste the code into your Arduino IDE sketch.
  2. Connect your Arduino Uno via USB Cable.
  3. Upload the code to the Arduino.

Add the Paper Cube (Optional)

1000002868.jpg

This step is not required, but LED lights can be very bright so I'd recommend it:

  1. Cut out the net of a 3d shape of choice
  2. Fold the net into the 3d shape
  3. 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

Screenshot 2025-08-07 at 11.00.53 AM.png

If the circuit isn't working, try:

  1. Double checking that everything is connected to the correct places.
  2. Adjust how dark it needs to be for the light to turn on.
  3. Put a finger over the LDR to see if it's just too bright.