# Arduino and hacked LED Xmas lights

#### denno

Joined Jul 1, 2008
30
Hi all, I need some help/guidance/confirmation that the idea I've got is about right.. I have 5 sets of christmas LED lights, which have their own wall wart power supply, and their own 'function box' for the flashing etc. I don't like that they never do the same flashing effect, so I want to replace every one of the function boxes with a single Arduino.

I've created a block diagram to illustrate what I would like to do, and would like to know if this is a decent plan of attack.
The reason for using a tip31 transistor is because.. well I have them already.. But if something else will serve better there, then I can purchase them instead.
You'll also notice that there are 2 transistors per LED string, this is because each of them have 2 individual strings twisted together, so this way I'll still be able to access both string separately.

Also, the hardware that I was planning on purchasing off eBay are as follows:
PSU:
http://www.ebay.com.au/itm/24V-5A-1...t_Equipment&hash=item1c202eb5c6#ht_5610wt_905
24V to 12V step down:
http://www.ebay.com.au/itm/DC-DC-HR...ltDomain_0&hash=item27bddee1b5#ht_5313wt_1163

Thanks heaps
Luke

#### Attachments

• 149.1 KB Views: 147

#### thatoneguy

Joined Feb 19, 2009
6,359
From the TIP31 Datasheet

The TIP31 transistor doesn't go into saturation until there is 375mA of Base-Emitter current.

For bipolar transistors, this means you would need an extra stage to boost the 25mA uC output to 375mA to fully switch the transistors on.

A single transistor that fits your needs would be a Logic Level MOSFET, such as the IRLZ34

Logic input of 2.5V for <100mΩ on, 2A continual current is plenty. Shop around for best price or one with similar specifications. I use the IRLZ44 a lot, but it is slower to charge/turn on, in order to handle 10x the power. It also costs a bit more.

You can direct drive those MOSFETs from your uC without problems to switch DC, your LEDs won't like AC, so I'm unsure why AC is mentioned. You will want to limit the current with a resistor to keep from burning up the LEDs as well (unless driving them with very fast pulses and duty cycle < 50%, but that gets more complicated)

#### denno

Joined Jul 1, 2008
30

As for the question about AC, the function boards for each of the LED strings had rectifiers on them, so the LED's were getting DC.

Looking at the original function controller board, they use PCR406 transistors to power the LED strings, but they use 2 for each string, so 4 in total. I'm thinking it's to allow more current then just the 1 is able to allow.. I've attached images of the original board so you can see what it looked like.

As for the resistors, I was assuming there were already resistors placed in the LED strings?

#### Attachments

• 294.1 KB Views: 63
• 289.6 KB Views: 44

#### thatoneguy

Joined Feb 19, 2009
6,359
The transistors are connected in parallel pairs of two, so 2 transistors would drive one set, the other pair would drive the other set.

You could do something similar with pairs of 2N2222 transistors, though that wouldn't be "Best Practices", there should be a resistor on the base of each transistor to keep the base-emitter current at saturation and not higher.

Those LED strings typically aren't peak engineering, they are essentially made to run for a month and be thrown away. This is in contrast to the old style with replaceable bulbs that were carefully taken down, checked and put back up every year for decades.

In other words, don't look at how it was built as "the best way to do it", even though it works, for a while.

#### denno

Joined Jul 1, 2008
30
Sorry for the late response, I had exams so thought I had better focus on them before any side projects .

I've been looking at the LED strings, and there definitely aren't any resistors in there like I thought, so you're right.. What would be the best thing to do then, as I don't really want to cut the LED strings and add resistors to each individual sub-string..
I have found that the whole light string is made up of 240 LED's in total, in 10 LED sub-strings, so 24 sub strings in total (remember the power source is 24V DC).

As for the transistor, is there possibly anything else that is a little more common and cheaper? For 10 on eBay, it's $18, which I guess isn't too bad, but if I can cut costs, it would be nice.. You mentioned that using two 2N2222 transistors wouldn't be best practice, but would it work? And for a while? Oh and I should add that it appears the transistors switch on the negative side, not the positive side.. if that makes a difference.. Thanks Denno #### thatoneguy Joined Feb 19, 2009 6,359 Switching on the negative side is fine, perfect job for NPN transistors, which are a tad more efficient than PNP transistors. First, rectify the 24VAC to DC, then get a regulated 5V source to run with the the uC. You could run each string at 20mA easily with drive from the uC into the base of the transistor (resistor between uC and base, 220Ω to turn transistor fully on). Collector of transistor could go to the rectified 24VAC, probably around 30VDC. See Bill Mardsen's Blog for current sinks instead of using current limiting resistors. The current sink circuit would be either the source for the anode of the LED string, or on the ground side of the switching transistor. This is so the LEDs are a constant brightness, no matter how many you have lit up. --ETA: Something isn't adding up. 24VAC, 24 Sub strings of 24 LEDs each? That's less than 1V/LED. Need coffee. Thread Starter #### denno Joined Jul 1, 2008 30 Ok so I've actually already bought a power supply, as linked to in an earlier post, it's a 24V DC power supply of 5A.. And I also bought a 24V to 12V module to power the uC at 12V, which I think is ok? Can you link me to Bill Mardsen's Blog? I did a Google search but couldn't find it.. Now for your last part.. I could have counted wrong.. it's hard to keep track of each of those twisting wires as I'm trying to follow it down the track.. but I think I'm just going to assume that the LED string in total runs off 24V and it's maximum current draw is 750mA.. The reason for choosing those values is because that's the maximum outputs of the original power supply (wall-wart, transformer, whatever you call it in the US ) for each set of lights.. Oh and I did manage to strip the covering of 1 LED and measure the voltage, and it seemed to go up to ~2.3V, but it was hard to get it to stay on constantly to get a steady reading due to the flashing functions.. Thank you for your continued help #### thatoneguy Joined Feb 19, 2009 6,359 Most uCs need an extremely stable power supply of 5V max (some are 3.3V -5V, some 3.3V only) Verify what you need, never assume. However, they draw little current, 10 mA max + output draw, which is mostly transistors. A 7805 Regulator and a couple capacitors will provide that 5V for you from the 12V supply. Bill's Blog is at: http://forum.allaboutcircuits.com/blog.php?b=378 If you click on the blue number under my "Blogs" on the right side, I have links to his saved there so it's easy to find. The work he has put into LED and/or 555 timer related projects to share is simply astounding, and would probably be a$20+ book if it were sold as a paperback.

Still need to decide on output/drive transistors. The TIP31 is built to be a linear amplifier rather than a switch, so the max load voltage and current of each driven string needs to be a known quantity.