Building A Better SlideChop With Teensy 3.0

My previous post showed a working prototype for what I’m now calling SlideChop (huge thanks to Eric Anderson for the name!) Since then, I’ve upgraded things a bit and now have a much more stable, much easier to use version. It no longer requires a NodeJS server, and now works on Mac, Linux and Windows.

Teensy 3.0

The secret is in the use of a Teensy 3.0 for the controller. This little device is an Arduino compatible micro controller that has a few very specific advantages: it can emulate a mouse, keyboard, joystick or any other native serial communications device, through the hardware itself! All I had to do was write a little bit of C code to handle the click of the physical button, and then call the method from the Teensy API. Teensy handles the rest for me.

Here are a few images of the Teensy in the hardware setup for the SlideChop:





If you want to build a hardware device that acts as a human input device, you really need to look at getting a Teensy. I highly recommend them. Do note that you’ll need to be comfortable with soldering if you want to use one, though. They don’t come with any header pins attached to them. Be sure to buy pins if you don’t have any on hand (and why don’t you? you always need header pins on hand.)


Once you have the hardware, you’ll want to write software for it. The easiest way to do this is to use the TeensyDuino plugin for the Arduino IDE. There are command line and other tools available for Teensy, but I prefer the TeensyDuino at this point. It’s easy and it works well. It’s also familiar since I’ve been working with Arduino.

Once you have it installed, you’ll get some extra menu items in the Arduino IDE. Select the “Teensy 3.0” from the Board type menu, and then select “Keyboard / Mouse / Joystick” from the “USB Type” menu.




Now the Teensy will emulate a Keyboard / Mouse / Joystick, and you can use the appropriate API for that. There’s no need to include any specific header files or libraries, either. If you have selected the right USB type, then the API is made available without doing anything else.

SlideChop Code

The code for this is available from this repository. It’s fairly simple, but I’m terrible at C code and even worse with run loops. So there are a few bugs in here… most notably is when you hold down the button for a “right click”, it sometimes does a left click as well as a right click. I have no idea why… someone else with better C / run loop skillz can probably school me in this pretty quickly, though.

The Teensy has a built in LED and I’m taking advantage of that. When you plug the SlideChop in to your computer, I blink the LED twice. This tells you that the SlideChop is ready to roll. When you slap the button down, I blink the light. And when you hold the button down for more than a second, I tell the SlideChop to do a right-click and turn the light on for you. This extra little bit of LED goodness is there just to tell you that the code is working.

Misc Other Stuff

The veggie chopper itself is the cheapest one I could find at my local grocery store. I tore the metal blade out of it and then mounted a standard momentary pushbutton on to the platform that sits between the veggie holder and the blade itself. I used a small perf-board and some female headers to create a slot that the Teensy can mount in to. The button also connects to the board the same way, and I used a 10K resistor to create a pull-down resistor setup for the button. The button is mounted to the plastic platform with silicon and soldered to some wires that create the needed 5v power, ground and signal. These wires are soldered to some male header pins that plug in to the female headers on the board.

The veggie compartment has a hole drilled through it with a rubber grommet silicon’d in place to keep it there. I run the USB cable through this and connect the Teensy to my USB port on my laptop. The Teensy is immediately recognized as a generic human input device. It takes about 10 seconds for a new laptop to configure the driver for this, the first time you plug it in. Then you’re good to go! Start slapping that button to use it as a standard mouse click. Hold the button down for a second and it will right click, too.


The Demo Video

Slap-Slides: Arduino Powered Veggie Chopper Slide Deck Controller