Connect with us

Transistor Mosfet pairs to drive LED cube layers

Discussion in 'LEDs and Optoelectronics' started by rjamjb, Jan 19, 2013.

  1. rjamjb

    rjamjb

    50
    1
    Jan 19, 2013
    Hello,

    I am new to this forum but seems like I may find some useful input to my circuit designed to drive an LED 8x8x8 RGB cube with common anodes.- they will sink to a series of TLC5940 constant current ICs which are filled with data from a Chipkit Uno

    The Power = this is why i need a separate external 5v source!!
    The part of the circuit I have designed is the part that drives the current to the common anode layers (8x8x3=192 possible leds on at once @20ma = 3.84A - this will fry my chipkit !!!) so I'll use a separate supply. Note I won't get near the 3.8A as I'll be using dot correction to reduce some of the power requirement, I'll also be very unlikely that all leds and all colours will be on at once. Some rough calculations I made indicate that max power will be in the region of 1 - 1.5A to each layer.

    Idea is that the 3.3V + signal from a chipkit source will drive an npn transistor on. In turn this will send the gate of a Pchannel Mosfet low and allow the mosfet to draw current from the 5v to the anode layers.

    Note - only one of the transistor/mosfet pairs will be on at any one time as the inputs from the chipkit will cycle through and send each input high in turn before turning it low and then turning on the next input.

    Questions>
    1. Will the circuit work?


    2. Will these switched pairs turn on/off fast enough to support Persistence of Vision displays?. I've read about the capacitance characteristics of the IRF5210s but am not sure at the speeds I need to multiplex this will be an issue. - I'm not too sure also exactly what speeds I will need - I just thought I'd go as fast as the Chipkit would allow me with an ISR driving the inputs.?

    3. I've seen so many conflicting articles about the requirements for pull up resistors and also resistors in series with the transistors and the chipkit that I am thoroughly confused about a) whether they are needed and b) what values they should be. I've seen so many variants on these from 100s of ohms to megaohms? Can anyone explain exactly what these do and a rational as to what are reasonable values. (note the 2k2s I've used seem to be about the most common I've seen)

    Really hope that someone can provide me with some input to help .

    Kind regards

    Russell
     

    Attached Files:

  2. duke37

    duke37

    5,230
    718
    Jan 9, 2011
    A pull up resistor is to pull up the output when no current is pulled through it.

    The base resistor is to limit the base current into the transistor. The transistor will need about 0.6V to turn it on and with 3.3V source, there is 2.7V to drop. A resistor of 2k2 will give a current of about 1mA. This will be multiplied by the transistor gain to pull the collector low.
    Resistors in the megohm range will only be used with fets whee the input current is negligible

    Your circuit will turn on all fets when any one of the inputs goes high so only one input line will be needed.
     
  3. rjamjb

    rjamjb

    50
    1
    Jan 19, 2013
    All Fets on

    Ahh - yes, a problem with all the Fets coming on at once. I want to be able to control each layer separately and hence will need 8 inputs to control each of the 8 layers. I need to redesign this bit of the circuit. All other questions are still valid - very good observation on that point. I will re-post once I've rejigged this.
     
  4. rjamjb

    rjamjb

    50
    1
    Jan 19, 2013
    Here is the revised circuit - each transistor/Fet pair is now separately controlled and the Fets will not conduct unless the associated transistor is pulled high.
     

    Attached Files:

  5. duke37

    duke37

    5,230
    718
    Jan 9, 2011
    Another possible problem.
    The IRF5210 can have a source/gate threshold voltage up to 4V. With a 5V source and 0.5V drop across the transistor you could have only 0.5V to turn on the fet. The fets are powerful and this may be enough but will need checking. Normally, 10 or 12V would be used to switch the fet.
     
  6. rjamjb

    rjamjb

    50
    1
    Jan 19, 2013
    Fet Voltage

    I have a 12v regulated supply rated at several amps so I think I will just replace my 5v source with that. Bit of a shame as I had a 5V/3.3V dc/dc converter and I was going to use that to power the chipkit. I'll find another way to do that instead.
     
  7. BobK

    BobK

    7,631
    1,657
    Jan 5, 2010
    Bad idea. You are going to waste a lot of power in your resistors if you use a 12V supply to light that many LEDs. Find a logic level mosfet than can be fully turned on with 5Vand stick with the 5V supply.

    Bob
     
  8. rjamjb

    rjamjb

    50
    1
    Jan 19, 2013
    Bob, can I clarify which resisters you refer to?. I'll look for a logic level Mofset that might suit - I've been wondering whether the IRF5210's would switch fast enough anyway although they are rated as 'fast switching'. Bit of a shame as I've already got 8 of them.
     
  9. duke37

    duke37

    5,230
    718
    Jan 9, 2011
    There should be a resistor in series with each led to control the current. The higher the voltage, the more power will be dissipated. In your case, the TLC5940 will presumably do this job but I have not looked up the data.

    The speed at which the fets will switch will depend on the strength of the driver, 100kHz should be possible with no effort. 100Hz seems to be fast enough for persistence of vision to get rid of flickering, 500Hz or so would be a doddle.
     
  10. rjamjb

    rjamjb

    50
    1
    Jan 19, 2013
    I thought that was what you might mean re the led current limiting resistors. I don't think that this is that relevant as the TLC5940 is a constant current sink and so I don't need the resistors for each led, I set an external resistor on one of the pins and it will regulate the current flow for each channel to sink approx 20mA which is ideal.

    Does this change the point about the 12V being a bad idea?

    I'm glad you pointed out the 100hz - this is in the region of what I'd thought but seemed so slow compared with the various clock speeds that I could drive the switches at from my Pic32 that I was beginning to doubt myself.

    At those speeds I don't think that I'll have a problem with the mosfet capacitance affecting the circuit operation too much. As I've got the mosfets i referred to already i think i'll set up a breadboard circuit to test one transistor/mosfet pair to check if the 5v voltage i originally thought of is enough to switch the mosfet. If so then I'll stick to these.
     
  11. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    Let me get this straight.

    You're making a cube. Each face is covered by a grid of 8x8 RGB LEDs, common anode type. A cube has six faces so the whole project could be described as a 6x8x8x3 cube?

    You want to multiplex the cube in six phases, one for each face. Each face has 64 LEDs, each with three colour elements, so you need to drive 192 cathodes. You want to use twelve TLC5940 16-channel current sinking LED drivers for this.

    Please post the part number(s) of the LED(s) you are considering, and links to the data sheet(s). The forward voltages of the elements are important.

    Your "v3" circuit for the positive supply switching MOSFETs will work in principle, but the IRF5210 MOSFET, and most MOSFETs, need more than 5V gate-source bias to saturate properly. You can try to find suitable logic-level MOSFETs but I doubt you will get comparably low ON-resistance with any of them. This is an important consideration here since each of these MOSFETs needs to pass on average 1.5A (your figure) and possibly up to 3.84A.

    The IRF5210, when fully biased with 10V VGS, has a maximum ON-resistance of 60 milliohms. At 3A this translates into a dissipation of 540 mW. This will be shared among six MOSFETs so it's negligible, but when considering suitable MOSFETs, be sure to check the ON-resistance.

    Your circuit diagram shows eight positive supply drivers but a cube has only six faces. Am I missing something?

    Gate capacitance for the MOSFETs will not be an issue if you can drive them at significant current. That means significant positive current to turn them ON, and significant negative current to turn them OFF. Using a passive turn-off circuit consisting of a 2k2 gate-source resistor will slow down the MOSFET turn-off; this could cause ghosting. You can avoid ghosting by following this sequence on every multiplex step: disable all the cathode drivers and turn OFF the currently active MOSFET; wait long enough for the gate-source capacitance to discharge; enable the next MOSFET and re-enable the cathode drivers. You might be able to use the delay to provide time to send new data to the cathode driver chips.

    This is a situation where there is no clear "best way" to go. Another possible solution would be to use N-channel MOSFETs in source follower configuration. N-channel MOSFETs have lower ON-resistance and are cheaper than P-channel MOSFETs for the equivalent performance. Assuming your main LED current supply is 5V, you'll need a supply of around +15V to fully saturate the MOSFETs in source follower configuration, and you can power a MOSFET driver IC, or a discrete MOSFET driver stage, from that rail. That would give excellent performance but with extra cost and complexity.

    There are several factors affecting your best choice. Can you find a suitable logic-level P-channel MOSFET? Do you need fast switch-off? If yes and yes, an improved driver could provide that. I'm not really clear on the best way to go.

    Regarding the question of changing the supply voltage, you should be careful about that. Each LED element drops a certain amount of voltage, and the cathode driver "makes up" the rest of the voltage, while sinking significant current. Using an example of 3V forward voltage for each LED element (and assuming R, G and B have the same forward voltage, which probably isn't true), and a current of 20 mA.

    At 5V supply, each current sink has 2V across it (5V minus the LED forward voltage) and dissipates up to 40 mW (20 mA x 2V). For a 16-channel device this is 640 mW maximum.

    At 12V supply, each current sink has 9V across it, and dissipates 4.5 times more power. 2.9W dissipation for a small IC like that is probably not workable; it will overheat. The TLC5940 is rated for 4W maximum dissipation if you use the "HTSSOP" package and solder the "PowerPAD" to a suitable area of copper. So power levels above 1W will be a problem. Even at only 0.5W dissipation, the package will run 20 degrees Celsius above ambient (assuming a package without a heatsink pad).

    Finally, regarding the multiplex frequency. Total cycle frequency (that is, frequency of the complete six-face cycle) around 60 Hz will probably eliminate visible flicker, as it does in TV sets, but I would aim for at least 100 Hz, possibly dropping as low as 80 Hz if the micro can't quite keep up. Even at this speed, when the cube is moving there will be visible multiplexing artifacts. (Get a digital alarm clock with an LED display and shake it left and right in front of you, to see what I mean.)

    Also you are going to have to update a lot of data on every step of the multiplex cycle; I would do a feasibility check first - you might need a faster processor and/or hardware assistance for the data transfer into the driver chips.
     
    Last edited: Jan 20, 2013
  12. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,191
    2,693
    Jan 21, 2010
  13. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    I see what you mean. In that case yes he will need eight anode drivers.
     
  14. rjamjb

    rjamjb

    50
    1
    Jan 19, 2013
    Yes Steve is right, an 8x8x8 array spaced out so that you can see inside. Each layer is turned on and off again in turn and this cycles through the layers fast enough to use PoV techniques. Each layer's anodes are all connected and each column consists of three cathode columns for each colour. Using pov I will be able to create moving patterns through the cube.

    At 20mA constant current the LEDs are to bright so I'll be using dot correction to reduce them by about 40%, also I won't have any animations with all white layers so won't have a whole layer on at once. This is why my practical current is only around 1.5A max (not average). Just to be on the safe side perhaps a working round up would be 2.0Amps max.

    Each mosfet/transistor pair will only be 'on' by themselves as the cycling off and on's turns each pair 'on' then 'off' before moving to the next pair.

    Your comments on the ghosting and the time for turn off are very key - I'd like to be able to have very clean off/ons to allow nice crisp displays. A couple of thoughts. 1. Could I use a second transitor, presumably a pnp type, which actively drives current high on a low signal to switch the mosfet off? (If i can get my head around how to wire that one up :) ) - (this way i am using two tranistors - one to turn the mosfet on and one to turn it off) 2. What are the advantages/disadvantages of reducing values of the 2.2k resistor to speed up switch off. Your comment about 'waiting' for complete switch offs then moving to the next layer I guess will depend on whether that can still be done fast enough to preserve PoV. If these idea's don't work then I guess I'll either 'try and see' on the basis that to swap out 8 mosfets if they don't work isn't too bad a thing or if this is definitely going to be a problem (ghosting) then I'll look for some suitable logic level mosfets

    I'm not very keen on the extra power considerations of using 12V so have made a decision and will stick with my original 5V - added benefit is that I can use the 5v - 3.3v DCDC converter I already have and use that for the chipkit.

    I'll be using bit banging and/or spi for the data transfer and believe that this will be ok for the speed. I'm still working on the software side but have seen similar cubes run off the chipkit so am confident in this part.

    Russell

    fyi on the leds

    Forward
    Voltage(20mA) Min Typical Max
    Red 1.9 2.1 2.3
    Blue 3.0 3.2 3.4
    Green 3.0 3.2 3.4

    Reverse voltage 5V

    Absolute max ratings
    Peak forward current 20mA
    Power dissipation 100mW
     
  15. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    OK, so you have eight "slices", each containing 8x8 RGB LEDs, and the anodes of all 64 LEDs in one slice are commoned and driven by one of eight MOSFETs.
    So each slice has 192 cathodes, right? And you will be driving these using twelve 16-channel driver ICs?

    As far as persistence of vision is concerned, that's what I was talking about in relation to the multiplex frequency. If you can get through the full cycle of eight slices at a rate of 80 Hz or higher, persistence of vision will make it look like the lights are steadily ON, although you will still get the multiplexing artifacts as I described.

    To get through a complete cycle of eight slices 80 times per second, each slice has to be active for one 640th of a second, or 1.5625 milliseconds, preferably a bit faster. That doesn't give you a lot of time to calculate the brightness values for 192 cathodes and send them to the cathode drivers. Have you checked the feasibility of doing this?

    The LEDs may be too bright at 20 mA but remember when you're multiplexing by eight, they will get eight times dimmer than they are when driven with a continuous current.

    Yes, I was going to suggest that next. I was waiting for you to confirm that you can find suitable P-channel MOSFETs. I've found a few dual devices that look pretty good and are cheap:
    IRF7329 USD 1.76 17 milliohms at VGS=4.5V http://www.digikey.com/product-detail/en/IRF7329TRPBF/IRF7329PBFCT-ND/812599
    SIA923 USD 0.73 54 milliohms at VGS=4.5V http://www.digikey.com/product-detail/en/SIA923EDJ-T1-GE3/SIA923EDJ-T1-GE3CT-ND/2442099
    DMP2035 USD 0.64 35 milliohms at VGS=4.5V http://www.digikey.com/product-detail/en/DMP2035UTS-13/DMP2035UTS-13DICT-ND/2355964
    Edit: here's another:
    SI4931DY-T1-E3 USD 1.00 18 milliohms at VGS=4.5V http://www.digikey.com/product-detail/en/SI4931DY-T1-E3/SI4931DY-T1-E3CT-ND/1656998

    What is the voltage swing at your I/O pin? I'll draw up a circuit for a driver.

    Persistence of vision is not an issue; it's guaranteed by the multiplexing frequency.

    With a two-transistor driver you will get very quick switching and the issue of changing the 2K2 resistor will be moot.

    Good.

    It's definitely worth checking. Calculating and then transmitting 192 multi-bit brightness values in 1.5 ms isn't as easy as it sounds. (Does it even sound easy?)

    Regarding the LEDs, you will be OK with a 5V supply. The cathode driver chip needs at least 0.4V on the cathode otherwise it may flag an open-circuit LED; for safety, assume 0.5V. Add the maximum forward voltage, 3.4V for green or blue, you have 3.9V which is safely under 5V. Power dissipation in the cathode drivers will be reasonably low.
     
    Last edited: Jan 20, 2013
  16. rjamjb

    rjamjb

    50
    1
    Jan 19, 2013
    OK, so you have eight "slices", each containing 8x8 RGB LEDs, and the anodes of all 64 LEDs in one slice are commoned and driven by one of eight MOSFETs.
    So each slice has 192 cathodes, right? And you will be driving these using twelve 16-channel driver ICs?


    Yes - that's precisely it.

    To get through a complete cycle of eight slices 80 times per second, each slice has to be active for one 640th of a second, or 1.5625 milliseconds, preferably a bit faster. That doesn't give you a lot of time to calculate the brightness values for 192 cathodes and send them to the cathode drivers. Have you checked the feasibility of doing this?

    You've mentioned this a couple of times and I am primarily basing my approach on the fact that it has already been done. I've a few thoughts on approaches to this that I think will work. 1. I will try to keep RGB in three chains of four TLCs and load these simultaneously with data. 2. I will use an interrrupt routine to switch and load each layer. The main programme will maintain an 8x8x8x3 array of bits/bites/part bites (whatever I work out!!) which will form the basis of the patterns. The interrupt routine will just load whatever is in the array for the relevant layer at the time it is called. It won't matter if the array hadn't quite been updated to the next animation 'frame' when the ISR is called it will just happen on the next cycle. The animation movement will be so slow compared to the switching speed that updating the animation so very precisely will be unimportant. (hope this makes sense).

    What I need to check therefore is that can I load 192 x12(chips) bits of data to the chips (no calculations required, just the routine to move the data) inside an ISR quickly enough to provide pov - I think that this should be eminently doable using spi/bitbanging - (will sit and do the working out though as I work through the programming requirements.

    The 1/8th time dimming is also a very valid point. With some small scale tests on a breadboard I still managed to get very bright leds and had to use dot correction to reduce total power even on a 1:8 duty cycle. This is all about compromise - to keep the innards of the cube as clear of leads/connections as possible and manage power to a reasonable level this is just a consequence (imagine trying to drive the whole cube with direct power to each led = 8x8x8 leds x 3 colours x 20ma = >30Amps !!! I wouldn't want to go near that - although it might make a surrogate for my central heating system !!!! :eek:).

    What is the voltage swing at your I/O pin? I'll draw up a circuit for a driver.

    3.3V - perfect for both the chipkit and the TLCs. I'd be grateful for a diagram with the IRF7329. These costs are very reasonable especially as you only will need 4 !!

    With a two-transistor driver you will get very quick switching and the issue of changing the 2K2 resistor will be moot.

    Perfect
     
  17. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    [​IMG]

    WARNING! THIS CIRCUIT HAS SEVERAL PROBLEMS AND I DON'T RECOMMEND IT!

    Here's a way to drive a P-channel MOSFET that will switch it very quickly and cleanly.

    Q3 is the main P-channel MOSFET. I've shown it as half of a DMP2035UTS dual P-channel device, which has good specifications (35 milliohms ON-resistance) and is cheap. The gate is driven by both Q1 and Q2. As you can guess, Q1 turns it ON and Q2 turns it OFF. Q1 and Q2 are shown as discrete components but you could also use a dual P-N MOSFET array such as the ON Semiconductor NTJD4105C to save space.

    R3 and R4 limit Q3's gate current and also the "shoot-through" current that flows through Q1 and Q2 during the extremely short time that they are conducting simultaneously during the transition from one state to the other. With 22R+22R the shoot-through current will be a bit over 100 mA.

    Q2's gate drive needs a DC offset, which is provided by the three diodes in series. (Any standard small-signal silicon diode will work here.) Without these diodes, when the circuit's input was high at 3.3V, Q2 would still see 1.7V gate-source bias so it would conduct at all times. C1 ensures that Q2's gate is forced towards +5V when the circuit's input goes high, so its gate swing is not delayed by its gate-source capacitance discharging into R2.

    R1 ensures that the circuit defaults to OFF while the driving circuit is tri-state or disconnected.

    Edit: It's very important that the input signal switches quickly and cleanly, to minimise the shoot-through time when Q1 and Q2 are ON simultaneously. If this can't be guaranteed, use a Schmitt trigger buffer on the input.
     

    Attached Files:

    Last edited: Feb 21, 2013
  18. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    I understand but that's wrong. On every multiplex phase, you need to clock a full set of new data into the cathode drivers. The only exception would be if every slice was displaying an identical pattern.

    Remember with multiplexing that you have to drive each slice in sequence, in a loop. On each change of the multiplex phase, you have to disable the driver MOSFET for the current slice, output new data to the cathode drivers for the slice that's about to be enabled, and enable the driver MOSFET for the next slice.

    The cathode driver chips can presumably be updated ready for the next multiplex phase DURING the current multiplex phase, and the final data can be latched in at the right instant, but this still only leaves about 1.5 ms to load them all each time.

    That raises another point. You need to get 192 cathode connections into each slice. How are you going to do all that wiring?

    Just one column of one slice needs 24 cathodes and an anode, and the full slice has eight columns, for 192 cathodes total! Those 192 cathodes will be commoned up with the 192 cathodes of each other slice.

    I had assumed you would use the DMP2035 since its ON-resistance is not that much higher and it's significantly cheaper. But the IRF7329 will work just as well.

    Edit: The SI4931DY has almost the same specs as the IRF7329 but quite a bit cheaper. See edit in my earlier post.
     
    Last edited: Jan 20, 2013
  19. rjamjb

    rjamjb

    50
    1
    Jan 19, 2013


    Here's a way to drive a P-channel MOSFET that will switch it very quickly and cleanly.

    This is great - i can see how it works I'd even worked out in my head that I'd have to put in a diode somewhere so kind of feeling good about the overall approach. There are a couple of questions I have. 1 Why three diodes in series ? Doesn't one just do the same job?. I'd omitted the cap from +5 to 0 in my diagram for simplicity as I wanted to check the logic - I'd also intended to put a small cap between +3.3V and 0. Thoughts on this latter cap?

    Edit: It's very important that the input signal switches quickly and cleanly, to minimise the shoot-through time when Q1 and Q2 are ON simultaneously. If this can't be guaranteed, use a Schmitt trigger buffer on the input.

    This is possibly an issue in another way also. The TLC is very sensitive to stray noise. On my breadboard I could even effect its performance by holding my hand close to some of the wiring. I tightened up the wiring and laid out in short straight wires and that eliminated the noise. When I put the whole circuit together I will separate the power side inputs from the TLC circuits. I'll address this point by putting together circuitry for a single layer and then testing performance with my scope. Maybe I'll just use a shmitt trigger anyway as an extra safety comfort factor.

    Re the mosfet, I will definitely defer to your far far better qualification to comment on these things than I and will use the DMP as you suggest.
     
  20. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    No, they're used as voltage droppers. A forward-biased silicon diode drops about 0.6~0.8V depending on the current flowing through it. Three of them adds up to about 2V. So with a 3.3V/0V swing at the circuit input, the gate of the top MOSFET swing will be about 5.3V/2V. The MOSFET sees a negative gate-source voltage of -0.3V/3V. (The -0.3V causes no problems.) This will make the MOSFET switch cleanly.

    You could replace them with a zener diode, but zeners aren't readily available below about 2.4V and they have higher leakage and they're more expensive. So...

    Definitely. You can never have too much supply decoupling.

    The reason I put a 1uF MLCC across the 5V rail near the MOSFETs is really the shoot-through current (100 mA) and the gate current (up to 200 mA peak). As long as these currents are brief, i.e. the driver MOSFETs switch quickly, the capacitor will easily bear the brunt of these current bursts and prevent spikes being introduced onto the power rails.

    Decoupling the 3.3V rail is a separate issue, and it couldn't hurt.

    Definitely keep the high-current wiring and current paths away from the microcontroller.

    I don't know what a TLC is. I assume you mean the controller?

    Edit: Oh, you mean the cathode driver chips. They shouldn't be sensitive to noise. Make sure there are no unconnected inputs!

    If moving your hand close to the wiring was affecting the circuit's behaviour there is probably something wrong with the circuit. After all, you're not operating at radio frequencies! Try to quantify and qualify the problem, and upload a schematic. There may be a simple mistake in there.

    It's just a suggestion. I thought both the 35 milliohm or the 18 milliohm ones would be good and were both good value for money. If you're only building one unit, a few cents here and there is not an issue anyway.
     
    Last edited: Jan 20, 2013
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-