Driving a LED matrix

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

Moderators: Dave Moll, Andrew Davie, Steve Anderson

Driving a LED matrix

Postby Andrew Davie » Sat Mar 11, 2017 8:17 pm

I have a beautiful 8 x 5 (40 ultra-bright LEDs!) array already from my first televisor. It is configured in strips of 5 LEDs with balancing resistors across the 8 strips. I generally supply it with 20V or so, just to have sufficient voltage to cross the LEDs. I can either continue with that, or build a new matrix. The attraction of a new matrix is that I can build it to be compatible with the current 12VDC supply and not require a different power source. If I went with 12VDC then I'd be able to get about 3 LEDs in series (instead of 5) and to be honest I think the 40 is over-kill. Say, 5 strips of 3 at, what was it, something like 30 mA per LED. That would be 450 mA.

So the Arduino obviously can't drive that - so I'm going to need a transistor/MOSFET/whatever. Don't know yet, I'm just thinking out loud. In particular, if I write the NBTV signal to an analog pin out - representing brightness, what I really want to be doing is controlling the current to the LEDs - because (if I remember right) the LEDs are current-driven. Well, we could use PWM that would be an interesting solution. Then the NBTV brightness would actually be the duty cycle of the PWM driving the LED. I am not sure why this isn't a good idea... it makes the control really easy.

I see that the function analogWrite() is pretty much that. A duty cycle write to a pin which in turn drives (indirectly via transistor?) the LED array. The frequency of the PWM needs to be fairly high, obviously - can it be the same as the 38KHz doing the read. More on that later.

Once I have the LED matrix running of the Arduino, that's completely removed the old-skool analog circuitry and I'll be flying solo. Sobering.
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 » Sat Mar 11, 2017 9:09 pm

So, with PWM driving the LED it's going to be pretty similar to the motor, right? Calculate the current draw and the bias of the transistor which gives the current at the base and then from the 5V - 1.5V (or whatever) and the known current we calculate the resistor adjacent to the arduino pin. And the LEDs should work :P For the first version I'll keep the separate 22V power supply and the original LED matrix. For a later version I'll make a new lower-voltage matrix.

One thing to consider; I'm going to need brightness and contrast - and possibly gamma correction - and I'm really going to have to understand how these work in the analog circuit. I think I have a grasp on the brightness - just amplification of the signal voltage. I also understand the gamma - above/below certain brightness levels we attenuate differently. Those steps are going to be pretty straightforward on the Arduino - should have plenty of processing power for that. Not sure how/what the contrast is actually doing to the signal, so hopefully someone will help me out on that one.

So I'm going to need a couple of potentiometers to control those! That's two analog input pins required - A0 is allocated already to IR in. A1 is the NBTV signal in pin. A2 I'm planning on using as output for the LED matrix. So let's say A3 = brightness and A4 = contrast. Hooking up a potentiometer is pretty simple it seems.

The 'pipeline' as I see it - a 38KHz read of A2 (NBTV signal) which has a pp of 1V per the NBTV standard. I then either a) amplify according to the brightness pot (to a maximum of 5V, so do we clip or just limit) and then strip off the sync pulses or do we b) strip off the sync pulses first and then amplify. I'm inclined to do b) because then the sync level is known (0.3V if i recall correctly). If we strip off the sync pulses, then maximum is then 0.7V which means we could amplify by 5/0.7 = 7x roughly. That stripped signal is then sent straight to A2 pin which is the PWM duty cycle for the LED array. The sync pulses need to be processed in some way to find that missing pulse. How annoying; but in fact inferring the position of the "missing pulse" allows us to have a "frame adjust" up and down so we could have a framing pot, too... a vertical shift... simply by advancing or retarding where we infer the synch pulse in the NBTV signal. Food for thought.

So, the immediate goal is to hook up the existing LED matrix, and attempt to change brightness varying duty cycle using PWM output on A2. And we hook up the matrix pretty much the same as we did for the motor, as noted. Will revisit the original build to see the LED specs first so I can find maximum current on those LEDs.
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 » Sat Mar 11, 2017 9:26 pm

These are the advertised specs of the LEDs in my current array...

DC Forward Voltage: Typical: 3.4 V Max: 3.8V
DC Forward Current:25mA

