M32_Proj-AwsmBtn-3

Ever since I started writing for MAKE, I’ve kept an eye on all the awesome websites out there for awesome makers and the awesome projects that are posted every day. Luckily for me, there’s no shortage of awesome work to write about. My only difficulty was I needed more words to describe how awesome this stuff is.

To fix this problem, I created the Awesome Button, my own custom USB input device that keys in a random synonym for awesome, on demand. With the Awesome Button, when I’m writing about a project that I like a lot and I get stuck on how to describe it, I hit the big red button on my desk and it takes care of the adjective. Now instead of awesome this and awesome that, I’m writing about incredible robots, fantastic camera hacks, and cool electronics projects.

Materials

Teensy USB Development Board, Version 2.0 $16 — from PJRC (pjrc.com)
Switch, momentary — any style you like. I used a big red one, item #9181 from SparkFun (sparkfun.com).
Enclosure appropriately sized for your button. I used item #270-1807 from RadioShack (radioshack.com). You could also use a spare cardboard box, or laser-cut a custom enclosure
Rubber feet — to mount on bottom of enclosure
Wire, insulated, 22 gauge
USB cable, Standard-A to Mini-B — You probably have a few spares lying around.
Mounting tape, double-sided
Heat-shrink tubing in various sizes. You could use electrical tape instead.

Tools

Computer with USB port
Drill and drill bits — The SparkFun button needs a 1″ hole saw; your button may vary.
Screwdriver
Wire cutters/strippers
Soldering iron and solder
Multimeter (optional) — for troubleshooting

Code

Download and install the Arduino integrated development environment (IDE) from arduino.cc/en/Main/Software.
Install Teensy Loader from pjrc.com/teensy/loader.html.
Install Teensyduino from pjrc.com/teensy/teensyduino.html.
Download the Awesome Button code from github.com/mrichardson23/Awesome-Button.

Project Steps

Build your button.

Measure to find the center of your enclosure and drill a hole for your button. For the SparkFun button, the diameter should be 1″.

Remove the snap-action switch and the LED assembly from the bottom of the button.

Place the button through the hole, screw the ring down, and replace the snap-action switch and LED assembly.

Wire the switch.

Solder a 6″ length of wire to the terminal marked “NO,” which means the circuit between this terminal and the common terminal is “normally open.” When we press the button, it will close the connection between the common and NO terminals.

Solder another 6″ wire to the terminal marked “Common.”

NOTE: There’s no pull-up or pull-down resistor for this digital switch circuit because the code will activate the internal pull-up feature of the ATmega32U4 chip on the Teensy USB board.

Connect the Teensy.

Solder one wire from the button to a ground pin on the Teensy.

Solder the other wire from the button to the pin marked B0.

Attach the Teensy to the enclosure using a small piece

of mounting tape.

Mod the enclosure.

Drill a hole just wide enough for your USB cable to fit through.

For a cleaner look (optional), make this hole the width of the cable itself, not the plugs; then you can cut the cable and feed it through the hole.

Place 4 rubber feet on the bottom corners of the enclosure.

NOTE: To give the Awesome Button a clean look from the outside, I made the hole for the cable just wide enough for the cable itself, not the plugs. (You can skip this step to save time — just tie a good strain-relief knot in the cable inside the box.)

Mod the USB cable (optional).

Cut the USB cord about 3″ from the mini-B side (the smaller of the 2 connectors) and set it aside.

Feed the long end of the cord through the hole in the enclosure, from the outside.

Strip the outer insulation off the cable on each end, and peel away the foil shielding. Strip each of the individual wires inside the cable.

On one cable end, place a piece of heat-shrink tubing on each wire. Then connect the matching wires and solder them together. Slip the heat-shrink over the solder joint and use your soldering iron, hot air, or a lighter flame to shrink it around the joint. You can also use electrical tape.

When you’ve reconnected all the wires, wrap the bundle with electrical tape.

Connect the cable.

Plug the the mini-USB plug into the Teensy, and close up the enclosure. Then plug the other end into your computer.

Upload the code.

Download and install the Arduino integrated development environment (IDE) from arduino.cc/en/Main/Software.

Install Teensy Loader from pjrc.com/teensy/loader.html. Install Teensyduino from pjrc.com/teensy/teensyduino.html. This allows you to use Arduino code and the Arduino IDE to program the Teensy USB microcontroller.

Download the Awesome Button code from github.com/mrichardson23/Awesome-Button and open it in the Arduino IDE. If you’d like to make changes to the list of words, add them to the words array in lines 3–5.

Make sure that the value of the NUMBER_OF_WORDS constant on line 1 is equal to the number of words in the words array

Under the Tools menu, click Board and choose Teensy 2.0.

Under the Tools menu, click USB Type and select Keyboard

+ Mouse + Joystick.

Click the Upload button. A window will appear instructing you to press the button on the Teensy to upload the code. Now, read “Let’s Get Unawesome” to learn how to use it.

Let's get unawesome!

Plug the Awesome Button into the USB port of any

computer. On a machine that isn’t familiar with the device, your operating system may prompt you to hit a particular key so that it can identify the layout of what it thinks is

a keyboard. In most cases, you can safely dismiss this

dialog box and it won’t bother you again.

When you’re writing and you’re about to type your overused word, instead slam your hand down on the Awesome Button and it will key in a random synonym so that you don’t have to worry about which one to use.

If the word that pops up isn’t working for you, you can easily delete it: tap Control-Shift-left arrow on a PC or Option-Shift-left arrow on a Mac to highlight the word and then hit Delete. You could program this key combination into the Awesome Button itself. Or modify the code so that if the button is held down for more than 1 second, it will delete the previous word! Or add a small panel-mount momentary switch to the side of the Awesome Button to do the same thing. Whatever you do, it’ll be … fantastic!