Mood Lamp basically is a RGB led lamp made with 10 RGB led connected in parallel. This lamp is controlled by microcontroller which changes its colour through PWM pins.
                                    
| RGB led | 
PARTS USED
- RGB LEDs
- PCB
- Power supply (9v)
- Arduino microcontroller
- Transistor TIP122
- Solder iron
Schematic
|  | 
| RGB led lamp Circuit | 
Code
int redPin = 6;
int greenPin = 15;
int bluePin = 3;
void setup()
{
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);  
}
void loop()
{
  setColor(255, 0, 0);  // red
  delay(1000);
  setColor(0, 255, 0);  // green
  delay(1000);
  setColor(0, 0, 255);  // blue
  delay(1000);
  setColor(255, 255, 0);  // yellow
  delay(1000);  
  setColor(80, 0, 80);  // purple
  delay(1000);
  setColor(0, 255, 255);  // aqua
  delay(1000);
}
void setColor(int red, int green, int blue)
{
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);  
}
Change the code as per your project.
 
 
No comments:
Post a Comment