Shop OBEX P1 Docs P2 Docs Learn Events
Power on the Propeller — Parallax Forums

Power on the Propeller

RambomanRamboman Posts: 101
edited 2010-10-19 02:35 in Propeller 1
I am building a 8*8*8 led cube for Xmas.
I planned to drive it like a 16*32 matrix.
Column of 16 driven by pins 0..15
Each·of 32 column being multiplexed from pins 16..20 thru two MMC74HC154 4-to-16 Line Decoders.
The last having very low output capacity, I planned to use four ULN2803APG Darlington Drivers.
That does not work...
Simplifying the whole design, I connected the ULN2803 directly to the Propeller...
It does not work either...
The Propeller lights a LED on, but with much less power than connected to the Propeller directly.
More, the Propeller is unable to shut the LED off.
I don't understand, HELP please.
If there is a compatibility problem, what should I use behind the Line Decoder to power up to 16 LEDs?
·

Comments

  • LeonLeon Posts: 7,620
    edited 2009-11-12 17:22
    Use 74HC595s instead of the 74HC154s.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
  • kwinnkwinn Posts: 8,697
    edited 2009-11-12 23:41
    Try 4 74HC595's to drive 32 leds per row and 2 TPIC6595's to drive the 16 columns. The TPIC is a combination of 74HC595 and ULN2803 driver so each of the output pins of the PIC's would connect to the cathodes of the 32 leds in a row.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-13 01:23
    The 154's outputs are active low and if you try to drive a 2803 directly it will turn them all on except for the one selected, so this is not good. As suggested forget about "decoders" and just use shift-registers. The TPIC chips are very good for driving the cathodes but with 512 leds you will need a bit more oomph as even if you divide that up into 16 columns then each column would be on for 1/16 of the time (should be). So your peak current will be 32 leds * 5ma (compromise) = 160ma * 16 (to achieve normal 5ma brightness) = 2.56amps on the column driver, so TPICs are out. Also the row driver must drive to 5ma * 16 to achieve the normal (static condition) brightness of 5ma so that means each row driver must handle 80ma.

    Conversely, 512 leds @5ma = 2.56amps

    Of course you could drop the average current to 1ma and 74AC595's and TPICs could handle it ok then.

    P.S. Of course you probably wouldn't have all leds on but this approach allows that nonetheless. You will need to figure out the best configuration for the cube which has 6 sides, not 8.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Michael O'BrienMichael O'Brien Posts: 55
    edited 2009-11-13 03:35
    Ramboman,
    ·· Hi,·Sounds like a very interesting and excellent project - I would like to see pictures when you are done.
    · ·I think you may need to multiplex the display.· You will have a solid cube of 8 planes of 8 x 8 leds right?· It would be nice if you could multiplex only 1 dimension (a plane at a time) instead of 2 (8 columns by 8 planes or 64 columns).· The most LED's I have had on was 80 and that used up to 1.2A without resistors.
    ·· I have sucessfully driven 512 leds using 2 cogs from a propeller as 4 chips of 8x8 bi-color leds - each cog took care of a single color.
    ·· I found that brightness was best by sweeping 8-16 columns at a time.
    ·· I used hc595's or 374/574's as data lines and hc154 or hc138's as column drivers (active low)·- so in my case i needed 4 sets of (D, CCLK, RCLK) lines to the 595's and 4 column lines to the 154 for a total of 12 + 4 = 16 output lines.
    ·· Keeping the propeller isolated from driving either end of the LED's is important.
    ·· If you are carefull you will not need current limiting resistors using a 595/154 combination as there is enough resistance present to limit the current.· When the clock is off the single columns of LED's are very bright - but multiplexed they look fine.· The only issue is that without resistors - all 8 leds in a column share a single resistance - hence led brightness will slightly vary based on the # of lit leds on a column.

    ·· Here are photos of the 512 grid using TTL 74154's and a 3x8x8 grid using 374's with no resistors

    ·· thank you
    ·· /michael
    2272 x 1704 - 823K
    1024 x 768 - 241K
  • RambomanRamboman Posts: 101
    edited 2009-11-13 05:18
    Thank you for your support; my project is probably too ambitious...
    Last year I have build a multicolored led ball with 40 bicolor leds driven by one propeller only.
    The leds are driven as a 8*10 matrix.
    This year, my wife would like a cube, a big large cube ;-]
    With the 28 available pins, the largest matrix we can build is 14*14 i.e. 196, so the largest cube 5*5*5.
    The power of the propeller is high enough for 16 leds at the same time.
    So my idea is to do that and multiplexing 32 column 16*32 i.e. 512, a cube of 8*8*8.
    I would prefer the hc154, because I understand it's use...
    What I don't understand is the fact that the propeller is unable to drive a ULN2803...
    What would be an appropriate replacement for the ULN2803?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-13 05:33
    The 2803 should work fine driven from 3.3V however the 2803 is a darlington driver which means that the output transistor will drop a minimum of 0.8V to around 1V. Bear in mind that the other drivers you are using aren't rated for the current and so while they may seem to work they will be dropping voltage too. Add in the LED forward voltage drop and you may find that if your voltage is too low then nothing will work.

    My advice, skip the direct drive approach from the Propeller or from 74HC logic. The 154 is useless for any of this work but use it if you like punishing yourself. Use TPICs for the cathodes and TPICs to drive PNP transistors for the anodes and make sure you have a separate supply for this that is not a logic supply, maybe around 6V or so.

    Use a common 2N2222 for switching instead of 2803s, you can drive them directly and they will have a lower saturation. There are a lot of other transistors better suited though.

    BTW, shouldn't your matrix fit in with the 6 sides of a cube (or 5 if sitting on top of a surface)?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-11-13 05:54
    I bought some high brightness leds recently and they really were high brightness. My eyes started hurting. I tried 220R (5V supply) then 1k then 2k2 and it took a 10k resistor before they looked the same brightness as a standard looking led. I wonder if it might be worth experimenting with high brightness leds and higher than traditional dropping resistors? Just thinking that then you could drive the leds directly off 74HC chips. A 74HCxx should be able to drive 8 leds via 2k7 resistors.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/build
  • RambomanRamboman Posts: 101
    edited 2009-11-13 06:28
    @Peter
    My cube is based on eight 8*8 grids
    The grids are connected as 16*32
    By experience I now that I can drive 80 LEDs with one Propeller without add'l component
    With the available pins I now I would be able to go up to 196
    I want to keep electronics as simple as possible and to understand what I do
    I am not an experimented programmer
    May be an alternative would be to use a master and a slave propeller coupled with spi...
    Using 24 i/o per propeller in a 24*24 matrix, I do it...
    Keep It Simple and Stupid!
  • kwinnkwinn Posts: 8,697
    edited 2009-11-13 06:32
    I was also thinking of high brightness leds when I posted my earlier answer. As for powering the LED array, I usually do that from the unregulated voltage on the input to the 3.3 or 5V regulator.
  • RambomanRamboman Posts: 101
    edited 2009-11-14 06:21
    kwinn said...
    Try 4 74HC595's to drive 32 leds per row and 2 TPIC6595's to drive the 16 columns. The TPIC is a combination of 74HC595 and ULN2803 driver so each of the output pins of the PIC's would connect to the cathodes of the 32 leds in a row.
    @kwinn
    There is a nice object in the library to drive the 74HC595, I understand it (not the content)
    May I suppose I can use the same object for the TPIC6595?

    ·
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-14 07:24
    The TPIC looks like a fairly standard shift register and works the same (in this case) as the HC595 with rising edge clocks but of course the bits in the TPIC turn on the outputs so that they are low (active) vs HC595 which is high. So set your data bits to a 1 to turn on the output.

    Anyway, just cascade the shift registers using the SER OUT pin to the next SER IN pin and change the 595 object to shift 16 bits of data.

    Better idea!
    You could just write a simple driver in Spin as you only want one column output on (low) at a time. Clear the shift register beforehand either directly or by clocking 32 zeros in quickly and load. To turn on one output at a time (just like a 154!) start by sending a single 1 then a clock pulse (high then low) after which the other 15 clock pulse have the data line set to zero. So every time you pulse the clock (and then pulse the load clock) you will find that the next output will turn on and the previous off.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • RambomanRamboman Posts: 101
    edited 2009-11-14 07:29
    Thanks, Peter!
  • RambomanRamboman Posts: 101
    edited 2009-11-17 08:54
    @Peter
    I can't upload my drawing, so I try to explain it:
    -· two TPICs feeding the plus point of the LEDs from 2 LiFe (6.6V, 4500mAH)
    -· rotating to feed one line of 32 LEDs·at a time
    -· four·HC595 feeing the minus point of the LEDs thru a current limiting resistance
    -· feeding up to 32 LEDs at a time
    Is this·design OK?
    For programming (in Spin):
    -· a table of 16 LONGs, one bit per LED, managed by the main PUB
    -· a multiplex PUB·in a new COG, running·the 2 TPICs and the 4 HC595s (2*3pins)
    Thanks for your support
    Roland
    ·
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-17 09:23
    Ramboman said...
    @Peter
    I can't upload my drawing, so I try to explain it:
    - two TPICs feeding the plus point of the LEDs from 2 LiFe (6.6V, 4500mAH)
    - rotating to feed one line of 32 LEDs at a time
    - four HC595 feeing the minus point of the LEDs thru a current limiting resistance
    - feeding up to 32 LEDs at a time
    Is this design OK?
    For programming (in Spin):
    - a table of 16 LONGs, one bit per LED, managed by the main PUB
    - a multiplex PUB in a new COG, running the 2 TPICs and the 4 HC595s (2*3pins)
    Thanks for your support
    Roland

    Ok, I hope the TPICs are going to the cathodes of the leds as they are open-drain and cannot source current. The HC595s are fine to source current so that's 32 source I/O with 32 resistors.The software should be straight-forward as a simple Spin loop can read out the new column of 32-bits of data and shift it in to the HC595s. One thing you have to have is the OE control to the TPICs so that you can blank them during this update period otherwise you will get ghosting. Then once the source registers are loaded you can also clock the TPICs once relying on the cascading bit to turn on one output at a time. I know I'm probably being a little terse but I don't want to confuse you with too much detail.

    HC595
    R
    |>|
    TPIC

    I can draw a quick schematic if you like.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • RambomanRamboman Posts: 101
    edited 2009-11-17 10:19
    @Peter

    I really would appreciate a drawing, I am afraid I have connected the TPIC to the anodes of the LEDs ;-(

    I wrote the following program to test the logic one HC795...

    {Cube test 1}

    CON
    ··
    · _clkmode = xtal1 + pll16x···························· ' Crystal and PLL settings.
    · _xinfreq = 5_000_000································· ' 5 MHz crystal (5 MHz x 16 = 80 MHz).

    · clock = 21
    · latch = 22
    · data· = 23
    · size· =· 7··········································· ' 0..7, 15, 23 or 31
    ·
    VAR

    · long· stack[noparse][[/noparse]20]
    · long· matrix

    OBJ

    '· pst··· : "Parallax Serial Terminal"·················· ' Serial communication object

    PUB main | idx·································

    '· pst.Start(115200)···································· ' Start the Parallax Serial Terminal cog·
    · cognew(mpx,@stack)··················

    · repeat
    ··· repeat idx from 0 to size
    ····· matrix~·········································· ' set to nul
    ····· matrix &= !|< idx································ ' set bit[noparse][[/noparse]idx] to "1"
    ····· waitcnt(clkfreq/5+cnt)
    ·····
    PRI mpx | temp, idx

    · dira[noparse][[/noparse]clock..data]~~
    · outa[noparse][[/noparse]clock..data]~
    ·
    · repeat
    ··· temp := matrix
    ··· outa[noparse][[/noparse]data] := temp[noparse][[/noparse]size]··························· ' set 1st bit
    ··· repeat idx from 1 to size
    ····· outa[noparse][[/noparse]clock]~~···································· ' shift data
    ····· outa[noparse][[/noparse]clock]~
    ····· temp <<= 1······································· ' shift temp also
    ····· outa[noparse][[/noparse]data] := temp[noparse][[/noparse]size]························· ' get new data
    ··· outa[noparse][[/noparse]latch]~~
    ··· outa[noparse][[/noparse]latch]~
    ··· waitcnt(clkfreq/500+cnt)

    {ram 17.11.09}
    ·····
    ·····
    ···
    ···
    ··
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-17 15:17
    ram,

    You are missing quite a bit from the code. Essentially you have to set 32 source drivers with the next long from your led buffer then enable the outputs, wait, disable the outputs. You have to make the column driver shift to the next bit then and read the next long etc. I have included some code for you to see what I mean. This is a tip too, when you are writing code you want to be able to read it and understand it so it helps to factor out functions and give them a name. i.e. rather than tkaing an output high and then low you could factor this out into it's own routine and call it CLOCK if you like. Ayway, if you do it this way you will able to walk through the code mentally and so it's way easier to debug.

    I'm really tired at the moment, see how you go with the code though in the meantime. There might be a few mistakes but basically it's ok.

    CON
    
      _clkmode = xtal1 + pll16x                             ' Crystal and PLL settings.
      _xinfreq = 5_000_000                                  ' 5 MHz crystal (5 MHz x 16 = 80 MHz).
    
    ' split clocks are used instead of split loads so that the columns can be advanced with a simple clock pulse
    ' TPICs could be cleared with direct CLR line if available
    
    ' some sample pin defs
    
      colclk        = 20            ' clock to TPICs (used as a 1 of 16 active low driver)
      rowclk        = 21            ' clock data into 74HC595 rows (source)
      load          = 22            ' common load for both row and columns
      sdo           = 23            ' serial data out to source registers (74HC595) and TPICs
      outen         = 24            ' output enable (active low) to inhibit leds while updating registers
    
      columns       =  7            '
    
    VAR
    
      long  stack[noparse][[/noparse]20]
      long  leds[noparse][[/noparse]columns]      ' led matrix of 32 rows x columns
    
    OBJ
    
    '  pst    : "Parallax Serial Terminal"                   ' Serial communication object
    
    PUB main | idx
    
    '  pst.Start(115200)                                     ' Start the Parallax Serial Terminal cog
      cognew(ledmux,@stack)
    
      repeat
        { your forground loop }
    
    
    pri ledmux | col,row
      outa[noparse][[/noparse]colclk..sdo]~                  ' setup pins before making it an output (glitches)
      outa[noparse][[/noparse]outen]~~
      dira[noparse][[/noparse]colclk..outen]~~
      repeat
        ResetColumn                      ' start from first column
        repeat col from 0 to columns-1
          LoadRow(leds[noparse][[/noparse]col])             ' read next data from buffer and update
          outa[noparse][[/noparse]outen]~                   ' enable outputs
          waitcnt(clkfreq/500+cnt)       ' whatever refresh delay you pick (not too fast, not too slow)
          outa[noparse][[/noparse]outen]~~                  ' blank outputs
                                         ' it is possible to have another delay here to control the brightness
          NextColumn
    
    
    pri ResetColumn
      outa[noparse][[/noparse]sdo]~                         ' clear column register
      repeat 15                          ' clock zeros into register
        ClockColumn
      outa[noparse][[/noparse]sdo]~~                        ' clock in a single active (to be clocked column by column later)
      ClockColumn
      LoadRegisters
    
    pri NextColumn
      outa[noparse][[/noparse]sdo]~
      ClockColumn
    
    pri ClockColumn
      outa[noparse][[/noparse]colclk]~~
      outa[noparse][[/noparse]colclk]~
    
    pri LoadRow(_leds)
      repeat 32                             ' 32 leds at a time (one column) 74HC595 x 4 (74HCT for 5V and 3.3V compatibility)
        outa[noparse][[/noparse]sdo] := _leds&1             ' read next lsb of long and set sdo
        outa[noparse][[/noparse]rowclk]~~                   ' clock it
        outa[noparse][[/noparse]rowclk]~
        _leds >>= 1                      ' setup next bit
      LoadRegisters
    
    pri LoadRegisters
      outa[noparse][[/noparse]load]~~
      outa[noparse][[/noparse]load]~
    
    



    P.S. changed LoadRow repeat loop to 32

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*

    Post Edited (Peter Jakacki) : 11/17/2009 3:53:50 PM GMT
  • RambomanRamboman Posts: 101
    edited 2009-11-17 15:54
    @Peter

    Again, Thanks for your support

    I understand I still have to learn a lot...

    The only projects I finished to now are:

    -· a flashing ball with 40 bi-color leds

    -· a flashing message "stone" with a 14 segment display

    -· a Xmas display with a oled

    Together with the "led cube", I am working on an hexapod...

    Managing 512 leds is pretty ambitious, but my wife is an artist; for her was my early design with 125 leds too small ;-)

    125 is much easier because you need the propeller only, without additional electronics

    First layer 8*8 is ready; I will be able to test logic on it!

    Again THANKS
  • RambomanRamboman Posts: 101
    edited 2009-11-23 16:26
    @Peter

    I rewrote the program, following your recommandations.
    It's running very well with one 74HC595 and one TPIC6595 and the first 8*8 layer.
    Extension to 8 layers will be straightforward.

    Thanks again wink.gif
  • RambomanRamboman Posts: 101
    edited 2010-01-08 13:56
    Building up that 8*8*8 led cube needed a lot of patience...
    The architecture is based on 32 1/16'' brass columns for the four 74HC595 and 16 more for the two TPIC6595.
    Control board is cabled on strip board; relatively easy.
    All the circuits are powered from 4 NiMh; plus a 3.3V regulator for the propeller.
    Programming as recommended by Peter works very well.
    Still one issue: sometimes it stops without apparent reason!
    I guess I forgot to use 1K resistance between Propeller pins and xx595's ;-(
    Some soldering work in perspective!
    Again, THANKS PETER wink.gif)
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-01-08 14:08
    Re "Building up that 8*8*8 led cube needed a lot of patience..."

    Past tense? Does that mean it is all working? I'd love to see a video demo of this.

    8x8x8 ought to be capable of some groovy 3d simulations.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/propeller
  • RambomanRamboman Posts: 101
    edited 2010-01-08 15:11
    All of them were working...
    but after adding 1K resistances on all the pins, it does not work anymore...
    I'll check
  • RambomanRamboman Posts: 101
    edited 2010-01-08 15:43
    Youpie!
    I inversed 2 wires when soldering, now it's OK.
    Test program follows:

    repeat
    repeat col from 0 to 15
    leds[noparse][[/noparse]col] := ?seed
    waitcnt(clkfreq/10+cnt)

    Just generating random light.

    Now begins creativity wink.gif)
  • RambomanRamboman Posts: 101
    edited 2010-01-10 11:37
    HELP!

    I don't know what to do: the led cube stopped working...

    Battery is OK, soldering seem OK, now there are 1K resistances between propeller and xxxx795's and 100nF cap across power.

    It runs... it stops with some leds on, not flicking... it runs with half the leds flicking... it stops definitively ;-(

    It' not a program issue!

    I am not electronic engineer; what can I do?

    HELP!
  • RambomanRamboman Posts: 101
    edited 2010-01-10 11:55
    I made a guess:
    the TPIC has to drain a max of 32 leds at once
    that is up to 32*20mA i.e. 640mA
    the specs indicate 250mA continue...
    -> one or two burned TPICs; i'll check!
    If yes, I have to change the design or at least the program to avoid to light up to many leds at the same time.
    Any comment?
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2010-01-10 14:51
    tlc5920 and friends?
  • RambomanRamboman Posts: 101
    edited 2010-01-10 17:45
    @Peter
    I am afraid the TPIC cannot manage the power: 250mA per port for 32 leds ???
    This cube is unpredictable...
    I will try to limit the number of leds to 16 or 8 at a time to reduce the load on the TPIC.
    If anybody had a suggestion to replace the TPICs with something more powerfull...
  • RambomanRamboman Posts: 101
    edited 2010-01-11 10:03
    Action plan:
    1. connect only the TPICs, return to V+: it should light 16 leds, one at a time, if program is OK; no overload with 1 led wink.gif check current!
    2. connect only the 74HSs, return to V-: with appropriate program, it should light 32 leds, one at a time.
    3. connect the 4 G/ (enable) of the 74HSs to specific pins of the propeller; activate one at a time in the mpx loop so the max of leds on is 8 at once.
    Mpx refresh may be an issue: 1/64 instead of 1/16; if current ok, may go up to 1/32, enabling 2 74HSs at once.
    We will see...
  • RambomanRamboman Posts: 101
    edited 2010-10-19 02:16
    I changed the TPICs for TPIC6A595 that can manage 350mA per port.
    The 8*8*8 cube is mapped in an array of 16 longs.
    1/16 multiplexing gives enough light.
    8*8*8 LED cube is operational for Xmas ;-)
  • AleAle Posts: 2,363
    edited 2010-10-19 02:35
    Videos, photos, something ! we are hungry for photos... and it is almost kunch time :)

    Good work !
Sign In or Register to comment.