Driving a LED matrix

A "new fashioned" televisor, using an Arduino to drive the motor and display.

Moderators: Dave Moll, Andrew Davie, Steve Anderson

Re: Driving a LED matrix

Postby Andrew Davie » Mon Mar 13, 2017 11:24 am

Klaas Robers wrote:I see, you have 8 strings of 5 diodes.... That is 8 x 25 mA = 200 mA for peak white. Don't allow to run more for a somewhat longer time as that will ruin your LEDs.
I see that you are not familiar with the way a transistor or a darlington pair works. I see you calculating the worng things.


OK, I have read this detailed explanation a number of times, and will continue to study it carefully. What happens is that I try to find a logically consistent explanation for things given my basic lack of experience and training. And then I document it on the forum here so that people can correct me. As I see, and you have explained, I did not understand things well at all. Your explanation is fantastic - a big thank you. What I think I was concerned about before was the current somehow making it "backwards" through the transistor and frying the Arduino. But I understand now that if the LED array is limited by the resistor, and the TIP has a 250x Ib:Ic ratio then the current on the Arduino pin is also limited and no resistor required. Thanks again.

I appreciate your assistance Klaas; invaluable! I wish I had so much knowledge. At least this time around I'm taking the time to build up a better understanding :)
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Driving a LED matrix

Postby Andrew Davie » Mon Mar 13, 2017 1:21 pm

Klaas Robers wrote:Make a few circuit drawings and draw arrows in it with the value of the currents,
and reread the lines above.


ledcurrentdiag.jpg
ledcurrentdiag.jpg (190.26 KiB) Viewed 11094 times


Edit: I have realised that because I want 200 mA on the LED array, that the current at the base of the TIP220 will be 0.8 mA, not 1 mA - however the difference is negligible. For 200 mA, R = 3.5 / 0.2008 ~= 17 ohms. Such precision is not required, I think.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Driving a LED matrix

Postby Andrew Davie » Mon Mar 13, 2017 3:21 pm

I have made this change to the circuit, using a 16 ohm resistor. The LED appears much brighter and of course the Arduino is still working :)
I measured the current to the LED matrix; I see a maximum (and sustained) current of 209 mA with 100% duty. That's pretty cool :)

It occurs to me that I should revisit my motor board too, as I have obviously used the same miscalculation error there.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Driving a LED matrix

Postby gary » Mon Mar 13, 2017 3:48 pm

Great work, have you tried it at other duty cycles?
gary
 

Re: Driving a LED matrix

Postby Andrew Davie » Mon Mar 13, 2017 4:55 pm

Andrew Davie wrote:I have made this change to the circuit, using a 16 ohm resistor. The LED appears much brighter and of course the Arduino is still working :)
I measured the current to the LED matrix; I see a maximum (and sustained) current of 209 mA with 100% duty. That's pretty cool :)

It occurs to me that I should revisit my motor board too, as I have obviously used the same miscalculation error there.


See this post, where I stuffed that up royally...
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Driving a LED matrix

Postby Andrew Davie » Mon Mar 13, 2017 5:31 pm

gary wrote:Great work, have you tried it at other duty cycles?


No, I assume if it works for one it will work for the others. I'll try others later - right now I think I have a damaged Arduino and definitely a non-functioning motor circuit :(
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Driving a LED matrix

Postby Andrew Davie » Mon Mar 13, 2017 7:17 pm

ledprotective.jpg
ledprotective.jpg (150.69 KiB) Viewed 11086 times


Revised circuit diagram/explanation with added protective 1K resistor to limit current on Arduino pin to a maximum of 5 mA; this won't have any effect at all on the 0.8 mA required to deliver 200 mA to the LED matrix, but will protect the Arduino from excessive current in case of a short somewhere.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Driving a LED matrix

Postby Klaas Robers » Wed Mar 15, 2017 8:30 pm

If you absolutely want that resistor, then measure the voltage accross that resistor. When the current is 0.8 mA, it will cause a 0.8 volt lower voltage at the base of the TIP22, and thus the emitter resistor has to have a lower value. I don't see any reason to circuit here a resistor.
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1656
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Driving a LED matrix

Postby Andrew Davie » Wed Mar 15, 2017 9:03 pm

Klaas Robers wrote:If you absolutely want that resistor, then measure the voltage accross that resistor. When the current is 0.8 mA, it will cause a 0.8 volt lower voltage at the base of the TIP22, and thus the emitter resistor has to have a lower value. I don't see any reason to circuit here a resistor.


