Zuba98
Published © GPL3+

Reutilization of Christmas Light with broken controller

Don't throw away your working Christmas light, control them with Arduino!

BeginnerProtip300
Reutilization of Christmas Light with broken controller

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Resistor 220 ohm
Resistor 220 ohm
×4
General Purpose Transistor NPN
General Purpose Transistor NPN
×4
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×2

Story

Read more

Schematics

Fritzing diagram

The lights must be connected between the orange wires.

Real circuit

Connection of bjt

Eventually, if the light aren't very bright, you can lower the resistance on the base of bjts.

Current flow 1

Current flow 2

Code

Untitled file

Arduino
int phase1 = 3; //control the left bjts 
int phase2 = 5; //control right bjts
int pot_lum = A1; //Potentiometer for controlling the intensity of light
int pot_delay = A2; //Potentiometer for controlling the frequency of switching
int val;
int delay_light;


void setup() {
  pinMode(phase1, OUTPUT);
  pinMode(phase2, OUTPUT); 
}

//Only 2 of 4 bjt at any instant are on. This allow the current to flow in the lights in 2 different direction, alternating the colors
void loop() {
  val = analogRead(pot_lum);
  delay_light = analogRead(pot_delay);
  delay_light = delay_light*2;
  analogWrite(phase1, val/4); //left bjts on
  digitalWrite(phase2, LOW);  //right bjts off
  delay(delay_light);         //wait                     
  digitalWrite(phase1, LOW);  //left bjts off  
  analogWrite(phase2, val/4); //right bjts on
  delay(delay_light);         //wait              
}

Credits

Zuba98
2 projects • 2 followers

Comments