With 5 in series that would be 5*3.8 = 19V (hence my 22V supply)
40 LEDs would have total current of 1A. That seems quite a bit, mmh. Am I misunderstanding how the 8 rows of 5 works...? Yes!

As Klaas explains below, the LEDs in series use the same current. So 8 row of 5 uses 8*25 mA = 200 mA

OK, anyway let's go with 1A 250 mA for now. The TIP122 I used for the motor has a gain minimum of 1000. From the data sheet, figure 2, Ic=250.Ib so Ib = 250mA/250 = 1mA. That's fine for the Arduino, so calculating the resistor on the pin - (5V-1.5V)/0.001 = 3.5K ohms. Unfortunatlely I built the board already with 1K, so that would be a current of 35 mA which is a tad too high, really.



So, I plan to build a new board to drive the LED array, on which is a TIP122 and a 1K resistor connecting to output pin A2. Then I can test driving the LED with a simple brightness fader. Perhaps that would be as good a time as any to also test out a brightness pot, so let's make that the goal for tomorrow.
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 » Sun Mar 12, 2017 2:32 am

Andrew, 1A is an unexpected outcome. Well done! This is because you have LEDs routed in series, so the current is running through more LEDs in a row. If you have 4 series of 5 LEDs, and the max currend for one LED is 25 mA, then for one serie it is too 25 mA and for 4 series (in parallel) it is 100 mA.

You can control the LEDs with PWM, you are then switching them. Then the transfer characteristic is linear, and you cannot change that to quadratic, needed for gamma correction. However you can do gamma correction in software too, matter of a translation table, but then you need to have more bits in the PWM than 8.

I told you already that for black and white you can go back to 6 bits of quantisation. That is for a signal to a gamma corrected display device, e.g a CRT tube. If you work with linear signals digitized, then you need 3 bits more, that is 9 bits. I don't know if your PWM generator can easily be installed for 9 bits (or 10 bits) precision.

Otherwise you convert the PWM to an analogue signal (R and C) and do gamma correction on that, in the usual way, two diodes in the emitter of the transistor.
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 » Sun Mar 12, 2017 2:46 am

Klaas Robers wrote:If you have 4 series of 5 LEDs, and the max currend for one LED is 25 mA, then for one serie it is too 25 mA and for 4 series (in parallel) it is 100 mA.
I don't know if your PWM generator can easily be installed for 9 bits (or 10 bits) precision.


Glad that you're checking on me - so thanks for that. OK, understood about LED current now. The Arduino Micro can do 10-bit PWM. I will have to learn how.
For my first attempts though I'm just going to go with raw signal --> LED.
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 » Sun Mar 12, 2017 3:10 am

Then I can advice you to control the LED array by CURRENT. That is:
- connect the base of the darlington (yes?) TIP 22 directly to the Arduino PWM output pin,
- you get there a square wave of 0 ... 5V,
- The Darlington needs 2 x 0.7V = 1.4 volt to the emitter,
- so the emitter will go to 5 - 1.4 = 3.6 volt.
- For a current of 100 mA you need a resistor of 3.6 / 0.1 = 36 ohm to ground.
- 36 ohm is two resistors of 18 ohm in series.
- The voltage at the bottom of the LED array may not come as low as 5 volt at full brighness,
- check that with your multimeter while you put a steady 1 to the output pin of the Arduino.
- So you might need at least 24 volt DC as a supply voltage for 5 LEDs in series,
- no need to have this stabilized, 28 volt mean value with ripples is OK.
- The CURRENT is defined by the 5 volt, the TIP22 and the 36 ohm resistor,
- NOT by the supply voltage, as long as it is high enough.

- For 4 LEDs in a row the supply voltage should be 4 x 3.5 = 14 volt + 5 volt = 19 volt, or more.
- So may be, remove one LED from each serie (or short circuit that LED).
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 » Sun Mar 12, 2017 11:40 am

