• 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 June 2026 by Admin-Lavi Leave a Comment

Do anyone like lamps that change color with magic? then 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; also this circuit is perfect for beginners and hobby makers.

Arduino Code:

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:

ComponentsQuantity
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, which can make room corner look nice; lamp change color when light change in room, and also it work automatic and switch color by light condition.

LDR resistance is low when light fall and LDR resistance is high when its dark.

Then Arduino read voltage at analog pins A0, A1 and A2 and Arduino change PWM output at pins 9 ,10 and 11 and after that 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:

  • First, Arduino pin 9 connect to Red pin of RGB LED through resistor R1.
  • Next, Arduino pin 10 connect to Green pin of RGB LED through R2.
  • After that, Arduino pin 11 connect to Blue pin of RGB LED through R3.
  • Then, common cathode RGB LED ground pin go to Arduino GND.
  • Now LDR1 connect with resistor R4 and pin A0 of Arduino, LDR2 connect with resistor R5 and pin A1 of Arduino and LDR3 connect with resistor R6 and pin A2 of Arduino
  • Also, all LDR other side go to 5V and resistors go to ground.

Conclusion:

To conclude, this RGB LED Color Control Circuit with LDR and Arduino is very simple and very fun project, as RGB LED change color with light sensor.

Furthermore, it is good to learn Arduino, PWM, LDR and RGB mix and we can also use this circuit for smart lamp or room decoration.

Filed Under: Arduino Projects, Automation Circuits, IoT projects, LDR Circuits, LED and Lamps, Sensors and Detectors

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

  • 555 Timer Projects (129)
  • Alarm Circuits (80)
  • Amplifier Circuits (92)
  • Arduino Projects (103)
  • Audio Circuits (189)
  • Automation Circuits (139)
  • Automobile Circuits (39)
  • Battery Charger Circuits (85)
  • DIY Projects (381)
  • Free Energy (12)
  • Heater and Temperature Controllers (32)
  • High Voltage (23)
  • Hobby Circuits (220)
  • Indicator Circuits (63)
  • Inverter Circuits (17)
  • IoT projects (11)
  • LDR Circuits (46)
  • LED and Lamps (199)
  • Meters and Testers (43)
  • Mini Projects (349)
  • Motor Controllers (25)
  • Oscillator Circuits (64)
  • Power Supply Circuits (234)
  • Radio Frequency (8)
  • Remote Control Circuits (12)
  • Renewable energy (19)
  • Security and Protection (120)
  • Sensors and Detectors (233)
  • Solar Circuits (31)
  • Timer Circuits (62)
  • Transistor Circuits (175)
  • Transmitter Circuit (19)
  • Tutorials (29)
  • Voltage Regulator (40)
  • Water Level Controller (10)

Recent Posts

  • Low Current Controlled Battery Charger Circuit using LM723 IC
  • 741 Op-Amp Treble Booster Circuit
  • Simple Diode and Transistor Based Audio Limiter Circuit
  • Simple 500mW Speaker Driver Circuit
  • Easy DIY LM386 Audio Amplifier Circuit

Recent Comments

  1. Admin-Lavi on High Voltage Fence Charger Circuit
  2. egidio grzinic on High Voltage Fence Charger Circuit
  3. Logic OR Gate Circuit using Transistors - Circuit Ideas for You on Automatic Street Light Circuit using LDR
  4. Tony Gallegos on NTC Thermistor Based Temperature to Voltage Converter Circuit
  5. colin on Simple Single Transistor Audio Amplifier Circuit

Copyright © 2026 | New Circuit Ideas