Arduino Color Mixing Lamp using RGB LED and LDR
What if we can generate different colors using a single RGB led and make our room’s corner more attractive? So, here is a simple Arduino based color mixing lamp which can change color when there is change in light in the room. So this lamp will automatically will changes its color according to the light conditions in the room.
Every color is the combination of Red, Green and Blue color. So we can generate any color by using red, green and blue colors .So, here we will vary PWM i.e. intensity of light on LDRs. That will further changes the intensity of red, green and blue color in RGB LED, and different colors will be produced.
Below table shows the color combinations with respective change in duty cycles.
- 1 x Arduino UNO
- 1 x Breadboard
- 3 x 220-ohm resistors
- 3 x 1-kilohm resistors
- Jumper wires
- 3 x LDRs
- 3 x colored strips (red, green, blue)
- 1 x RGB LED
We will use photoresistor (or light-dependent resistor, LDR, or photo-conductive cell) here in this circuit. LDRs are made from semiconductor materials to enable them to have their light-sensitive properties. These LDRs or PHOTO RESISTORS works on the principle of “Photo Conductivity”. Now what this principle says is, whenever light falls on the surface of the LDR (in this case) the conductance of the element increases or in other words, the resistance of the LDR falls when the light falls on the surface of the LDR. This property of the decrease in resistance for the LDR is achieved because it is a property of semiconductor material used on the surface.
Here three LDR sensors are used to control the brightness of individual Red, Green and Blue LED inside RGB Led. Learn more about controlling LDR with Arduino here.
There are two types of RGB LEDs, one is common cathode type (common negative) and other is common anode type (common positive) type. In CC (Common Cathode or Common Negative), there will be three positive terminals each terminal representing a color and one negative terminal representing all three colors.
In our circuit we are going to use CA (Common Anode or Common Positive) type. In Common Anode type, if we want RED LED to be ON in, we need to ground the RED LED pin and power the common positive. The same goes for all the LEDs. Learn here to interface RGB LED with Arduino.