Using BASIC Stamp To Control A Board with 215 LEDs
Hello, I'm a complete beginner with micro controllers but I am more than willing to learn. This is the general gist of what I want to accomplish.
I run a campground with 215 sites. I want to build a project where an LED is tied to each of those sites and the map is connected directly to the computer. I will be running a program in the background that queries the database every few seconds and updates which LEDs should be turned on or off depending on whether a site is occupied or not. I have all the computer programming stuff down pat, but I have a lot to learn about how to tie in the hardware part.
My question revolves around just what I need to do for the hardware side of things. I want to use a USB cable to connect my map to my computer. I believe I need a micro controller to act as an interface between the computer and the LED's I want to turn on. The project needs to control about 215 LED lights, each one connected to a site.
I welcome any advice or links people will give me to help me achieve what I want to do. Please take it easy on me - I'm still learning my way around these things.
Thank you in advance for your assistance.
I run a campground with 215 sites. I want to build a project where an LED is tied to each of those sites and the map is connected directly to the computer. I will be running a program in the background that queries the database every few seconds and updates which LEDs should be turned on or off depending on whether a site is occupied or not. I have all the computer programming stuff down pat, but I have a lot to learn about how to tie in the hardware part.
My question revolves around just what I need to do for the hardware side of things. I want to use a USB cable to connect my map to my computer. I believe I need a micro controller to act as an interface between the computer and the LED's I want to turn on. The project needs to control about 215 LED lights, each one connected to a site.
I welcome any advice or links people will give me to help me achieve what I want to do. Please take it easy on me - I'm still learning my way around these things.
Thank you in advance for your assistance.
Comments
2) In terms of controlling that many LEDs, it would probably be easiest to use either a string of TI TPIC6595 or a combination of a 74HC595 plus a ULN2803. In both cases, you get 8 bits of outputs plus a power driver to handle the current from all the LEDs. You can string these end to end (logically) to any length although you need to add some buffering if you have much more than 8-12 of these in a string. Each string requires 3 or 4 I/O pins to control. In your case, I'd suggest using 3 strings of 10. This would leave some room for expansion in the future. The PC would simply send to the Stamp the number of the LED to turn on or off or a code to turn them all off (for initialization). Since these would not be changed frequently, you could store the values of these 30 bytes (240 bits) in the EEPROM using the READ and WRITE statements (whenever the bits change) since there's not quite enough room in the Stamp's variables to store that much data. Every time there's a change, the Stamp would have to send out the bytes for the string that's changed and update the LEDs that way.
I believe there are examples of the use of a 74HC595 (the TPIC6595 works the same) in the Basic Analog and Digital tutorial and I think in the StampWorks Manual. Both are downloadable from Parallax's website. There are also Nuts and Volts Columns on the subject of expanding Stamp I/O. Both are reachable by clicking on the Resources tab on the main Parallax webpage. For the tutorials, select Downloads, then Stamps in Class Downloads.
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Parallax Tech Support·
Had the advantage that you could also dim them from the software.
All you need then is a decent aerial shot off google earth!!
Good luck.
Mike, I am just curious. If you use ULN2803, how would you connect it? It seems you would need a ULN23803 fore each 595?
Wouldn't a single ULN2803 run a lot more than 215 LEDs with regards to current? A LED typically draws 3mA of current, and the UL8203 can source 500mA on each output.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
Yes, you would need a ULN2803 for each 74HC595. I'm thinking more in terms of fairly bright LEDs drawing on the order of 20mA each. If you were just lighting a few of the 215 at a time, you could drive the LEDs directly from the 74HC595s, but there's a maximum total current capacity for the 74HC595. If you really were using only 3mA per LED, you could light several of them directly from the 74HC595. Sure the ULN2803 is "overkill", but the whole display could be lit up brightly and you'd still be ok. You could use discrete cheap switching transistors. You'd need two resistors, a 2N2222A or equivalent, and the LED for each of 215 places.
The MAX7219 or MAX7221 is not a bad choice. You'd need 4 of them and the LEDs would be multiplexed, but it takes care of the details of that for you.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
Personally, because I've never done anything like this before and I actually have a goal, I am enjoying the process.
Being that this is for a campground, each LED will represent a site, so if the campground is full every light on the board will be turned on simulatneously.
Mike, I like your idea of using a the 74HC595 with a chain of ULN2803, because of the reason I stated above. I'm not currently to the level where I can completely understand how to use those chips, but the more information I get, the more I start to understand what I'm trying to do.
Currently I'm using the "What's A Microcontroller" book I picked up at Radioshack to learn the basics of the BASIC Stamp system. Because my background is in computer programming, I really enjoy the syntax that BASIC Stamp uses. It's much easier to comprehend than assembly instructions.
After I finish the "What's A Microcontroller" lessons, I'm wondering what I should hit next, in order to learn what I need to achieve my goal. I'm considering buying the Stampworks Experiment Kit and going from there. I'm hoping by the time I'm done with those experiments, I should understand a lot more than I do now.
Any advice or suggestions are welcome and encouraged.
Personally, I'd build an initial prototype using 16 LED's, probably one prototype using the 595's with 2803's, then another prototype with a Max7219, just to make sure I have the concepts working. And yes, you'll probably want an external eeprom (26L32 or so) to store the bit-settings -- after a million writes an eeprom will wear out, and having it be external makes it easily replaceable.
It's probably true that this would be more easily implemented as a GUI using Visual Basic .NET though.
Oh, and a "typical" LED does take 10 to 15 mA to fully illuminate.· "Low-Current" LED's will work on 3 to 5 mA, but they can be hard to find.
Post Edited (allanlane5) : 12/1/2009 5:46:29 PM GMT