
Update! My project has been entered in the Instructables “USB Contest” if you like it please vote here: http://www.instructables.com/id/Reddit-Controller-USB-UpvoteDownvote-button/
Not too long ago I saw the “Awesome Button” video on the Make Magazine podcast. In the video Matt Richardson shows how you can take a Teensy development board and turn it into a simple USB keyboard. In his example everytime a button is pressed a synonym for the word “awesome” is sent to the computer. While this is a pretty neat project the idea of creating a simplified keyboard out of a few buttons is what stuck with me. This lead me to start creating my “Reddit Upvote/Downvote button”.
Reddit is a website that has in the past few months taken over my life. Not unlike Digg it aggregates all the best stuff on the internet and makes it easy to consume. The way posts are sorted or brought to the front page on Reddit has to do with the number of Upvotes and Downvotes a post gets over time. Now while these voting options are usually toggled by clicking arrow icons on the webpage they can also be controlled using keystrokes after installing the Reddit Enhancement Suite. After I found this, all the stars aligned for my project.

I started by sketching out a basic design enclosure and making some measurements for the parts I planned on including. The Teensy development board really is teensy so my project box ended up being pretty tiny. In the gallery below you can see the evolution of the project box. I started off with a pretty large box and scaled down to just big enough to fit what I needed. It’s pretty amazing to be able to print a box that fits your exact project dimensions in about 30 minutes. I also printed up and down arrows, the upvote arrow using red plastic and downvote colored blue with a Sharpie. As usual I’ve uploaded my most recent model to Thingiverse as STLs and Sketchup files. These can be downloaded and printed in the comfort of your own home (assuming you own a 3D printer of course).
- Makerbotting away
- Printing the top to my box
- The evolution of my project box
Programming the keyboard functions on the Teensy is surprisingly simple. There are great instructions on the Teensy development board page for sending keystrokes to your computer and because the board identifies itself as a USB keyboard it works when plugged into a PC or Mac with no additional software! One note: to use the USB keyboard mode you must use the “Teensyduino” software which allows you to program the Teensy using the Arduino programming language and IDE rather than the native Teensy language. I’ve included the code in full at the bottom of the post, but to give a brief overview, when the upvote button is pressed the key combination “CTRL + SHIFT + A” is sent to the computer over USB, likewise if downvote is pressed “CTRL + SHIFT + Z” is sent to the computer. I defined these keystrokes in the Reddit Enhancement Suite manually because they seemed like a key combination that wouldn’t conflict with other programs (default is “a” and “z”).
Above is a drawing of the circuit I put together for the buttons. As you can see it’s really simple and basically an exact copy of the “Button” example on the Arduino website. I moved the circuit from my breadboard to a scrap of circuit board I had left over from my Arc Reactor project and soldered everything down. Since I was looking to fit this into a pretty small space my tolerances (wire length, etc) were also small. Much to my surprise everything worked on my first attempt to move it to a finished board. The only thing left to do was reconnect the USB cord I snipped in half to fit into my project box and put a couple dabs of hot glue on the lid to keep it closed.
- Programming my Teensy
- Prototyping my circuit on a breadboard
- Fully constructed electronics
- Fully constructed electronics side view
- Soldering the USB cable back together
- Teensy and circuit board fit into my project box
Below is a collection of video clips I took while putting this project together. I think it turned out pretty nice and is a great example of the different ways to change a previous project (yours or in this case, someone else’s the “Awesome Button”) into something to fit your needs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | /*
Reddit Upvote/Downvote Button
This code sends the keystroke "CTRL + SHIFT + A" or "CTRL + SHIFT + Z" to your PC
or Mac. Make sure you set your Arduino compatible board to "Keyboard + Mouse" in
the "USB Type" menu. Hotkeys can be changed easily, I've added comments to make it
easier to find.
For this to work with Reddit as an Upvote/Downvote button you will need to install
Reddit Enhancement Suite (http://reddit.honestbleeps.com/) and set your Upvote and
Downvote hotkeys to the ones assigned in this Arduino sketch.
Code examples edited and reworked from http://wwww.arduino.cc and
http://www.pjrc.com/teensy
TheNewHobbyist 2011 <http://www.thenewhobbyist.com>
*/
// The inputs you're using for button presses
const int upVote = 8; // Upvote
const int downVote = 5; // Downvote
int upVoteStatus = 0;
int downVoteStatus = 0;
void setup() {
pinMode(upVote, INPUT);
pinMode(downVote, INPUT);
}
void loop(){
// Check the buttons
upVoteStatus = digitalRead(upVote);
downVoteStatus = digitalRead(downVote);
// If Upvote button is pressed
if (upVoteStatus == HIGH) {
// Change the following two lines to change the keys sent
Keyboard.set_modifier(MODIFIERKEY_CTRL | MODIFIERKEY_SHIFT);
Keyboard.set_key1(KEY_A);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
delay(500);
}
// If Downvote button is pressed
if (downVoteStatus == HIGH) {
// Change the following two lines to change the keys sent
Keyboard.set_modifier(MODIFIERKEY_CTRL | MODIFIERKEY_SHIFT);
Keyboard.set_key1(KEY_Z);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
delay(500);
}
} |











