Charlieplexing at 24 volts/2 amp

Hi,

The utility store has started selling christmas decorations already, and I've got a hold of LED string lights. However, I've noticed they flicker A LOT, which made me want to hack them.

So, I've cut the controller, and I now have 5 wires to the LED's, and 2 from the 24volt, AC, unregulated wall-wart.

Using a diode-bridge and a voltage-regulator chip I salvaged from another device, I have a steady 12V DC to power my Arduino.

The LED strings are organized in 8 groups of 16 LED's, for a total of 128 LED's, of various colours (red, green, blue and orange). They are organized in a common cathode configuration for the first 4 groups, then in a common anode configuration for the other 4 groups.

That means that if I connect the common wire to +24V, I can light up the 4 first segments independently by hooking their respective wire to GND, and by connecting GND to the common wire, I can light up the 4 other segments by connecting their wire to +24V.

That's like charlieplexing, with only a fraction of the combinations available used. (From what I understand, with 5 wires you could drive 20 independent LED's, but here they only used 8).

How do I perform "charlieplexing" at 24volts? Of course the digital outputs of my Arduino wont' deliver enough current and voltage, so I need some kind of driver that can sink and source current to 5 different points.

Any idea of where I should look?

Thanks a lot!

The point about charlieplexing is that it uses the tri-state function to disable the output. While this could be done you would need to design a FET circuit for each output pin that would replicate both high and low drive and tri-state. No doubt this could be done but I would have thought it is much easier to go with a more conventional form of control.

Thanks for the quick reply, Mike! :)

I'd probably design the way LED segments are hooked up differently if I had a chance to, but I'd like to keep the 12 meters of interleaved wires and LED's as-is, since they are going to be a pain to soldier otherwise.

I have tried coupling a PNP transistor and a NPN transistor together, by connecting their Collector together, in 5 PNP/NPN "couples", but if by mistake both bases are activated at the same time, they will short and blow up, so I need a better idea than that. The idea was that PNP transistors were made for sourcing, and NPN for sinking, so I could use each "function" in turns...

I also thought of using DC motor drivers, for they ability to supply power bi-directionally, but that won't work in "common-anode" or "common-cathode" configurations, I think...

I will look in FET's, but that looks like very generic...

The idea was that PNP transistors were made for sourcing, and NPN for sinking, so I could use each "function" in turns...

You can but for being driven off a single pin the transistors are either sourcing or sinking not doing nether. That is the essence of charlieplexing. Using a series FET would allow this tri-state to work. That in itself is not difficult but getting the right voltages to it is and you will need another pin to define the tri-state condition so I can't see where you will win with charlieplexing because you have just thrown away any advantage there is in using the technique.

Alright, so, if I use two pins, one for each transistor of the PNP/NPN duet, then I might have a "both blocking" state, is that right?

Of course, I do understand it's a completely inadequate application of "charlieplexing", the thing is that I just would like that project to work... And "charlieplexing" is the closest and shortest description of my problem, but for sure doesn't apply in any good way, because my pin count would actually be BIGGER than the number of segments to drive... That would be 10 pins to manage 8 segments.

But well, I don't mind too much if it's an overkill, I just would like it to work reliably enough to leave it on unattended without causing fire :)

So, you think I should/could persevere in the NPN/PNP idea?