I currently do NOT have a resistor. It's working nicely without it.
Is there any way that the LED or TIP122 could fail and allow excess current on that pin?
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Driving a LED matrix

Postby Klaas Robers » Wed Mar 15, 2017 9:39 pm

Yes, there is a way. If the transistor is damaged such that the bottom of the LED-array is connected directly to the Arduino output pin, and the voltage at that point is far over 5 volt, then this may damage the output port of the Arduino. But in most cases when the transistor fails there is a collector-emitter short. I don't know what the result of it will be. The cause is normally a too high temperature of the transistor, so see that you cool it properly. If you still can touch the transistor, the temperature is not higher than 50 degrees, which is very safe. Internally the transistor should not be hotter than 150 degrees.
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1656
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Driving a LED matrix

Postby gary » Wed Mar 15, 2017 10:54 pm

Klaas, It is late for me after a long hard day and my brain is not on "high beam" but I think you have convinced me that the emitter (there you are, I originally wrote collector) resistor should be removed altogether and moved to the collector side, all we want to do is ensure the transistor is in saturation for whatever the base current is when the pin is high. That should occur at quite a low current due to the high hfe of this device , but if it doesn't ensure saturation at less than the safe sink current of the output pin then we should probably be looking at another transistor (or a second stage). If I was less tired and had more time (this is my "play" time) I would look up VBEsat and VCEsat to find the correct hfe on the graph etc etc, but I think if we just use VCEsat to calculate the emitter resistor value that limits the current (should be the same as the emitter resistor anyway) that should suffice - heck I think even if we modelled the transistor as a switch it would be close enough given the relatively high voltage (26V) we have here, at least we err on the safe side.

The reason for the 1k (rather than Vpin/Ipinmax + safety) is, well everyone has lots of 1k resistors ;-) if it is too high it can be reduced but a rough and ready Ib*hfe gives ~ 1 to 4 amp.

I have become quite a woodworker in my retirement and I have learnt that if you cut too long you can always cut a bit more off, the reverse is significantly more difficult.
gary
 

Re: Driving a LED matrix

Postby Andrew Davie » Thu Mar 16, 2017 12:17 am

gary wrote:I have become quite a woodworker in my retirement and I have learnt that if you cut too long you can always cut a bit more off, the reverse is significantly more difficult.


And me, as a software engineer I have learned "defensive programming" and to translate that to hardware, it would go something like this... "It shouldn't happen, in fact it can't happen... it will NEVER happen.... but just in case it DOES happen I'll put in this protective thing that will prevent disaster".
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Driving a LED matrix

Postby gary » Thu Mar 16, 2017 1:43 pm

Andrew Davie wrote:And me, as a software engineer I have learned "defensive programming" and to translate that to hardware, it would go something like this... "It shouldn't happen, in fact it can't happen... it will NEVER happen.... but just in case it DOES happen I'll put in this protective thing that will prevent disaster".


Especially in a multi-developer environment...
gary
 

Re: Driving a LED matrix

Postby Andrew Davie » Fri Mar 17, 2017 10:45 pm

I am stuck.
Could I have run into a limit on the switching/PWM speed that the LED array can handle? I am trying to drive it with a 32.125kHz PWM.
I don't seem to get sensible results when I am changing the duty cycle of the PWM to the LED at ~44.1kHz.
When I reduce to ~22kHz and halve the disc speed, I see very sharp black/whites not many greys but that could be gamma problem. But it's a recognisable image.
When the only thing I change is going back to 44.1kHz update to the PWM duty (and spin the disc faster, of course), the display just goes garbage. Grey and black, no discernable detail.
It seems to me like I've hit some fundamental limit.
I can think of the following...

1) LEDs just don't work when PWM switched at ~32kHz
2) The Arduino PWM doesn't work when duty cycle is changed at such a high frequency.

Both fundamental issues.
I am wondering how to change the LED array to current driven, given that I can only output PWM from the Arduino....?

Help!
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Driving a LED matrix

Postby Andrew Davie » Fri Mar 17, 2017 11:38 pm

Currently investigating Digital Potentiometers as a solution - the potentiometer varies resistance, so if this is between the Arduino and the LEDs and somehow have a constant voltage to the LEDs (say, 22V) then via the DP the arduino could control LED brightness via current. Just trying to find a solution.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

PreviousNext

Return to Andrew Davie's Arduino Televisor

Who is online

Users browsing this forum: No registered users and 2 guests