I want to set it up so that the buttons light up (when pushed) and turn off (if pushed again).
Latching behavior like that will require either a physical latching switch (AFAIK there aren't any arcade-style latching LED buttons)
or some sort of Arduino microcontroller and relay board.
- The relay board is probably needed because the LEDs draw too much current (about 20 mA each) to power a bunch of them directly from the Arduino output pins.
What equipment would I need to accomplish this?
Closest setup that I can think of is WannabeJoy's soundboard toy build
here.
- The relevant parts are the battery pack, the modified USB cable for powering both the Arduino and the LEDs, and the microswitch input wiring at the bottom.
- Instead of the soundboard, use an Arduino Pro Micro.
-- You may need a full-sized Arduino , depending on how many buttons you need to control.
- Obviously, the relay wiring and LEDs are not shown in this diagram.
- Use the relays as switches between "5v for LEDs" and the LEDs.
You'll need an Arduino sketch (program) that does three things:
1. Define and initialize variables, input pins from microswitches, and output pins to a relay board that switches LED power on/off.
2. Monitor input pins looking for a button press.
3. When a button is pressed, invert the logic level (high==>low or low==>high) on the associated output pin.
- The logic level controls whether the relay is on (logic high = 1) or off. (logic low = 0)
Also, if you want some of the buttons to have non-latching, momentary functions
or add bank-switching (more than one LED per relay), here are some simple wiring diagrams.
Scott