Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

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.

Steps

Step #1: Build your button.

PrevNext
The Awesome ButtonThe Awesome ButtonThe Awesome 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\".

Step #2:

PrevNext
The Awesome ButtonThe Awesome ButtonThe Awesome ButtonThe Awesome Button
  • 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.

Step #3: Wire the switch.

PrevNext
The Awesome Button
  • 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.

Step #4: Connect the Teensy.

PrevNext
The Awesome ButtonThe Awesome ButtonThe Awesome Button
  • 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.

Step #5: Mod the enclosure.

PrevNext
The Awesome Button
  • 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.)

Step #6: Mod the USB cable (optional).

PrevNext
The Awesome ButtonThe Awesome ButtonThe Awesome ButtonThe Awesome Button
  • 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.

Step #7:

PrevNext
The Awesome ButtonThe Awesome ButtonThe Awesome Button
  • 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.

Step #8: Connect the cable.

PrevNext
The Awesome Button

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

Step #9: Upload the code.

PrevNext
The Awesome Button
  • 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.

Step #10: Let's get unawesome!

PrevNext
The Awesome Button
  • 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!
Matt Richardson

Matt Richardson

Matt Richardson is a Brooklyn-based creative technologist, Contributing Editor at MAKE, and Resident Research Fellow at New York University’s Interactive Telecommunications Program (ITP). He’s the co-author of Getting Started with Raspberry Pi and the author of Getting Started with BeagleBone.


blog comments powered by Disqus

Featured Products from the MakerShed

Follow

Get every new post delivered to your Inbox.

Join 25,777 other followers