My name is Chris. I'm a Chicago area maker and 3D printing enthusiast. This blog is a home for my DIY projects, 3D designs and other miscellany.






Justin
July 29, 2011 at 10:29 am
That’s very cool. Any chance you would sell these as a kit?
chris
July 29, 2011 at 10:41 am
I’ve actually been looking for a reason to get some printed circuit boards made. Depending on interest I could totally see making this a kit. Stay tuned…
Adrian
July 29, 2011 at 12:04 pm
I believe there’s a bug in the code you posted (more like a spelling mistake).
You named the variables up/downVoteState in the declaration but you’re using up/downVoteStatus in the IF (State vs Status).
Cool project
chris
July 29, 2011 at 12:06 pm
Nice catch, I tried to tidy everything up for easy reading before posting it and it looks like that slipped by me. Thanks!
hotdog
July 29, 2011 at 11:35 pm
what is this music? its great!
chris
July 30, 2011 at 10:43 am
It’s Powerhouse by Raymond Scott. It was used for pretty much any/every cartoon factory scene in Looney Tunes. Classic stuff.
James
July 29, 2011 at 8:41 pm
Ha! Nice one. I’m loving the music too!
USB Reddit Upvote / Downvote butonul | ro-Stire
July 30, 2011 at 1:31 pm
[...] a devenit recent un auto-declarat Reddit dependent şi a vrut să construiască ceva care să eficientiza procesul de votare pe posturi . Inspirat de hack buton Awesome prezentate pe face un pic inapoi, el a crezut că o upvote [...]
USB Reddit Upvote/Downvote button | The Depot of Talk
July 30, 2011 at 3:01 pm
[...] has recently become a self-declared Reddit addict and wanted to build something that would streamline the process of voting on posts. Inspired by the Awesome Button hack featured on Make a little while back, he thought that a [...]
Bill Porter
July 31, 2011 at 1:23 am
Any reason you used external pull down resistors instead of the AVR’s internal pull-ups?
chris
July 31, 2011 at 11:03 am
Bill,
I’m still somewhat new to working with Arduino and compatibles. I built my circuit off the “Button” tutorial on Arduino.cc. While it works I’d be willing to try other methods. Is there an advantage of doing it the other way?
Bill
August 2, 2011 at 4:13 pm
The only advantage is it elminates the resistors and a few wires from your schematic. I think the Arduino example did it with the external resistor just so new beginners don’t get confused. When you use the internal pull-up resistors, you only need one wire to the switch, and a second wire to ground; so when the button is pressed it connects the I/O line to ground. But this mean in your code, LOW = switch pressed and HIGH = not pressed. Which can seem a little backwards, but it works just as well with fewer parts.
Anyway, welcome to Arduino!
Pete Prodoehl
August 3, 2011 at 7:08 am
I did the same thing with my first Teensy project… Next time around I got wise to just using the internal pullup resistor.
Also, great project, thanks for sharing it!
randy random
August 1, 2011 at 2:52 am
Hey! This looks really cool. Been using a K8055 myself for small input/output projects. But that board looks fantastic.
I do have a question, a bit on the side of the project.
What notebook is that? It seems awesome with the header like that. I always end up writing that stuff down in the top myself.
chris
August 1, 2011 at 8:49 am
It’s a Maker’s Notebook from Make Magazine. It has the header and grid as you mentioned and a lot of helpful info in the back pages (resistor key, handy formulas, etc). It also has a pocket in the back like a Moleskine note book. It’s pricey at ~$20 (I got mine as a free gift for ordering way too many items from the Make store) but it’s actually really nice and I’d buy another when I run out of pages.
Okay, Whatever. » Blog Archive » Google Reader Shared Items 2011-08-04
August 3, 2011 at 11:04 pm
[...] your upvote really count with this delightful USB Upvote Button box, created by Chris Krueger as a tangible accompaniment to the Reddit Enhancement Suite. [via [...]
Jamie
August 4, 2011 at 4:25 am
As the blue Sharpie ink on the downvote arrow wears off over time, yet the red plastic on the upvote arrow remains cheerful and bright, do you worry that people who see your device over the months will become convinced that you’re hating on everything you view on Reddit, since you’ve ‘clearly’ been working it a hell of a lot more? : )
chris
August 4, 2011 at 8:53 am
At this point I will be viewed as history’s greatest monster by all my Reddior peers.
Vote Up Button | TechMASH
August 9, 2011 at 5:50 am
[...] this is something that makes voting fun and easy just the way that it should be. It is by the New Hobbyist, who to their credit actually make some really cool stuff and this is one of those really cool [...]
Vote Up Button | TechMASH
August 9, 2011 at 5:50 am
[...] this is something that makes voting fun and easy just the way that it should be. It is by the New Hobbyist, who to their credit actually make some really cool stuff and this is one of those really cool [...]
sjking2000
October 17, 2011 at 3:59 pm
Instant awesomeness. I want to try this with an instapaper button, send email (Firefox ubiquity) …