|Challenge coin replaced with silver dollar in this photo.|
|Behold the power of the Arduino Micro!|
…an Arduino Micro! At first glance, it's all of the majesty of an Arduino used, essentially, to alternate the voltage value on a pin between high and low, switching an LED on and off. Of course, I couldn't let all of that horsepower go to waste, so read on to find out what easter eggs I managed to cram under the hood.
Above and beyond the blinking light, here's were my ideas:
- Challenge coin? Let's turn that into a push button!
- Regular LED? No, no, no! RGB LED!
- An Arduino Micro can represent itself as a Keyboard and Mouse? No one could possibly do anything mischievous with that!
- Mount the coin on a tactile push button switch, effectively turning it into a push button.
- Use an RGB LED and implement the following effects:
- Fade-in/fade-out blinking white light.
- Fade-in/fade-out Red, White, and Blue blinking light
- Fading color wheel going through the colors of the rainbow.
- Morse code library allowing any arbitrary string to be communicated via blinking white light.
- Using the Keyboard/Mouse subroutines, implement a subroutine that randomly causes one of the following effects (hereafter referred to as "random mischief"):
- press ALT-TAB (Change window)
- press CTRL-ALT-DEL (Bring up lock screen)
- press ENTER
- press CTRL-ALT-DEL, then ENTER (Lock a windows workstation)
- press CTRL-ALT-F2 (change to the second virtual terminal in Linux)
- send the cursor to the upper left corner of the screen
- send the cursor to the upper right corner of the screen
- send the cursor to the lower left corner of the screen
- send the cursor to the lower right corner of the screen
- draw a box with the mouse cursor
- press the left-click mouse button
- Implement another Keyboard subroutine that types out a user-specified message.
The code ties all of this functionality together in the following fashion:
- When first powered on, run the blinking white LED subroutine. At the end of each cycle, run a subroutine that 10% of the time kicks off random mischief.
- When button is pressed, switch to the Red-White-Blue fade subroutine.
- During the Red-White-Blue subroutine, at the end of each cycle, run a subroutine that 10% of the time kicks off random mischief. If the switch is pressed, the effect depends on what color is being displayed:
- When fading between colors, the rainbow color wheel is run.
- If pressed when Red, run random mischief.
- If pressed when White, switch back to the blinking white LED subroutine.
- If pressed when Blue, Morse code a going away message via the LED while typing it out character-by-character over USB.
Bill of Materials
The following items were used in this build:
|4" Black Canvas Frame|
|RGB LED (common anode)|
|Tactile switch button|
|Miscellaneous Wires, Staples, etc|
The Build - Prepping the Materials
Remove the canvas from the frame. Remove the excess material from the inside of the frame to make room for the circuit board. Glue the protoboard to the frame (the protoboard will serve as both a circuit board and structure for the going away gift).
The Build - Wiring the Protoboard
Here is the circuit diagram for the Protoboard:
|[Not to scale]|
|All components positioned on the top of the board|
Once you know where the buttons are, figure out the placement of the remaining components based on the remaining space (other than the buttons and LED, all components should go on the bottom of the board). Solder everything in place with the exception of the RGB LED (be especially careful that the three switches are soldered level at approximately the same height to provide a solid base for the coin). Bend the RGB LED lines so they fit in the protoboard holes and take note of which holes you intend to use (simplifying placement of the RGB LED after the canvas is in place). My finished protoboard can be found below (top of board is depicted above):
|Protoboard back, post solder.|
The Build - Putting it all together
With the protoboard finished, wrap the canvas back over the frame and staple it in back in place. From the back of the board, use a needle to punch through the protoboard and canvas in the spots previously identified for the RGB LED. You may need to work a little to get the holes large enough to get the RGB leads through the canvas; work slowly to minimize any unnecessary canvas damage. Once seated, solder the RGB LED in place. Use a black marker to darken the RGB LED wires and/or touch up any canvas damage. Trim and hot glue the flaps of the canvas. Attach the USB cable to the Arduino Micro, and hot glue to the frame. Hot glue the coin to the canvas over the three switches and allow it to cool. Hot glue the frame and battery to the easel. Now we're ready for programming!
The Build - Programming the Arduino
git clone https://github.com/ScratchesTheItch/Going_Away_Gift.git
Once you have the code downloaded, just use Sketch to upload it to your Arduino and you should be good to go (Don't know how? See http://arduino.cc/en/Guide/HomePage for details on how to get your Arduino up and working). You'll know that everything is working correctly when you the LED starts blinking white.