This is an Instructable I wanted to do for a while, on how to build a really great-looking Dome Button with built-in LEDs. It's part of a 2-series where I will explain how we built our Hackerspace Status Button for P-Space, our local hackerspace in Patras, Greece.
The basic premise is that we wanted a way for the first person coming into P-space to set the space status to Open, and the last one to leave to set it to Closed. We used to do this through a simple web page, but we wanted an easier way to do that, so we set up an Arduino with a Wi-Fi shield next to the door that connects to that web page and controls the status.
That way, we can still use the web page, or just hit a button as we leave, and let the Arduino do the rest.
And we wanted a big, fancy button for that.
For this Instructable, you will need:
- 1 Dome Button from SparkFun
- 1 Adafruit Neopixel Ring (16 LEDs)
- 1 5V Adafruit Trinket
- 1 1000uF Electrolytic Capacitor
- Some Wires (prefferable 3 different colors)
- Wire Cutter
- Dremel or other cutting/drilling tool
- Soldering Gun
- Glue Gun
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Prepare the Hardware
First of all, you will want to disassemble your Dome Button. It consists of 2 black plastic parts for the casing, and 2 white parts + 1 clear front for the moving part of the button.
The 1st part of the casing already has 4 holes, which are just right for the cables, but you will need to cut a hole in the second part, as seen in the first picture. I just used a Dremel with a drilling bit for that, and I was done in seconds. You will also need to do the same for one of the white plastic parts, as seen in the 2nd picture.
You will then need to solder the wires to the NeoPixel Ring. I used three different colored wires (Red for 5V, Black for GND, and Blue for Data/IN), which makes wiring easier in the next steps.
After that, using the Glue Gun, you just glue the NeoPixel Ring to the white moving part as seen in the 2nd picture, making sure that the wires run through the hole.
For extra effect, we used our a laser cutter to etch the semi-transparent plastic of the button's front face, and added a nice little logo. Unfortunately, we didn't have the P-Space logo in vector format at the time, so we used codebender's logo instead. Still looks great if you ask me ;)
Now, last but not least, snap all the pieces back together, making sure that you align the various holes correctly, and that the wires don't get caught anywhere. Your button is ready to go :)
Step 2: Wiring
We really wanted the whole thing to be independent, so for all intents and purposes, it's a drop-in replacement to a standard button, only it requires power to operate.
In order to make it independent, we used an Adafruit Trinket 5V, which controls the NeoPixel ring to show a nice rainbow effect, and flashes the NeoPixel Ring green twice when the Dome Button is pressed. It will then go back to showing the rainbow effect.
We also use one of the Trinket's pins as an output, and toggle it when a button is pressed. By connecting this output to an Arduino's Digital Input*, and toggling it between 0V and 5V, we can make an Arduino think that a button is pressed.
*We also need to connect the two Grounds (GND) together. This is called "common ground", and it's necessary in order for two circuits to work together
Step 3: The Code
That's the easy part. Just use the code provided here to program your Adafruit Trinket.
I've embedded the code from codebender, so that you can use it without having to install the Arduino IDE or any libraries. Just install the browser plugin, select the Adafruit Trinket, and click Run on Arduino.
Note: The Trinket doesn't show up as a Serial Port, but rather as a usbtinyisp programmer. That means that you will not see a COM port when you connect it, and there's no need to select a port to program it. Also, right now, codebender doesn't support usbtinyisp on Chrome, so you'll have to use firefox if you want to program a Trinket.
Keep in mind that the Trinket doesn't auto-reset, so you will have to press the reset button manually when you flash it.
Step 4: Enjoy!
Hope you enjoyed this. On my next Instructable, I will show the main circuit for our Space Status Button, that uses an Arduino & Wi-Fi Shield to control the hackerspace's status, an RGB LCD to show the current status, and uses the Dome Button we just made as a button to change the status.