• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Circuit Ideas for You

Get free circuit ideas online.

  • Home
  • Privacy Policy
  • About
Home » RGB LED Color Control Circuit with LDR and Arduino

RGB LED Color Control Circuit with LDR and Arduino

Last updated on 24 September 2025 by Admin-Lavi Leave a Comment

Do anyone like lamps that change color with magic?

This project for RGB LED Color Control Circuit with LDR and Arduino makes its real.

Using RGB LED and three LDR light sensors, we can create a smart lamp that mix colors based on light around it.

Just a simple circuit and with some code, we can get endless color fun.

This circuit is perfect for beginners and hobby makers.

Circuit Coding:

int redPin = 9;
int greenPin = 10;
int bluePin = 11;
int ldrR = A0;
int ldrG = A1;
int ldrB = A2;

void setup() {
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}

void loop() {
int valR = analogRead(ldrR);
int valG = analogRead(ldrG);
int valB = analogRead(ldrB);

int pwmR = map(valR, 0, 1023, 0, 255);
int pwmG = map(valG, 0, 1023, 0, 255);
int pwmB = map(valB, 0, 1023, 0, 255);

analogWrite(redPin, pwmR);
analogWrite(greenPin, pwmG);
analogWrite(bluePin, pwmB);

delay(50);
}

Coding Explanation:

  • Red, green, blue pins set as output.
  • It reads analog from three LDR.
  • Map analog value to PWM range 0 to 255.
  • Write PWM to RGB LED pins.
  • LED glow as per light falling on LDR.
  • Color mix automatically.

Circuit Working:

RGB LED Color Control Circuit Diagram with LDR and Arduino

Parts List:

ComponentQuantity
Resistors
220Ω 1/4 watt3
1k 1/4 watt3
Semiconductors
Arduino UNO1
LDR3
RGB LED (Red, Green and Blue)1

This is simple Arduino color mixing lamp circuit.

It can make room corner look nice

Lamp change color when light change in room.

It work automatic and switch color by light condition.

LDR resistance is low when light fall.

LDR resistance is high when its dark.

Arduino read voltage at analog pins A0, A1 and A2.

Arduino change PWM output at pins 9 ,10 and 11.

PWM control LED brightness.

Red, Green, Blue brightness mix to make different colors.

So color of lamp change with light on LDR.

How to Build:

To build a RGB LED Color Control Circuit with LDR and Arduino follow the below steps for connections:

  • Arduino pin 9 connect to Red pin of RGB LED through resistor R1.
  • Arduino pin 10 connect to Green pin of RGB LED through R2.
  • Arduino pin 11 connect to Blue pin of RGB LED through R3.
  • Common cathode RGB LED ground pin go to Arduino GND.
  • LDR1 connect with resistor R4 and pin A0 of Arduino
  • LDR2 connect with resistor R5 and pin A1 of Arduino
  • LDR3 connect with resistor R6 and pin A2 of Arduino
  • All LDR other side go to 5V.
  • Resistors go to ground.

Conclusion:

This RGB LED Color Control Circuit with LDR and Arduino is very simple and very fun project.

RGB LED change color with light sensor.

It is good to learn Arduino, PWM, LDR and RGB mix.

We can use this circuit for smart lamp or room decoration.

References:

An Arduino-Based Experimental Setup for Teaching Light Color Mixing, Light Intensity Detection, and Ambient Temperature Sensing

Filed Under: Arduino Projects, LDR Circuits, LED and Lamps

About Admin-Lavi

Lavi is a B.Tech electronics engineer with a passion for designing new electronic circuits. Do you have questions regarding the circuit diagrams presented on this blog? Feel free to comment and solve your queries with quick replies

Previous Post: « Arduino Based GPS Digital Clock Circuit
Next Post: Audio Spectrum Analyzer Circuit using IC MSGEQ7 »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar




Categories

  • Alarm Circuits (34)
  • Amplifier Circuits (67)
  • Arduino Projects (58)
  • Audio Circuits (98)
  • Automobile Circuits (19)
  • Battery Charger Circuits (49)
  • Free Energy (13)
  • Heater and Temperature Controllers (10)
  • High Voltage (1)
  • Indicator Circuits (40)
  • Inverter Circuits (14)
  • LDR Circuits (17)
  • LED and Lamps (117)
  • Meters and Testers (28)
  • Motor Controllers (18)
  • Oscillator Circuits (34)
  • Power Supply Circuits (92)
  • Remote Control Circuits (7)
  • Security and Protection (26)
  • Sensors and Detectors (97)
  • Solar Circuits (17)
  • Timer Circuits (30)
  • Transistor Circuits (57)
  • Transmitter Circuit (14)
  • Tutorials (5)
  • Water Level Controller (4)

Recent Posts

  • Audio Spectrum Analyzer Circuit using IC MSGEQ7
  • RGB LED Color Control Circuit with LDR and Arduino
  • Arduino Based GPS Digital Clock Circuit
  • Small UPS Circuit for Router Backup
  • Sound Activated LED Circuit with Arduino

Recent Comments

  1. Admin-Lavi on Constant Voltage, Constant Current Battery Charger Circuit
  2. Bill on Constant Voltage, Constant Current Battery Charger Circuit
  3. Admin-Lavi on Long Range FM Transmitter Circuit (2km)
  4. Sina on Long Range FM Transmitter Circuit (2km)
  5. Admin-Lavi on Long Range FM Transmitter Circuit (2km)

Copyright © 2025 | New Circuit Ideas