Klaas Robers wrote:Then I can advice you to control the LED array by CURRENT. That is:
- connect the base of the darlington (yes?) TIP 22 directly to the Arduino PWM output pin,
- you get there a square wave of 0 ... 5V,
- The Darlington needs 2 x 0.7V = 1.4 volt to the emitter,
- so the emitter will go to 5 - 1.4 = 3.6 volt.
- For a current of 100 mA you need a resistor of 3.6 / 0.1 = 36 ohm to ground.
- 36 ohm is two resistors of 18 ohm in series.
- The voltage at the bottom of the LED array may not come as low as 5 volt at full brighness,
- check that with your multimeter while you put a steady 1 to the output pin of the Arduino.
- So you might need at least 24 volt DC as a supply voltage for 5 LEDs in series,
- no need to have this stabilized, 28 volt mean value with ripples is OK.
- The CURRENT is defined by the 5 volt, the TIP22 and the 36 ohm resistor,
- NOT by the supply voltage, as long as it is high enough.

- For 4 LEDs in a row the supply voltage should be 4 x 3.5 = 14 volt + 5 volt = 19 volt, or more.
- So may be, remove one LED from each serie (or short circuit that LED).


Then that is what I will do. I still have trouble understanding a lot of this stuff, and the PWM stuff at least I did understand that. What I have/had trouble with is how varying voltage at the Arduino pin translated into varying current at the LED. But, V=IR right? So if you have a constant R and V is varying then of course I is varying too. I would like to try and keep the array unchanged, so I'll try a higher voltage - or as a last resort short out one LED from each series as you suggest.

Although long-term I would like to build this into a fully stand-alone Arduino televisor, my actual goal is to demonstrate "frame lock", and so although I'm partway there with a nice line-lock using a single sync hole (IR sensing rpm as input to PID controlling a PWM controlling the motor), I need actual NBTV signal sync pulses to play with frame lock. I suppose I could split the NBTV video so that the analog circuit is handling the LED driving, and just get the Arduino splitting out the sync pulses and handling that, but I thought I'd try for the less hacky solution (that is, migrating the LED matrix over) because then I will be completely independent from the analog circuitry (although less capable for a while, having no gamma, contrast or brightness).

On the other hand there is something really flaky with my old analog board - when I even TOUCH the contrast pot, the brightness flares up and the whole screen is pure white for a number of seconds. Sometimes happens with the brightness too. Something wrong with my wiring no doubt. But anyway, the analog one isn't going to be around too much longer - too dodgy, old, and hard to maintain.

I understand your notes about the required voltage, and will follow your suggested plan of attack. I have an 18VAC out on one of my power supplies, so that should give me at least 25VDC. I measured just now - it's reading 25.6V, stabilised with a 4700 uF capacitor. So I'll use that.
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 » Sun Mar 12, 2017 12:25 pm

Klaas Robers wrote:- For a current of 100 mA you need a resistor of 3.6 / 0.1 = 36 ohm to ground.
- The CURRENT is defined by the 5 volt, the TIP22 and the 36 ohm resistor,


I'm a bit more awake, so a further reply... the maximum current allowed on an Arduino Micro pin is 20 mA (ref: https://www.arduino.cc/en/Main/arduinoBoardMicro). And I want to keep somewhat under the maximum, so say 10 mA. If the LED array is 8 strings of 5 @ 25 mA/string then that's 200 mA. The TIP122 data sheet Figure 2 states Ib = 250*Ic, so Ib = 200/250 = 0.8 mA - theoretically that's all I need on the Arduino side to drive 200 mA at the LED side. Let's make it a bit bigger, say 2 mA. So, (5 - 1.4) / 0.002 = 1800 ohms. So here, I'm now confused.

I need to protect the Arduino, and it has a maximum current of 20 mA. And previously I've done the calculation above to limit the current at the base of the TIP122. That is, a resistor between the Arduino pin and the TIP122. The TIP122 can then control a device with 250* that current (per the data sheet equation on figure 2, Ib = 250 * Ic. That's how I understood it.

But in your calculation Klaas, you allowed 100 mA current by putting a limiting resistor to ground (whereas my resistor is to the Arduino pin). So, please excuse my confusion, is the resistor you are talking about essentially alongside the LED array, between it and ground? If there's a limiting resistor there, then the current at the LED will be at most (per your calcs) around 100 mA and consequently the current drawn on the TIP122 base will be a correspondingly lower current and effectively the protective resistor I have/had on the Arduino pin isn't doing anything. Am I close to understanding this now?

