Need more outputs
MtnFlyer
Posts: 28
I'll apologize in advance for this one... I'll bet it's been answered a hundred times, but I can't find it using the search engine.
I simply need more outputs. I'm trying to control a tree of LED lights (4 LEDs in each row, see attachment "LED_tree.pdf"), and I've got 20 rows of lights to switch on/off at very particular times depending on an input voltage (see attachment "relay_schedule.pdf"). Is there an "expansion module" that would give me more outputs on a BASIC Stamp?· Or maybe a simpler solution I'm not seeing? My plan is to have each output drive a switching transistor to light the row at the appropriate time.
Thanks, Jim
I simply need more outputs. I'm trying to control a tree of LED lights (4 LEDs in each row, see attachment "LED_tree.pdf"), and I've got 20 rows of lights to switch on/off at very particular times depending on an input voltage (see attachment "relay_schedule.pdf"). Is there an "expansion module" that would give me more outputs on a BASIC Stamp?· Or maybe a simpler solution I'm not seeing? My plan is to have each output drive a switching transistor to light the row at the appropriate time.
Thanks, Jim
pdf
81K
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
"Being serial devices, shift registers can be cascaded. By cascading, the BASIC Stamp is able to control dozens of 74x595 outputs with the same three control lines."
I appreciate your help. --Jim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
Would you think the attached configuration would work. Would you make any suggestions?
Jim
You will need to pick the correct resistor for your LEd's for the 12v shown on your diagram but it looks good.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
You can take a look at MM5450N (1 Jameco Part# 26171) as well. I just used it to drive 4, 7 segment LED displays. It doesn't do any multiplexing... Two stamp pins will get you 34 pins to control your LED's. You can use shiftout to send the bits to control the pins... The chip is a little on the large side.
Here is a sample of the code I used...
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
'Define Pins
'
'MM5450N #1 Pins - Used for 4 digit display
CLK1 PIN 0 'clock attached to pin 21
SDATA1 PIN 1 'serial data to pin 22
sBIT CON %1 'first bit sent required
eBIT CON %000 'bits 33, 34 not used + one I need to check on
'
' MM5450N 7 SEGMENT LED BINARY DIGIT MAPPING !!No Decimal pnt. ctrl.
'
'Map binary numeric digits to constants
d0 CON %11111100 '0 - abcdef 1111110
d1 CON %01100000 '1 - ef 0000110
d2 CON %11011010 '2 - abdeg 1101101
d3 CON %11110010 '3 - abcdg 1111001
d4 CON %01100110 '4 - bcfg 0110011
d5 CON %10110110 '5 - acdfg 1011011
d6 CON %00111110 '6 - cdefg 0011111
d7 CON %11100000 '7 - abc 1110000
d8 CON %11111110 '8 - abcdefg 1111111
d9 CON %11110110 '9 - abcfg 1111011
blank CON %00000000 '0000000
'
' Start Program
'
Main:
GOSUB numericTest 'display 8888
GOTO Main
numericTest:
'Display 8888 on display
SHIFTOUT SDATA1, CLK1, 1, [noparse][[/noparse]sBIT, d8 , d8 , d8 , d8 ,eBIT]
RETURN
No, unless I misunderstand. I thought I would use 3 output pins from the BASIC Stamp to control the outputs of the 74HC595s (8 output pins on each). So my intent was to cascade three 74HC595s and use 20 of the 24 output pins to drive LEDs.
Arthur,
Thanks for providing another avenue to look at! I will check it out.
--Jim
Them being 74HC595
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
The MM5450N may work, but I'm not sure how best to do it. From the data sheet, it looks like the pins acts as sinks, taking the LED current to ground. They are limited to 15mA each, but I need to sink 120mA at each pin. Maybe I could use the pin to switch a transistor so that the pin just sees the base current and doesn't have to absorb all the collector current? I'm not very experienced in this area.
--Jim
One of the great things about electronics is there is usually more than one way to make things happen. In the end it comes down to what you are comfortable with and how much support you can get if things go wrong.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
When a pin goes "active", the votage on that pin drops to 1.8V, so now theres a 1.2V difference and current flows throught the LED.
In my drawing, I would have to somehow bias the emitter side of the transistor to 3V to keep the PNP transistor from letting current flow to ground. I don't know how to keep the emitter at 3V while keeping my LED source voltage at 12V.
Looks like you figured out how the chip works. The chip was designed for common anode 7 segment LED's... So·the anode of your LED(s) would go to·+ and and cathode to the MM5450 PIN.· So far I have only used the chip for 7 segment displays and 5mm led's·as indicator lights for a prototype.·I will likely face the same issue·when I scale·up·my project so·I will think about it. ·I do know if you aren't using all the pins you can increase the current output per pin.· Page 5 of the datasheet· has the calculation: http://www.datasheetcatalog.org/datasheet/Micrel/mXsvtxr.pdf
"For applications where a lesser number of outputs are used, it is possible to either increase the current per output, or operate the part at higher than 1V VOUT. The following equation can be used for calculations.
TJ = (VOUT) (ILED) (No. of segments) (124°C/W) + TA
where:
TJ = junction temperature + 150°C max
VOUT = the voltage at the LED driver outputs
ILED = the LED current
124°C/W = thermal resistance of the package
TA = ambient temperature"
Here is a pretty decent·use of the chip that may help if you decide to use it.
http://www.ledsales.com.au/pdf/backlight_kit.pdf
Thanks...
'
' MM5450N wiring
'
' 7 Seg. Common Anode Pin Layout (4 Jameco part #335021)
' a· -|······· |-NA
' f·· -| ······ |-b
'ca· -|
'····· ········· |-g
'······ ········ |-c
'NA-|· ····· ·|-dp
'e·· -|········|-d
' MM5450N (1 Jameco Part# 26171) / 4 - 7 SEGMENT LED WIRING
' DIGIT 1 = PINS 18 -> 11 (A=18 B=17 C=16 D=15 E=14 F=13 G=12 [noparse][[/noparse]DP]=11)
' DIGIT 2 = PINS 10 -> 3 (A=10 B=9 C=8 D=7 E=6 F=5 G=4 [noparse][[/noparse]DP]=3)
' DIGIT 3 = PINS 2,40 -> 34 (A=2 B=40 C=39 D=38 E=37 F=36 G=35 [noparse][[/noparse]DP]=34)
' DIGIT 4 = PINS 33 -> 26 (A=33 B=32 C=31 D=30 E=29 F=28 G=27 [noparse][[/noparse]DP]=26)
' BIT Order (BITS 1 - 32) BITS 33 and 34 not used, defined in eBit
'·············· DIGIT 1·················· |······· DIGIT 2················· |··············· DIGIT 3··········· |·········· DIGIT 4
'SEG A·· B·· C··D· E·· F·· G· DP· |·A· B· C·· D·· E·· F· G· DP·· | ·A ·B ·C · D · E · F ·G · DP· |· A ·B · C · D ·E · F · G ·DP
'BIT· 1·· 2·· 3·· 4··5·· 6·· 7·· 8· |· 9·10 11 12 13 14 15 16·· | 17 18 19 20 21 22 23 24· | 25 26 27 28 29 30 31 32
'PIN 18 17 16 15 14 13 12 11 | 10· 9· 8·· 7·· 6·· 5·· 4· 3··· | 2· 40 39 38 37 36 35· 34 | 33 32 31 30 29 28 27 26
Post Edited (arthuranderson14) : 4/15/2009 2:50:04 PM GMT
Basicaly· 8x8 matrix with intensity control.
Cheers Vaclav
·
Jim
Do you have a· BS2 code snippet for the MAX7219?
Thanks,
Eric
Post Edited (arthuranderson14) : 4/15/2009 5:48:32 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
http://www.parallax.com/dl/docs/books/sw/exp/sw29.pdf
Looks like the Max7219 chip is a better solution since it will reduce the amount of wiring required. If you need to control more that 34 LED's, a single chip can be used instead of two MM5450N's. I guess the down side is Max7219 costs around $13 while the MM5450N is about $4. Still worth it if you need to control more than 34 LED's (segments) and consider the extra wiring.
MM5450N - 34 LED's / direct conect to pin / Common Anode / Uses 2 stamp pins
Max7219 - 64 LED's / multiplexing / Common Cathode / looks like 3 stamp pins
Programing the Max7219 might be a bit more complex...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
They are like the 74HC595 on steroids. 150 mA per channel
Or this one with 16 outputs STP16CP05 found here http://www.datasheetdir.com/STP16CP05+LED-Drivers
Or this one with 35 outputs www.micrel.com/_PDF/mm5450.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
Post Edited (Mike2545) : 4/17/2009 2:37:05 AM GMT
Thanks very much for the info. I went ahead and ordered the MAX 7221 http://datasheets.maxim-ic.com/en/ds/MAX7219-MAX7221.pdf
I'll let you know how it goes!
Jim
I think I am going to give the MAX 7221 a try when I scale up my project. If you get the chip to work it would be great if you could post a code example.
Thanks,
Eric
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
I will do that. -Jim
Here is my "work in progress" copy of MAX7219 code.
On top of "standard" disclaimer (your mileage will vary) I need to tell you that my coding style is
1. Keep everything until all is working
2. Use DEBUG
3. Comment, comment, comment
So, the code has some redundant lines and lots of comments.
·
The hardest part of using MAX 7219 is its setup (see LOOKUP code), read documentation.
Do not forget the intensity resistor and make sure it is OK for your application.
I am currently incorporating part of the code into another application - so I am not taking any comments out, not yet.
Any questions – ask. Be patient - I may be slow to respond.
·
·
·
--Jim
Edit:· I had the MAX7221 chip available too, but that proved to be problematic.· I didn't realize I would need something between the chip and my LED tree---namely an display controller.· I should have caught that.
Cheers
Vaclav