To save me having to worry about multiplexing, if I have a few LED displays I want to control from an Arduino, I string enough 74x595s together to give each LED its own output:
Dimming is easy - I've added a transistor between the LEDs and ground, so I can dim them all in one go with PWM. If I'm using 7 segment displays I usually stick one transistor on each display so I can fade them all individually for added sexiness (YMMV).
My problem is that I've found some sexy little 7-segment filament displays:
They are designed to work from TTL-level voltage (5v) and take less than 10mA each. If I try and connect them the same way as LEDs though:
Then dimming doesn't work. If the transistor is off, current flows from whichever segment is lit back through any unlit segments and back into any of the 595's LOW outputs.
What's the best way to solve this?
A) I could stick a Schottky diode in series with each segment (much like the series resistors on the LED schematic above) but that costs me a bit of brightness.
B) I've heard of tri-state outputs on logic chips, but is it possible to get a 595 shift register that will let you set an individual output to high impedance instead of just plain LOW? How would you send it data? Each output would need two bits of data sending.
C) Any better ideas?
Wish I'd thought this through before making my clock; apart from this dimming problem, everything else worked perfectly first time, and I'm not looking forward to laying out the board again, milling and stuffing it again, it took me ages, dagnammit ...
(PS I wish I'd discovered those little 0-ohm jumpers a long time ago - they save an awful lot of hassle if you're trying to do everything on a single-sided PCB. With the tolerances on my mill, I can just squeeze 3 tracks under each jumper. The days of trying to strip 1mm of insulation off each end of a 5mm bit of kynar wire are over, yay!)
You are going to need to add diodes in series with each filament to prevent the current looping back.
The easiest way to do this with your board is to get some very small surface mount diodes and the traces going between the 595 and the filament, soldering the diode across the gap. You should have enough room if you stagger the cuts.
You may be able to squeeze 0603 diodes (which are 0.5mm wide, 1mm long) onto each of those traces.
P.S. That is a very neat and pretty circuit board!
Turn on the npn permanently. This keeps the "unlit" lambs at just the npn's Vce - should be 100mv or so and those "unlit" lambs should not be visibly light.
reroute your pwm signal to the hs595's OE pin(s).
Some jump-wiring and some recoding (minimum though).
Yes that is correct. The reason is that a filament can not react fast enough to be dimmed by PWM due to the thermal lag. The control region is very narrow.
Other solutions posted unfortunately are rubbish especially the ones that involve torturing small sheep or using diodes. Sorry but there are some people giving poor advice on this forum lately.
What you need to do is to control the voltage to these displays. Perhaps the simplest way is to use the chip as a current sink and connect the common points to +ve through a transistor running as a emitter follower. That is emitter to common points, collector to +ve, resistor on the base to a low pass filter being driven by the PWM.
dhenry:
2) reroute your pwm signal to the hs595's OE pin(s).
Fantastic! Never occurred to me that you could just PWM the whole chip using its output enable pin... So I never needed those transistors at all... man, I've been doing that PWM transistor trick on everything, completely redundantly. D'oh!
Grumpy_Mike:
(snip) ... a filament can not react fast enough to be dimmed by PWM due to the thermal lag. The control region is very narrow.
I'm not sure I understand you, Mike - haven't domestic dimmer switches been using a form of PWM to dim our incandescent-laden chandeliers for years? The thermal lag just acts like a low pass filter, surely. Or do you mean that the light response may not be linear, or may be inconsistent eg. may exhibit hysteresis when ramping up and down?
The only effect thermal lag will have as far as I am aware is to simply slow the reaction to any change in brightness. If you try and change the brightness quickly you will run into problems, the lag will mean you don't notice the fast transient changes, but regardless you do see the overall effect. It might take a few hundred ms to change, but I don't see how that would be an issue for dimming the whole seven segment display.
If you use PWM, yes you are still giving it full voltage for some of the time (on time), but you are giving it zero for the rest. This will reduce the overall power through it. Less power dissipated means less heat which means less light output = dimmer.
PWM dimming works with filaments fine in slow response systems like this, it is how household dimmer switches work.
Contrary to "popular" believe, PWM will work on filament lamp and I would argue the thermal lag helps. Otherwise, the driver is repeated strained due to low cold resistance of the filament.
it is how household dimmer switches work.
Most dimmers utilize triac. So they are more phase angle modulated.
If the output enable didn't exist you could move over to a variant of the 595 that has open-drain outputs such as the NPIC6C595-Q100 (which also have the advantage of driving higher voltages than 5 if you need it). You'd have to add PNP switching transistor and PWM on the high-side though with open-drain outputs. But the OE does exist!
Or you could directly PWM the outputs themselves (would have to re-update the shift-register chain at a very high rate of course).
That would require tremendous amount of data being sent over the spi. I would say that's practically no-workable.
I bought one of those 5 metre long RGB LED strips with a little control box and remote a while back, and pulling it apart (welcome to my home, new victim) I noticed it used a tiny PIC and a plain ole' 595 to control the 3 channels' MOSFETs. Made me wonder how fast you can update shift registers. Obviously becomes less practical the more 595s you have chained together. Also made me wonder why they chose to use two separate chips rather than just using a PIC with more legs/outputs on it...
PS thanks for the compliments on my PCB construction, I always think they end up looking a bit hacky but it's nice to get a thumbs up from you folks
Made me wonder how fast you can update shift registers.
With hardware spi, obviously you can do as fast as the hardware allows. With software spi, I think you need 10 or so instructions per bit -> ~100 instructions total. At 1MIPS, that's about 100us, give or take a few. At 16MIPS, 6us-ish.
i'd agree with that. The software SPI for an attiny can get about 125kHz from a 16MHz clock, but that includes reading the MISO pin. For just transmitting, about 170kHz sounds realistic.