Edit: another way of stating this - I can put a resistor on either side of the TIP122. On the Ardunio side (connected between base of TIP122 and Arduino pin) then I control the maximum current via (5-1.4)/R = I. And as a consequence that controls the maximum current to the LED array through the Ib = 250*Ic given in the data sheet. Alternatively, I can put a resistor between the LED array and ground, and that limits the current through the LED array. That limitation means an upper-limit on the TIP122 current and again via Ib = 250*Ic I can calculate the maximum current on the Arduino pin given 100 mA drawn by the LED matrix. So I can have one resistor LED-ground, or one resistor TIP122-Ardino or in fact I can have both if I wish. Is this correct?
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 » Sun Mar 12, 2017 3:37 pm

It seems that writing to analog pins on the Arduino is effectively changing the duty cycle of a PWM signal on that pin. There's no "voltage adjust" - the pins are just modulated to give the "effect" via PWM. This page discusses the issue and suggests a low-pass filter to convert the PWM signal into an equivalent voltage. So it's essentially smoothing the output by use of a capacitor to reduce the ripple and in effect convert a PWM frequency into a voltage. Choice of capacitor is going to be key. I think I understand that.

So, to drive a LED array with current I believe I need to vary the voltage going to the TIP122 base. That variation in turn allows varying current because the resistance is constant. I think at this stage that's what I need to do; place a "low pass filter" between the arduino analog pin and the TIP122 to convert PWM to a voltage. I should be able to easily change the frequency of the PWM signal, so I'd choose a frequency that made sense with regard to the resolution of the scanline and potential changes. But that relates to the frequency of the signal anyway (~10kHz) so if I chose a (for example) 62.5kHz PWM then I should be fine after "filtering" the PWM back to a voltage. Right?
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 » Sun Mar 12, 2017 5:59 pm

Andrew Davie wrote:It seems that writing to analog pins on the Arduino is effectively changing the duty cycle of a PWM signal on that pin. There's no "voltage adjust" - the pins are just modulated to give the "effect" via PWM. This page discusses the issue and suggests a low-pass filter to convert the PWM signal into an equivalent voltage. So it's essentially smoothing the output by use of a capacitor to reduce the ripple and in effect convert a PWM frequency into a voltage. Choice of capacitor is going to be key. I think I understand that.

So, to drive a LED array with current I believe I need to vary the voltage going to the TIP122 base. That variation in turn allows varying current because the resistance is constant. I think at this stage that's what I need to do; place a "low pass filter" between the arduino analog pin and the TIP122 to convert PWM to a voltage. I should be able to easily change the frequency of the PWM signal, so I'd choose a frequency that made sense with regard to the resolution of the scanline and potential changes. But that relates to the frequency of the signal anyway (~10kHz) so if I chose a (for example) 62.5kHz PWM then I should be fine after "filtering" the PWM back to a voltage. Right?


That would work Andrew but you shouldn't have to do that, it is precisely the changing of the duty cycle that causes the LEDs to vary in brightness, the shorter the duty cycle the dimmer the led and vice versa.

Unless there is some problem with varying the PWM quickly enough I can't see why it shouldn't work - it is a common enough modulation technique.

In this case your eyes are performing the "filtering".

Consider a PWM with 100% duty cycle - effectively DC - that is LED full brightness.
Consider a PWM with 50% duty cycle - that is LED half brightness (LED is at full brightness half the time and off the other half of the time).
Consider a PWM with 0% duty cycle - that is LED off.

The trick is to have this happening fast enough that your eyes blend it all together.

Did you see somewhere that says this is not the case? I would be interested to know why.

You can convince yourself of this with a worthwhile experiment where your software changes the PWM duty cycle from a maximum down to zero gradually.
The circuit would be identical to the familiar blinking diode project.

The ultimate point is, if you are going to replicate the analogue waveform why not drive the LEDs directly using Klaas' one transistor circuit?

(There would be some benefit in producing test patterns from the arduino however).
gary
 

Re: Driving a LED matrix

Postby Andrew Davie » Sun Mar 12, 2017 10:06 pm

First test. I am using a TIP122 to drive the 8x5(strings) = 40 LEDs. I had previously chosen a 1K resistor on this small "LED driver" board, so I thought that safe enough to test. I'm feeding 26VDC to the LED matrix, through the TIP122 collector. I am writing a 0-255 value to the output port on the Arduino. I have put the oscilloscope on the collector of the TIP122 and as expected I see a square wave with varying duty cycles and period about 2.2 ms (that's the default; I will change it later). The LED array lights up, and also is going through brightness changes. I have my ammeter across the positive feed of the LED array, and it's showing varying current. It's been running OK for about 10 minutes - the TIP22 to the LEDs is warm but not hot. So far so good.

