LED String Blink Killer
This is a somewhat unusual project. A colleague of mine had a LED string, the one that you hang outdoor during Christmas, which shows all kind of patterns when you switch it on. The LED string was connected to a timer that switches it on and off. With a switch on the main plug of this LED string you can change the pattern. The problem was that the partner of my colleague wanted the LEDs to be continuously on and not blink each time you switch it on. If you press the switch 7 times after power on, the LEDs will be on continuously but you need to go outside each time to select that after power up.
So this project is about how to get this LED string in a continuously on mode when you switch it on.
The mains plug of the LED string contains a power supply which generated an AC voltage of around 33 Volt. An example of such a plug is shown in the picture. The LEDs in the string are connected anti-parallel in two strings. By applying an alternating voltage both strings will light up. This alternating voltage had a frequency of 200 Hz.
The power supply in the plug is split in two parts, one part is supplying a DC Voltage of around 33 Volt and the other part generates the alternating voltage using a Microcontroller. There was no way I could influence the behavior of this controller so I needed to think of another solution.
My first solution was more or less build the same electronics with a Microcontroller and drive the LED string. Although this worked, the LED string was not very bright because I did not have the right components for the driver circuit.
The second solution was simple and elegant. Since there is a switch you can press, I decided to use a Microcontroller to press the switch and the check if the alternating voltage is ‘stable’ (more on ‘stable’ later). If not, the Microcontroller presses the switch again and check again the alternating voltage. This is repeated until the LEDs appear to be continuously on (which is not the case but you cannot see that they are flickering).
In order to speed up this process, the PIC Microcontroller will press the switch 7 times at power up so that the LED string should already be in the continuous on mode.
Supplies
The supplies are only for the second solution. You need to have a PIC Microcontroller type 12F617 for this project or any other compatible PIC Microcontroller since I am using a timer which is standard in all PICs.
The Hardware Design
In the schematic diagrams you see both solution. In the first solution you see how the LEDs in the string are connected. The number of LEDs is not exact but only drawn to show how they are connected. The PIC Microcontroller generates an alternating signal of around 250 Hz to drive the transistors.
In the attached screenshots of the oscilloscope for this solution you see the following:
- The alternating signal. When one end of the LED string is high, the other end is low and vice versa. In this way it seems that all LEDs are continuously on but in fact they are switching on and off in a rate that is invisible for the Human eye.
- In order to prevent spikes when changing the signal – due to the long wires in the string – I added a small period of around 250 us that both signals are low, so drawing both ends to ground
- The third screenshot shows the signal measured at both ends of the LED string.
The second solution only requires one PIC Microcontroller without any additional hardware. The physical switch connects one of the inputs of the existing Microcontroller in the power supply to ground. The PIC Microcontroller does the same thing by switching its pin temporary to output and then making the pin low. Next to that the PIC Microcontroller is connected to the supply voltage of the Microcontroller in the power supply. It uses one of the driving signals of the Microcontroller in the power supply, as shown in the previous screenshots, to determine if the LEDs are continuously on.
Bulding the Electronics
There was some open space on the printed circuit board of the power supply where I could glue the PIC Microcontroller upside down. In the first picture you where the signals can be found on the power supply. On the second picture you see the PIC Microcontroller glued to the printed circuit board.
The Software
Attached you find the source files and hex files of both solutions. The PIC is programmed with the JAL programming language. Since the second option was implemented I will explain what the software of the PIC Microcontroller does.
- It starts with pressing the switch 7 times. This should bring the LED string in the continuous on-mode.
- A measurement of 3 seconds is started to measure the width of the high pulse and the width of the low pulse. Since the frequency is around 200 Hz, the width of both pulses should be around 2.5 ms.
- If the measure pulses are not in range for at least 2 seconds during the 3 second measurement, the switch is pressed once and the measurement restarts.
- If the measured pulses are in range for at least 2 seconds during the 3 second measurement, the PIC Microcontroller goes to sleep since nothing needs to be done anymore. In all the cases I tested this, this was achieved immediately after power up and having pressed the switch 7 times.
Demonstration Video
The video shows the device in action after power up before modification and powering it up after modification. As you can see, the LEDs are continuously on after the switch is pressed 7 times.
Have fun building your own project and looking forward to your reactions.