Shop OBEX P1 Docs P2 Docs Learn Events
Looking for recommendation of LED driver with individual LED PWM control (not / — Parallax Forums

Looking for recommendation of LED driver with individual LED PWM control (not /

T&E EngineerT&E Engineer Posts: 1,396
edited 2009-04-13 11:52 in General Discussion
I'm starting to look into designing a single color LED module perhaps 16x8 (and later RGB). It is not going to be matrixed based just individual outputs of 16 LEDs or so. The biggest problem I have had to deal with is with SPI based·LED driver chips that do not have PWM control built in. Figureing out from the manufacturer from·how to create PWM (e.g. 256 shades) from /OE on these cascaded chips (e.g. 16 outputs per chip in a·16x8 module would be 8 chips·for 128 LEDs) - has been extremely difficult to implement. I can only get the 'entire' 128 LEDs to shade and NOT individual LEDs via the SPI interface.

I have looked at datasheets from Allegro, Toshiba, and MBlock (china). However, today I saw the TLC59116 from Texas Instruments. This is I2C based not SPI and states in their datasheet that PWM is individually programmable per LED output. This sounds very promising.

http://focus.ti.com/lit/ds/symlink/tlc59116.pdf
http://focus.ti.com/docs/prod/folders/print/tlc59116.html

Has anyone worked with this TLC59116 or have any other recommendations?

Thanks.

Comments

  • JasonDorieJasonDorie Posts: 1,930
    edited 2009-04-06 19:23
    Have you looked at the TLC5940? It's a 16 channel, constant current sink, and 12-bit per channel PWM. You have to clock it which is a minor annoyance, but it's otherwise pretty easy to work with, and can be daisy chained as well, so your driver code only talks to one chip, even though you've got 3 or 4 ganged together - You just send more data. The chip was designed for doing things like full color LED displays, and can sink a fair bit of current, too.

    http://focus.ti.com/lit/ds/symlink/tlc5940.pdf

    It's also worth noting that Timothy Swieter created a driver for it (you can get it from his site at www.BrillDea.com·under LED painter) and I've ported that driver to PASM if you want it.

    Jason


    Post Edited (JasonDorie) : 4/6/2009 7:29:45 PM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-06 20:41
    Is there any reason for not matrixing the LEDs? If you did, it's someting the Propeller could easily handle on it's own with 16 NPN column drivers and 8 PNP row drivers (or vice-versa).

    -Phil
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2009-04-06 21:39
    I want to stick with I2C or SPI LED driver chips so using a matrix would complicate things having to use an interrupt, etc. I have to also be able to cascade the 16x8 (or 128 LED) modules together. I have an idea of something I am already working with but does not have an easy PWM solution so I want to redesign that part so I can control what is happening at an easier level.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-06 22:49
    The TLC5940 is $4.28 (qty. 1), and it would take eight of them per cascadable 16x8 module. The Propeller is $7.99 (qty. 1), and it would only require one per module, plus an EEPROM, crystal, and six quad transistor drivers. What I'm getting at is that the Propeller could be your I2C or SPI driver chip for one entire 16x8 module with less cost and board space.

    -Phil
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2009-04-06 22:55
    Yes but these chips have built in PWM control. I have had too many hard times trying to figure out PWM and want to go with the built in solution. Has anyone done this with PWM (256 shades for R G and B) on a propellor for a 16 x 8 matrixed display?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-07 01:56
    Probably not yet, but I'm confident that it can be done. Therein lies the opportunity!

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-07 07:10
    Okay, I couldn't resist. Here's a program that uses ten pins to drive a 5x5 subsection of a 5x7 LED array. (It's the only one I had.) Each pixel can have an individual intensity (0 - 255) assigned to it, and the 25 intensities are double-buffered. Pins 0-4 drive the cathodes through 75-ohm resistors; pins 5-9, the anodes directly. OUTA is set once to %11111_00000 and all addressing/PWMing is done through DIRA. The PWM frequency is about 320Hz. Here's the code:

    [b]CON[/b]
    
       [b]_clkmode[/b]       = [b]xtal1[/b] + [b]pll16x[/b]
       [b]_xinfreq[/b]       = 5_000_000
    
    [b]VAR[/b]
    
      [b]byte[/b]  inten[noparse][[/noparse]­25], inten_wk[noparse][[/noparse]­25]   
    
    [b]PUB[/b]  Start | i, j, p, d
    
      'Start the driver cog.
      [b]cognew[/b](@led_driver, @inten)
    
      'Generate a moving wave pattern.
      [b]repeat[/b]
        [b]repeat[/b] p [b]from[/b] 255 to 0
          [b]repeat[/b] i [b]from[/b] 0 to 4
            [b]repeat[/b] j [b]from[/b] 0 to 4
              d := (^^((i * i + j * j) << 11) + p) & $ff
              inten_wk[noparse][[/noparse]&#173;i * 5 + j&#093; := d
              inten_wk[noparse][[/noparse]&#173;j * 5 + i&#093; := d
          [b]bytemove[/b](@inten,@inten_wk, 25)
    
    [b]DAT[/b]
    
                  [b]org[/b]       0
    led_driver    [b]mov[/b]       [b]outa[/b],[b]outa[/b]0              'Initialize output register.
    
    :mainlp       [b]mov[/b]       pwm,#255                'Initialize PWM value.
    
    [img]http://forums.parallax.com/images/smilies/tongue.gif[/img]wmlp        [b]mov[/b]       varptr,[b]par[/b]              'Point to beginning of intensity array.
                  [b]mov[/b]       col,#%00001_00000       'Initialize the column bit,
                  [b]mov[/b]       colcnt,#5               '  and count.
    
    :collp        [b]mov[/b]       row,#%00000_00001       'Initialize the rwo bit,
                  [b]mov[/b]       rowcnt,#5               '  and count.
                  [b]mov[/b]       diranxt,col             'Initialize the next dira value.
    
    :rowlp        [b]rdbyte[/b]    value,varptr            'Get the next intensity value.
                  [b]add[/b]       varptr,#1               'Increment the pointer.
                  [b]cmp[/b]       value,pwm [b]wc[/b]            'Is value => pmm?
                  [b]muxnc[/b]     diranxt,row             '  If yes: or a 1 into next dira at row position.
                  [b]shl[/b]       row,#1                  'Shift the row position.
                  [b]djnz[/b]      rowcnt,#:rowlp          'Go back for next pixel in row.
    
                  [b]mov[/b]       [b]dira[/b],diranxt            'Row complete. Copy to dira.
                  [b]shl[/b]       col,#1                  'Shift the column position.
                  [b]djnz[/b]      colcnt,#:collp          'Back for the next column.
    
                  [b]djnz[/b]      pwm,#[img]http://forums.parallax.com/images/smilies/tongue.gif[/img]wmlp             'Back for the next PWM value.
    
                  [b]jmp[/b]       #:mainlp                'Start all over.
    
    [b]outa[/b]0         [b]long[/b]      %1111100000
    
    varptr        [b]res[/b]       1
    pwm           [b]res[/b]       1
    col           [b]res[/b]       1
    colcnt        [b]res[/b]       1
    row           [b]res[/b]       1
    rowcnt        [b]res[/b]       1
    diranxt       [b]res[/b]       1
    value         [b]res[/b]       1
    
    
    


    Attached is a short movie that shows the program in action.

    For your application, you'd use 24 pins for 8x16 pixels and drive them through transistors, so you could have more current. You would be able to attain at least a 62Hz PWM rate, which would still be flicker-free. If you could settle for a 7-bit PWM, that rate would double to 124Hz or more.

    -Phil
  • T&amp;E EngineerT&amp;E Engineer Posts: 1,396
    edited 2009-04-09 15:17
    Thanks Phil for putting that together but I beleive I want a dedicated LED driver with PWM.

    However, I found the NXP (Philips) PCA9535 which is I2C and almost identical to the TI chip TLC59116. But the NXP PCA9535 can connect up to 126 I2C devices while the TI TLC59116 can only connect up to 14 I2C devices. Hmm.



    Since the PCA9635 can handle up to 126 I2C devices (e.g. additional PCA9635 LED drivers), this accounts for about (16x126 = 2016 LEDs). For an RGB version of my 16x8 LED module, it would have 128 * 3 LEDs = 384 LEDs. So that means I can have ~5 16x8 module (e.g. 2016/384 = 5.25 or ~5). OK so that means I can only have 5 modules left and right for my columns for RGB. I was thinking that for Rows of modules I would just use more ports on my AVR controller for the SCL and SDA lines for a separate I2C bus per module row.

    However only having 5 (16x8) modules for columns (eg left and right), it would not be enough for a large sign.

    So my question is, How does one get around this limitation on the I2C bus?

    Can a multiplexor be used for I2C? Any recommendations for this NXP part?

    Should I just stick with SPI and clock the data out in an unlimited fashion. I like being able to control a specific LED output that can be easily done with I2C with PWM?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-09 17:02
    T&E Engineer said...
    ... but I beleive I want a dedicated LED driver with PWM.
    The point I was trying to get across is that the Propeller can be a "dedicated driver with PWM", and for less cost than specialized hardware. Multiple units can be bussed using I2C, SPI, or whatever protocol you want.

    -Phil
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-04-09 23:51
    I recommend any of the following for LED Drivers:

    TI TLC5940 as Jason pointed out. I have used this a lot and find it easy to use, the interface is SPI like with an added gray scale clock. Just clock out the data and you are done. focus.ti.com/docs/prod/folders/print/tlc5940.html

    TI TLC5946 This is similar to the above, but you don't have to have a high voltage to adjust the gray scale of the device. I have a couple ideas cooking that may use this. focus.ti.com/docs/prod/folders/print/tlc5946.html

    Allegro A6281 This is a way cool IC with three channels of LED control at 10 bits with the PWM function built in. The IC are daisy chainable like other IC, but the best part of this IC is that it operates on the LED voltage supply - in other words no need for an LED supply and a logic supply with this IC. Unforntunately this IC is in very small packages. I have a product coming out next week that uses this IC. www.allegromicro.com/en/Products/Part_Numbers/6281/

    I have used the PCA9535/PCA9555 as general purpose I/O expansion devices. I have tried to do LED dimming with this, just blinking and it works OK. You would really need a high speed driver to PWM the LEDs using I2C.

    Oh yes, I agree with Phil too on using the Propeller as the LED driver. That is another product designed that I hope to have ready by middle of May or first of June.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • T&amp;E EngineerT&amp;E Engineer Posts: 1,396
    edited 2009-04-10 12:31
    Timothy,

    Do you know of any that are 24 bit? (e.g. Red 8, Blue 8, Green 8). Am I looking at this wrong?·These are all 8 or 16 bit and I want to be able to incorporate video data?



    I like the Allegro A6281 which I believe would have 10 bits of PWM per channel (over 1B colors?)


    Post Edited (T&E Engineer) : 4/10/2009 12:43:38 PM GMT
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-04-10 13:50
    The Allegro is 10 bit per channel. The TLC5940/5946 are 12 bits per channel each for 16 channels. TI has a selection of many LED controllers, you might be able to find one with just 8 bits per channel.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • JasonDorieJasonDorie Posts: 1,930
    edited 2009-04-10 20:06
    The TI TLC5940 is 12 bit per channel, but you can just shift zeros into it at the driver level (as Timothy does in his LED Painter code) to pad a lower bit count up to the 12 bits required. The driver doesn't care what the channels are, so to drive 16 RGB LEDS you need 3 x 16 channel chips. That would give you 12 x 3 = 36 bit color.

    Jason
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-04-11 23:29
    T&E Engineer - I made a post in the Propeller thread regarding the A6281 and a product I designed around it. There is a driver there that I wrote for the Propeller.

    http://forums.parallax.com/showthread.php?p=798821

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • T&amp;E EngineerT&amp;E Engineer Posts: 1,396
    edited 2009-04-13 11:33
    Thanks for the excellent information!

    Another factor is the footprint for ExpressPCB. I don't see any of the surface mount parts listed. What design tool do you all use. I am starting to like the Allegro and the TI (SPI) parts more and more.

    So if you have 10 or 12 bits or PWM and only need 8 bits do you just not use the remaining bits or write the code in to utilize it anyway (e.g. won't hurt)?

    BTW: As I have already invested quite a bit into this ... I will probably design this·with my new MikroElektronika BigAVR2·board in MikroPro C. It·uses an ATmega2560 so there is plenty of horsepower to do this.



    Thanks again!


    Post Edited (T&E Engineer) : 4/13/2009 11:38:51 AM GMT
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-04-13 11:52
    T&E -

    I use Eagle myself, so I can't say what footprints are in ExpressPCB, but surely they would have some SMT parts like SSOP or TSSOP. If you are leaning towards the TI route, consider the TLC5946, if you can manage the surface mount package. With the TLC5946 you can adjust the dot correction with logic levels, if needed.

    As far as the bits count you are asking about, I have done it both ways. Sometimes I scale the input value to the register, but most times if I don't require the control I simply pad the number with zeros. For instance if I only need 8-bits and there is 10-bits available I will put 2-bits on the end. It remove a little control at the low-end, but may not be needed depending on your design.

    Oh yeah - plenty of horsepower in the ATmega2560.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
Sign In or Register to comment.