Now the "bad" things...

  • The voltage of the square wave on the collector of the TIP122 varies as duty cycle changes. It's about 15V maximum with duty=0, and as the duty cycle increases, it slowly decreases down to about 14V as I increase to duty=255. I am not sure what to make of that yet.
  • The current is 0 mA with duty=0, and a maximum of about 420 mA peak that I saw (when pulsing duty) - but right now it's hovering at 353 mA at the duty=255. Now, at 420 mA that's about twice what I expected - this would suggest that the whole array is drawing twice what I expected. Either the LED specifications are wrong, and actually they draw 420/8 = 52.5 mA or somehow I have misremembered the string size. I'm going with the former. However on reflection at 353 mA that's much more reasonable; 44 mA/LED. They're ultra bright so it makes sense that they have a high current draw. My observation is that the array is not as bright as it was before (but I'm not totally sure), when I have duty=255 - suggesting that I'm not allowing enough current. But that confuses me with the above 52 mA figure suggesting I'm already drawing a lot. Mmmh. Could be my low PWM frequency, perhaps?

So, I don't have a higher voltage higher, but I can do the same tests on a lower one...

I've switched down to 21VDC (calculated). With duty=255, LED is just as bright (ie: OK). Current is now around 185 mA. The PWM square wave voltage via 'scope is now moving between 11V and 10V.

On 17VDC LED is dimmer, but still alight. Current now 30 mA. I didn't expect it to work on 17V but it is doing what I tell it (changing brightness according to duty cycle).

In any case, back to 26V

Hard for me to understand this yet.

  • The array works on all voltages tried (26V, 21V, 17V).
  • The (measured) current drawn seemed proportional to the voltage.
  • Maximum brightness decreased as voltage decreased.
  • Current at 26V was way higher than I expected (~400 mA)

I *suspect* that my PWM frequency is way too low to be operating LEDs. As I increase the frequency I would probably see a corresponding increase in brightness. I'll tackle that tomorrow. I have a short video of the current setup, below - now the analog circuitry is from the old televisor is scrapped, it looks a lot less messy. I hot-glued the small boards to the desk for the while; unconventional but it keeps things tidy for me. In all there are only about 6 actual components aside from the power boards. A resistor and darlington for the LED, same for the motor, and two resistors for the IR LEDs.


youtu.be/jLXes2PvZ0Y

Here's a tip for everyone: DON'T try to measure DC voltage with the multimeter probes setup to read current. Unless you like sparks!
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 » Sun Mar 12, 2017 10:16 pm

gary wrote:That would work Andrew but you shouldn't have to do that, it is precisely the changing of the duty cycle that causes the LEDs to vary in brightness, the shorter the duty cycle the dimmer the led and vice versa.


Yes, totally understand that - but I was following what I thought Klaas said, which is that if I use PWM to the LEDs then I can't correct gamma via resistors. I thought there was some kind of gotcha and so I was thinking at it being a voltage for the resistors. Maybe I'm just confused. Again. I kind of like doing gamma with resistors because it lightens the load on the CPU.

Klaas Robers wrote:You can control the LEDs with PWM, you are then switching them. Then the transfer characteristic is linear, and you cannot change that to quadratic, needed for gamma correction. However you can do gamma correction in software too, matter of a translation table, but then you need to have more bits in the PWM than 8.


gary wrote:The ultimate point is, if you are going to replicate the analogue waveform why not drive the LEDs directly using Klaas' one transistor circuit?


Because I need to get the NBTV video signal into the Arduino so that I can process the synch pulses which will give me the ability to do frame lock. Since I'm processing the signal anyway, it should be easy-as to feed that out through an analog pin (which I worked on tonight) and reduce the system complexity.

gary wrote:(There would be some benefit in producing test patterns from the arduino however).


I am considering adding a SD card reader - cheap and easy to use, apparently - so that it could play NBTV from files on a card you insert. Then you can have whatever test pattern you like, and totally remove the need to have a CD or the dangfangled wires coming from it before you can play anything. Would make the machine much nicer as a standalone display unit.
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 » Sun Mar 12, 2017 10:42 pm

