I have no experience yet with Arduino or microcontrollers, but I am told I might be able to reconfigure an exhibit I built
using this technology. I am an exhibit designer for small museums and nature centers, and one of my clients has a map of all its natural areas located with LEDs. The panel below it has 18 buttons: press an "activity" button and it illuminates all the sites at which that activity is available. I am rebuilding this unit after ten years of service and several additions of sites and activities. Now we are up to 40 site LEDs and 18 buttons. I built the original control system hard wired with diodes and resistors, and running off a 6v. power supply. Is that circuit board something that could be replaced by a microcontroller? I need to keep the LEDs intact on the map board, and the push-button harness, but the circuit board could be rebuilt in the same manner or "newfangled".
Any comments? Attachment is a PDF chart of the lighting array.
not to be a pessimist, but, you have a working unit ? and want to change that ?
firstly, yes. the Arduino MEGA is a great match for this.
it has 54 I/O pins, so you could almost do this with one unit.
if you use two megas, possibly split the unit into two separate groups. hopefully there is a clear separation that can be made in the project.
this would allow you get it working very fast and not have to learn about programming port expanders and shift registers.
that would be the easy way. only need to bring in the pins for the switches and control out for the LED's. a novice could get that working in a weekend.
another way would be to use port expanders or shift registers. they use a few pins and can 'see' many switches and control all dozens of LED's individually. port expanders or shift registers will be a LOT more work.
As I'm working on a project to replace existing hardware myself, I will say that almost anything hardware can be replaced by a microcontroller. It's not always the best option, but for most applications it's the one that offers the most flexibility.
From the looks of things, it doesn't look to be something that would necessarily need a microcontroller, though I can see some application questions that might provide additional features (such as activating a recording, etc.) which might still not need a MCU.
Generally, I tend to think of things like simple push-button interfaces as hardware-only because there isn't a particular need for processing of any kind. If you wanted it to selectively check whether or not a place was open before activating an LED, that might be a different matter, but in general a simple push-button interface isn't going to really need something like that.
This is, of course, just my opinion. It's at odds with some of the others.
you know if you used a microcontroller, you would have a limit on what buttons would respond at what time.
you could have a blinking light, say someone pushed music and all those areas lit up, then pushed swimming. the set that matched both parameters could light up and blink.
or, if someone pushed two buttons, only the led's that matched both conditions lit.
or after lighting, they remained on for a period and then fadded to off.
CrossRoads:
Easier - wire up a MAX7219 to drive the LEDs.
Then a 32 IO '1284P to drive the max7219 and read the buttons.
while I concede that this is a preferred way for an experienced programmer, AND it is a good selection of parts, I believe that would require making a PCB and require a higher level of programming. the term slick comes to mind. a nice project.
However, I believe the OP is a beginner and would get the project done easily with using complete assemblies such as two MEGA's.
2 mega's? That's like $150 or something?
A 1284 board and a max7219 with some headers to break out pairs of wires for the LEDs, most likely similar to what was wired originally, would be 1/3 of that.
being a one-man-band, I have to lay out the circuit, send off for the board, order the chips. put it together. can take weeks.
I typically put in multiple extra breadboard areas for the occasional mistakes. usually disguised as places for LED's.
It has been my experience that there are two distinct groups. those who would scavenge an old modem to get that 85 cent relay and 35 cent opto and the other group that has a tool box with a browser, a cell phone and a checkbook.
your proposal will be far more efficient in the long run. I think the subjective part is that of the ability to make the board and the time spent doing that and learning the programming for the serial I/O. the question is if the OP would take 10 hours more for those things and the cost of labor offsetting the cost of hardware.
assuming he will make a new board for this, your version will cost less since a new board would be in the works either way.
time to get the board being, equal.
The only real difference is the time to learn the programming. troubleshooting and testing.
using the more expensive units, the software would be very basic. a switch is pressed, and outputs are sent.
just label and repeat for the next switch.
The programming would be simple tho:
There would be an array of 8 bytes representing the 64 LEDs.
Read a switch - if pressed change a bit in one of the arrays:
if (digitalRead(sw0) == 0){byteArray[0] = byteArray[0] & 0b11111110;} // LED off
else {byteArray[0] = byteArray[0] | 0b00000001;} // LED on
:
:
if (digitalRead(sw25) == 0){byteArray[3] = byteArray[3] & 0b11111101;}
else {byteArray[3] = byteArray[3] | 0b00000010;}
Repeat for all 26 switches, setting/clearing individual LEDs, groups whatever
Send the updated bytes to the max7219:
for (x=1; x<9; x=x+1){
digitalWrite (ssPin, LOW);
SPI.transfer(x); // send address
SPI.transfer (byteArray[x-1]); // send data from byteArray[0] to byteArray[7]
digitalWrite (ssPin, HIGH);
Take a protoboard, couple of chip sockets, some female headers with shield length legs, can have this all wirewrapped up in an evening. Then just connect all the LEDs and toggle type switches.
If momentary on/off buttons are used instead, then the code needs to change some to toggle the LED state with a recognized button press. Not hard to do.
Wirewrap stuff from www.phoenixent.com
Female headers from www.dipmicro.com
Male crimp pins & crimp housings from www.pololu.com
Or terminated wires from pololu, buy the long lengths & cut in half to have a terminated end for the board and a bare end for the LED and switch connections.
Well, this is a cornucopia of responses for 12 hours of being up. I am impressed and overwhelmed, but intrigued. As I gave up on having this job actually make any profit from a business stance, which seems to be my business plan anyway, I am always interested in broadening my horizons. It will take me a while to get with the lingo here, but I can see that I am dealing with some smart and innovative folks in this community. I was suggested this alternative to the hardwired system by a design guy at Digikey, which sells the ARDUINO MEGA ADK BOARD REV3 he suggested. The system I am rebuilding was originally hardwired to handle 29 lights and 14 buttons, and is now up to 18 buttons and 40 LEDs. The buttons are push-momentary ON buttons. I have ordered in a couple of terminal blocks that will allow me to connect my circuit to the Map Board with a 50-wire ribbon cable, giving me a few wires to spare, and of course the amount of work to set up a board with the controller will end up being about the same as a diode circuitboard. This may all be moot as the client is starting to lean on me and I may have to crank this thing out in the post efficient fashion time-wise. Still, whichever way I go, I have learned a lot in the last 12 hours, which is inspiring. I can already think of about six projects I would love to get into with this. Thank you all VERY much.
If you had supplies, you could have a unit wired up in an evening.(see pics below)
Or, send some cash, I can order boards from iteadstudio while you order some parts from Mouser/Digikey/Dipmicro/Pololu/whereever. Pay for DHL shipping from China, can have PCBs fairly quick.
Boards are $19.90, I think DHL shipping is $26, UPS $29, plus some cost for my time.
Or I could do the whole board, and write the software. All it takes is $ 8)
The problem with using a '2560 based design is current flow - it can only handle 800mA thru the processor, and the current has to be spread over the ports so no one port is overloaded.
40 LEDs all on brightly is 800mA - you're already maxed out. If you have older LEDs in place already, they were inefficient and needed higher current to light up.
Add one simple chip, the MAX7219, takes care of all that. You can expand to 64 LEDs, and 26 switches with the '1284 setup I described.
If instead you have LEDs with current limit resistors, they can be connected to a board with discrete high current shift registers to maintain 20mA current sink capability - the LEDs need to be connected as common anode, so a shared V+, while each cathode goes to a shift register output.
Here's a '328P based board that could do that. Really need one that's 1284P based to support the number of switch inputs.
(This gives me several good ideas for boards to design & offer!)
Well, let me say I appreciate the response and the willingness to help further this project and get me on the road with this thing.
I will describe in as much detail as I can where the unit is at on this end: I have old LEDs (160-1087-ND in the Digikey cat.) w/o resistors, running one lead to a bus bar common, and I am numbering the other lead (according to the chart attached in the first post), which will be fed through the terminal block (277-2268-ND in Digikey) to a 2' ribbon cable and out through another terminal block to the breadboard. Feeding into the other side of this breadboard (438-1039-ND) are the leads from the 18 push-buttons, with the other side of all of them sharing a lead from the 6v. power supply. So I was just ordering a prototyping board, resistors, diodes and hook-up wire to do the hardwire option this morning, and now this.
I admit I am completely out of depth with this microcontroller option and only vaguely clued into much of your terminology.
I can still build this the old way, but as I said I am intrigued. I have aproject coming down the pike in a few months where I will be building a sound-and-light active night-time WWI trench exhibit at a military museum and can see a bunch of it run from these kinds of gadgets.
terminology ? when you do anything electronical, it seems shorthand is the norm.
the Arduino is a family of different boards. the form factor you will see most often is shared by the UNO, the Duemilanove and the Leonardo. this has two rows of pins on the sides.
these are set to hold other boards. the secondary boards are called shields.
the UNO and it's bretheren use either a ATmega324 or one it that chip's siblings.
or the ATmega168 (less features)
the Arduino MEGA is not the same as the ATmega. the ATmega is a chip, the Arduino MEGA is a board.
that Arduino MEGA uses the ATmega2560 chip. this has 54 digital input/output.
both of these boards are widely available.
the option CrossRoads offered was a chip that falls between the two.
the ATmega1284P. has 'only' 34 I/O but a lot more memory than the UNO's 324 chip
The software program is called a sketch. the beauty of the Arduino platform is that regardless of the chip, almost all commands are identical across the platform.
It sounds like the Arduino could be a new tool for your tool box !
The problem with using a '2560 based design is current flow - it can only handle 800mA thru the processor, and the current has to be spread over the ports so no one port is overloaded.
40 LEDs all on brightly is 800mA - you're already maxed out. If you have older LEDs in place already, they were inefficient and needed higher current to light up.
um.... I thought we established a persistence of vision approach ? pulsing the LED's would reduce the power to a fraction of the steady state.
it looks like "public hunting" with 28 LED's is the largest set, so would be the max number of LED's on at any time.
I will leave how and why people are hunting public to a different thread.
While my initial pragmatic response was "just add more diodes and LEDs", I must also point out that a MAX7219 will indeed drive 64 LEDs quite effectively, multiplexed which means you need only 16 wires to that many LEDs or five wires between the Arduino and the MAX7219 if it is mounted on the display itself. And it uses only one resistor (and crucially, two bypass capacitors).
Similarly, if you multiplex the 18 buttons with a diode in series with each, you need only nine wires to do so (or ten to allow for 25 buttons). This means gross simplification in the wiring of the buttons and the LEDs. You need only a UNO or in fact a Pro Mini and actually, you do not need another circuit board at all (except for the MAX7219, wherever you place it).
Clearly, the advantage of using an Arduino is that you can do it and leave space for the future extensions, knowing that they will involve only adding simple components and downloading an updated program sketch. Even without actual additions, you can add extra features without altering the hardware at all, so you can "get it out the door" with the minimal performance, then sit around and play with it at any later date. And you can test your ideas on the working system from time to time when it is not in use, but then return it to the previous working version if the new idea does not suit, or does not suit after a week or so trial.
So that is great. What does come to mind is that if you have not already done so, the LEDs are ten years old and likely work as good as they ever did, but you almost certainly want to consider replacing them all with current ones which I suspect will be vastly more efficient than in 2004, thus much brighter and more impressive while using less current.
the beauty of going from a hard wire system to a microcontroller is that you can add features.
one that I thought was interesting was if someone were to press two buttons, then all the lights from those two would light up.
but, using the Arduino, one can program the unit so that only the areas that meet both criteria light up.
such as if you are out public hunting and want to find campgrounds. then only areas that contain both would light.
inversely, say you want areas of campground that do not also have public hunting, then those areas could light.
I really like all the input I have been getting here; it certainly reinforces the original notion of using microcontrollers here. Combining two buttons to get only parks that offer both activities for example. Replacing all the old LEDs on the map would take some effort and time that I may not be able to invest, but I can certainly see the rationale. Also the maximum number of LEDs on at one time is still 40 (ALL parks), but there are even a couple of different ways to wire that in the old hardwire (diodes and resistors) boards.
I am currently resorting all my old wiring into terminal blocks so I can do a pass through from map to control box on a 50-element flat ribbon cable, and thinking about a new feature or two that I could include if I went Arduino on this. Thanks for all the great input!