I'll also do my homework and read about FET's (and MOS FETs, cause I see that word a lot and I don't know what it is used for yet).

Thanks a lot

cause I see that word a lot and I don't know what it is used for yet

A FET is just like a transistor only it works with voltage not current. When there is sufficient voltage on the gate the FET is turned on and has a very low resistance between drain and source. That makes it burn very little power compared to a transistor. So a FET is in effect a switch resistance between very high and very low resistance. You can get n channel FETs these are like NPN transistors and P channel FETs these are like PNP transistors. They are used for switching high currents on and off.

Alright, so, if I use two pins, one for each transistor of the PNP/NPN duet, then I might have a "both blocking" state, is that right?

It is but at 24 volts to will have to add a NPN transistor to drive the PNP one to get 24V on it's base in order to turn it off.

Why not look into something like this? http://datasheets.maxim-ic.com/en/ds/MAX6922-MAX6934.pdf Can drive both high & low, will handle the voltage range you have, lots of outputs.

Thanks Mike, I hadn't realized I needed a third transistor, probably that's why my breadboard didn't work as expected. I will test soon with the third transistor.

Thanks for the explainations about the FET's too, I'll order parts and start playing with them.

And thanks Crossroads, it looks interesting! I'm not sure they can source enough current, since the strings are rated at 250mA per segment, it's written on the control box I removed... but it definitely looks promising. I will breadboard that too.

Thanks a lot for the pointers!

Yeah, sorry about that, I missed the 250mA part. Trying to visualize what you have here.

The groups of 16, is that 16 LEDs in series, 2 columns of 8 each, something else?

The 5 wires; the 8 groups are arranged in pairs? Pair 1 with anodes as Wire1, cathodes to a common wire, Pair 2 the same with anode as Wire2 cathodes to the common wire, Pair 3 with anodes to the common wire and Cathodes as Wire3, and Pair 4 with anodes to the common wire with Cathodes as Wire4?

You need 24V from a Pairs Anode to Cathode to make them turn on?

The 250mA, that is for all LEDs on at once? Or just 1 pair at at time?

Hi and thanks! Just to clarify:

There are 8 segments of 16 leds each. The 16 leds inside a segment light up the same way, so they must be in series or in parallel. The cable is molded, so I can't tell exactly how many LEDS are in series. There are 16 that light up together, anyway, and they won't light up at 12V. I don't have a regulated power supply that goes beyond 12V, so I couldn't see what voltage would light them up. 24 volts out of the wall wart work perfectly.

If you feed them +24v to the common wire and connect GND to the 4 different wires, you can light up the first four segments.

Now if you feed +24v to one of the four wires and connect the common wire to GND, you can light up one of the last four segments.

So, to sum up, naming our wires Common, A B C D:

With VCC on Common wire: GND to Wire A: Segment 1 lights up GND to Wire B: Segment 2 lights up GND to Wire C: Segment 3 lights up GND to Wire D: Segment 4 lights up

With GND on common wire: VCC to Wire A: Segment 5 lights up VCC to Wire B: Segment 6 lights up VCC to Wire C: Segment 7 lights up VCC to wire D: Segment 8 lights up

On the builtin controller that I removed, there is something written that says "Input: 24V AC 2A, Output: 4x 24V 0,25A"

As I said, the main reason that pushed me to hack these, was because of the constant flickering, at a quite low rate. As the current fed to the controller is AC, which is 50hz in Belgium, I guess they were turning off 25 times a second. I'm pretty sure we can make it look way nicer by using tha ATMEGA328 to refresh them faster...

I hope this makes sense! Thanks for all the help so far!

I see now. And you are only trying to give the appearance of having them all turned on at the same intensity? No effects or anything, correct?

So +24 on A-B-D-C with Common Low, then switch & +24 on Common with A-B-C-D low?
(max current draw, turns on 1-2-3-4 then 5-6-7-8)
Or do you want more switching, turning on 1 then 2 then 3 then 4 then 5 then 6 then 7 then 8, for less current draw?

Doesn’t sound like you could have +24 on A with B at ground if +12V won’t turn on a string, which would yield more of a Charlieplex situation in my mind.

I was going to flicker all 8 segments all the time, lighting up only the ones contained in my "frame buffer", like in real charlieplexing.

I managed to do it without any issue, with just one LED on each "combination" of 4 wires. The code needs a bit of rewrite to cope with the driver or output circuit I would hook up to it, but the main idea is the following:

  • I have a global variable which is an array of booleans, where I store the state of each segment
  • I have a flickerDelay(unsigned long timeout) function that will light up each segment for a few microseconds, looping until the timeout is reached
  • Then in my main loop, I just animate the bits with a chase effect for example, and between each "frame" of the animation I call flickerDelay, which will delay the execution of the main loop while lighting up only the right segments, by flickering them as fast as possible.
  • There is also a momentary switch that triggers an interruption. The interrupt handling routine sets a boolean "changeRequested" to true, which will basically change the way the lights blink, going through another loop...

I simplified the explaination not to go through too many details, but basically, I would light up all segments in turns really fast, but only actually turn on the ones that are lit in my current "animation" frame.

The code works for 12 leds simply charlieplexed, with about 8 different blinking modes, just like a regular christmas decoration. I can post it tonight when I'm back from work, if it is of any interest for anyone.

Yeah, I'd like to see it, with a schematic if you have one. Be interesting to see how going from single LEDs to columns of LEDs at higher voltage will work out.

I am trying do something similar, using Charlieplexing with a MAXIM-IC chip (MAX6951? 6921? I need to look it up) to drive 8 seven-segment displays and decimal points. Only the displays are three discrete LEDs wired in parallel for each leg (so can drive with 3.3 or 5V) and 2 in parallel for the decimal points. Performance at 5V was very flickery & uneven until I managed to get the right combination of R & C for current limit & switching speed. I think the chip may have issues with heat (not much I can with it being a TSOP part on a DIP adapter for wirewrapping) or maybe its the uneven current draw. It ran just okay for a few hours (not very even illumination of digits) and the next morning only partially turned on some segments. Need to check that all segments still work manually, then will try 3.3V operation next, and then I'm falling back now to a more straightforward multiplex scheme with a different chip (MAX7921??), am waiting for samples to arrive. Need to do some re-wiring for that also. (bigger 24 pin chip vs 16 pin chip, will fit on my wirewrap board - just!) Failing that, may go to discrete segment drivers using the VFD chip I mentioned and control own mulitplexing similar to what you are trying.

Here is the code of my successful simple charlieplexing test: http://www.uplifting.be/stuff/20101104_charlieplexing/charlieplexing4.txt

I don't have schematics at this moment and I can't find the time right now to draw some. However, here is how it is hooked up:

Digital pin 2 has a push button hooked up to it, that when pressed will apply +5v to the input. When not pressed, there should be a pull-down resistor to keep it around 0.

Digital pins 5 to 8 have one wire each, leading to the charlieplexed net of LED's.

I organized them as follows (with wires numbered one to four):

LED 1 : Wire 1 anode, Wire 2 cathode LED 2 : Wire 1 anode, Wire 3 cathode LED 3 : Wire 1 anode, Wire 4 cathode LED 4: Wire 2 anode, Wire 1 cathode LED 5: Wire 2 anode, Wire 3 cathode LED 6 : Wire 2 anode, Wire 4 cathode LED 7 : Wire 3 anode, Wire 1 cathode (and so on until 12)

I had completed this before I realized my LED string had actually 5 wires, in the configuration I explained earlier.

Anyway, the common thing with charlieplexing is that it relies on the property of LED's to light up in only one direction, so it's rather a bidirectional multiplex, if you want.

About your 7-segments, I had no problem driving 7 segments (8 segments if you count the dot) with a bunch of 74hc595's shift registers. Works fine with one LED per segment, now if they are 3 in parallel, I think it could work as well, the current draw for three "common" LED's wouldn't be too much for the 74HC595, would it? I used one resistor for each segment.

Of course, the signal is serialized out of the arduino, so it takes only three pins, which is great, but there is a HUGE mass of wires between the 4x 74HC595 and the 4 7 segments displays... Of course, you can probably have a nice multilayer PCB made to make it neat.

Why would you have to drive the segments with polarities inversed?

Still, about my problem, I think I'll investigate more in building my own drivers, with three or four transistors hooked together for each wire, one fat PNP for sourcing, one fat NPN for sinking, and the third one to drive the PNP one, as Mike suggested. That would be two pins per wire, one that activates the sourcing, one that activates the sinking, and if neither are activated, it should just prevent current from flowing through the driver, turning off the segment.

I'll also try to use FET's instead of transistors since they seem more efficient, at least for the sourcing/sinking duo.

The ATMega's do not have internal pulldowns, they have internal pullups, I would change that to have the switch ground the pin & drop 1 extra resister.

If you look at this maxim article you can get a better feel what I was mentioning about driving both directions.

I was trying to get away from ending up with 1 IC per digit as drivers, hence my experiment with charlieplexing, reverting to regular multplexing if I can't get better performance.

The nice thing about the maxim chips is that they haev the built in current limiting, set under software control in 1/16ths up to the limit set by 1 external resistor.

Gotta run, am in between fencing classes, more later.

Robert

So, I'm envisioning something like this (promini wiring selected for the convenience of the drawing only). I am not sure if the FETs will work like this, could use some insight from the more analog minded folks.

But basically, QChigh turns on, and you cycle thru Q1low-Q2low-Q3low-Q4low. Than turn off QChigh, turn on QClow, and cycle thru Q1high-Q2high-Q3high-Q4high. and repeat.

Gotta be careful that both QXhigh &QXlow never on at same time, that will smoke 'em. The IRF3707 has only 0.0125 on resistance, haven't found its mate yet.

Wonder if your strings have built in current limit resistors already. Can you measure current with a multimeter with a 24V and just 1 group on?

Yeah; that looks about right. Essentially you need a "half H bridge" for each wire, which looks about like what you've drawn. There are probably details that you've overlooked. (a 0 to 5V output won't turn off a P-channel MOSFET conencted to +24V, for instance. You'll need some sort of mosfet driver.) There is lots of material on the web about H-bridges, and you may want to look into some of the existing chips and shields (for example, I'd think that an Adafruit motor driver shield would be just about right for driving 4 of your 5 wires...)

I'm surprised that this uses a 2A supply. Each string of series LEDs should uses about 20mA, for a total of 80mA or so for each "set" of LEDs, or no more than .5A for all the LEDs in a particular "direction." You might want to do some measurements to see what kind of current and voltage are actually required to get a particular brightness out of your LEDs. The difference in design/construction difficulty between a 2A H-bridge and a 100mA H-bridge (for one string at a time) is pretty significant. (this is one of the occasions where a lab-style CCCV power supply is very handy.)

A series/parallel string of LEDs as you have pictured OUGHT to have resistors of some kind within each series string, or the current wouldn't balance among the parallel pieces. But this is cheap consumer electronics we're talking about, so I wouldn't count on it :-(

Yes my advice in reply #5 also applies to FETs

It is but at 24 volts to will have to add a NPN transistor to drive the PNP one to get 24V on it's base in order to turn it off.

So you need a NPN transistor or an other N channel FET to turn off the P channel FET. Try and think of P channel FETS and PNP transistors as "upside down" components where you turn it off by making the base the same voltage as the emitter only now the emitter is connected to the +rail instead of the -rail. As westfw also said you need some form of current limiting in each string. I had an LED in a project last week that lit up fine but broke down under reverse voltage, it was quite a job to track that down as I kept thinking it was my wiring.