Introduction: Arduino & Holiday Lights
I recently bought a set of LED lights string for the Holidays and they came with a solar panel. One had 3 wires connecting all the LEDs the other only had 2 wires. They use the fact that the LED allow a current to go only in on direction to create a two channel LED string. The "micro controller" that controls it just need to alternate the current in order to control both set of lights on one string.
I then decided to see if I can control them with an Arduino Uno, and then later see if I can add them to my current home automation (I might create another Instructables later).
For this ou will need:
(1x) Arduino Uno on Amazon or you can pick one up at a local Radioshack
(1x or more) Qedertek Fairy Decorative Christmas Solar String (I got the Warm White and Cool White)
(1x) breadboard (this one comes with jumper wires) on Amazon
Step 1: Taking the Solar Panel a Part
The solar panel, has 4 screws on the back, it's fairly easy to take a part.
Once inside you can see the rechargeable battery and the tiny board that control the charge of the battery and all LEDs. You can also see if you have a version with 2 wires or 3 wires. I have both in my picutres
Step 2: Wiring to the Arduino
I don't have pictures of my setup because I didn't habe a breadboard and it was just wires tape together.
The logic is fairly simple..
For the two wires setup is just a set of LEDs alternated in parallel. To control them you just need to connect them to two PWM output of the Arduino. You can technically turn only one set at the time however thanks to the fact that human eye/brain is fairly not perfect, we cannot track lights that blinks really quickly. To turn both on at the same time, you can just make them blink alternately really fast.
For the 3 wires setup, there is one wire for the positive, and 2 wire for the negative, each of the negative is connected to a set of LEDs in parallel. In this setup you can easily let both side on without any trick.
Step 3: Software
This is a simple example to show how everything works. In order to create nicer effect you will need to write more code. You can create a pretty nice set of effect with 2 set of LEDs string.
// give it a name: int redLed = 10; int greenLed = 11; int whiteLed = 5; int yellowLed = 3; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(redLed, OUTPUT); pinMode(greenLed, OUTPUT); pinMode(whiteLed, OUTPUT); pinMode(yellowLed, OUTPUT); digitalWrite(redLed, LOW); digitalWrite(greenLed, LOW); digitalWrite(whiteLed, HIGH); digitalWrite(yellowLed, HIGH); } // the loop routine runs over and over again forever: void loop() { blink(redLed, false); blink(greenLed, false); blink(whiteLed, true); blink(yellowLed, false); } void blink(int led, bool reverse) { int high = HIGH; int low = LOW; if (reverse) { int high = LOW; int low = HIGH; } digitalWrite(led, high); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, low); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
I also made simulator using circuit.io