Andrew Davie wrote:
Because I need to get the NBTV video signal into the Arduino so that I can process the synch pulses which will give me the ability to do frame lock.


Well do you? All you really need are the sync pulses themselves, and you don't even need to sample those, all you need to do is detect the leading edges, it's just a matter of counting pulses.
gary
 

Re: Driving a LED matrix

Postby Andrew Davie » Sun Mar 12, 2017 11:00 pm

gary wrote:
Andrew Davie wrote:
Because I need to get the NBTV video signal into the Arduino so that I can process the synch pulses which will give me the ability to do frame lock.


Well do you? All you really need are the sync pulses themselves, and you don't even need to sample those, all you need to do is detect the leading edges, it's just a matter of counting pulses.


I do if I also want to have brightness/contrast without all the extra external circuitry. I understand what you're suggesting. I'm leaning towards having a minimal external component count and giving most of the work to the Arduino. I am open to suggestions though. I'm thinking about the alternative (and you mention Klaas's single transistor circuit; I'm not sure I'm familiar with that. But in principle - what you're suggesting - put the signal on a pin and use a comparator like I did with the IR led and detect falling edge of the synch pulse. The comparator works against 1.1V or an external voltage source so I'd need to reduce the voltage somehow or provide a reference voltage for the synch level (perhaps via a pot?). I'd also want brightness and contrast working... ah, I'll get to that later.

The advantages of NOT processing the signal with the arduino are the taxing requirements of sampling at 38kHz or so. The advantages of processing with the Arduino are that I could add a pause - but more importantly I'd have the same system as used for reading from the SD card - that is, signal is processed by the Arduino internally. If I didn't do that, then the SD card would be a no-go or I'd have to have two ways of processing a signal. Nup.

Seems to make more sense to me to get the nBTV signal into the Arduino, process it for brightness/contrast and possibly gamma as it's read, detect the sync (although I like using a comparator for that if i can), possibly remove the sync (though, maybe not necessary - just think of sync as "black black") and send to the LEDs.
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 » Mon Mar 13, 2017 2:44 am

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.

1. Lets look ate the TIP22 darlington with an amplification factor of 250.
- If there is a positive voltage at the collector, the emitter bound to ground,
- and you send say 1 mA into the base,
- the voltage on the base will become 1.4 volt,
- that is two Si-diodes in series (2 x 0.7 volt),
- and this causes a current from collector to emitter of 250 mA,
- the amplification factor times the base current.
- In the emitter runs then 251 mA to ground,
- that is the 250 mA coming from the collector
- and the 1 mA coming from the base.
- This is true as long as the voltage on the collector is higher than the voltage at the base (1.4 volt).

- Until so far there is NO resistor from emitter to ground.

- Lets assume that the voltage on the collector is more than 5 volt, say 8 volt above ground.

- Now I am going to place a resistor from emitter to ground,
- say 10 ohms.
- I keep the base current to be 1 mA
- and because the collector voltage is high enough the amplification factor stays at 250,
- so the collector current stays at 250 mA.

- The current of 251 mA causes a voltage over the 10 ohm resistor of 2,51 volt....
- then the voltage at the base MUST be 3.91 volt = 2.51 + 1.4 volt...... Yes?
- if the voltage was lower, there was not running that 1 mA base current, and........ Yes?

Now the other way around:
- I want to get a collector current of 250 mA,
- while the voltage at the base is 5 volt (Arduino output port).
- Then I should have a resistor from emitter to ground that:
- when there is a current running through it of 251 mA,
- that the voltage over it is 3.6 volt, (5 -1.4 = 3.6).......... Yes?
- My calculator says 14.34 ohm........ Yes?

In this situation there is a collector current of 250 m
- and a base current (delivered by the Arduino port) of 1 mA.
- There is NO resistor needed from the Arduino port to the base of the transistor,
- as the base current is no more than 1 mA,
- that is because of the amplification factor of 250 of the TIP22.

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

If the voltage of the output port is 0 volts,
- there is no base current
- and there is also no collector current.
- So the Arduino can switch the current of 250 mA on and off,
- also when this happens with a square wave of 38 kHz.
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1656
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Next

Return to Andrew Davie's Arduino Televisor

Who is online

Users browsing this forum: No registered users and 4 guests