posts tagged with the keyword ‘teensy’


X11_ssh_tunnelling by Tene~commonswiki

When I first started using *nix-based operating systems I played with xeyes, which is a “follow the mouse X demo” and a very simple program. (Really, it’s not fancy, but 25 years ago, it was sort of neat.)

A few days before Maker Faire Milwaukee Vishal and I were brainstorming ideas for something done in Processing to show with a projector, and I suggested xeyes because it was silly and simple and we hadn’t slept much.

I figured there was a Processing version out there, and our old pal Alex has one at Tinkerlog. I grabbed it and started hacking. Someone mentioned putting the old Milwaukee Makerspace logo in place and putting the eyes on it. (It may have been me, I honestly don’t remember, again… not much sleep.)

Then Lexie showed up and I ran the demo and she suggested there should be a fly for the cursor. In my tired state I thought this was a great idea, and then checked on how cursors work in Processing (yes, you can use an image) and then I found a fly on and added it.


Now we had something that let you move the mouse around and the fly would move and the eyes would follow it. I sent Vishal the code and he had a trackpad he thought about using with it… But then he said it would be cool if it just moved around on its own. I didn’t have time to write the code, so Vishal asked if I had a Teensy on me, and since I always do, I gave it to him. He then wrote code to make the Teensy act as a mouse and randomly move around the screen.

We hacked this all together pretty quickly, and it was fun, and not super-impressive, but we liked it. Oh, I also made a Processing.js version you can try. (It’s an early test version before I added the fly.)


A few days after Maker Faire I got an email from Bryan Cera about running Processing on the Raspberry Pi, which we had been discussing. He got it working, so I finally circled back around to give it a try. Well, it worked, and I got this mms-xeyes thing running as a full-on application.

This is pretty awesome. I mean, the cursor is a little weird, and disappears when you do not move the mouse (but reappears when you do move it) but overall it does work, and I’m pretty pleased with it. I’ve got a few ideas that involve Raspberry Pi computers running Processing sketches, so yeah… overall, this is good.


Teensy++ 2.0 LED Pin

Yes, this post is actually titled “Teensy++ 2.0 LED Pin” because it’s really specific. This is the solution to a problem that took me a while to fix. Actually, it didn’t take a long time to fix, it just took a long time for me to figure it out and implement it. (Maybe it did take a long time for me to fix…)

Anyway, when using most pins on a Teensy++ 2.0 (and probably every other Teensy) with Arduino code, you may have an issue using the LED pin as an input, because it functions differently than all the other pins. You might say “Hey, just use another pin!” but the project I did required every single pin on the Teensy++ 2.0. (Yes, all 46 pins!)

The code is below. The LED pin is sort of treated opposite of how other pins are treated. You short it with +5v instead of ground, and swap the risingEdge and fallingEdge typically used with the bounce library.

// LEDPinButton

#include <Bounce.h>
Bounce buttonD6 = Bounce(6, 80); // LED Pin - tie to +5v instead of GND
Bounce buttonD7 = Bounce(7, 80); // Normal Pin - tie to GND
void setup() {
  pinMode(PIN_D6, INPUT);        // LED Pin - use INPUT not INPUT_PULLUP
  pinMode(PIN_D7, INPUT_PULLUP);
void loop() {
  // D6 - LED Pin - tie to +5v instead of GND
  // use risingEdge instead of fallingEdge
  // a
  if (buttonD6.risingEdge()) {
  if (buttonD6.fallingEdge()) {
  // D7 - Normal Pin - tie to GND
  // b
  if (buttonD7.fallingEdge()) {
  if (buttonD7.risingEdge()) {

You can also grab this code from github.


Yeahs! Pi!

I presented A Life Time of Yeahs! at Bay View Gallery Night but I didn’t really post much about how it was made, so I’ll do that now, as well as talk about the shortcomings. Above you can see the front and the back. The front piece is actually from an IKEA picture frame I found in the trash. It was a nice smooth MDF-like surface, so I figured it would take the vinyl and paint pretty well.

For the illustration of Mr. Rollins I did a few searches and didn’t find anything that was perfect, so I grabbed a few images as reference and traced/drew my own in Inkscape. I then created a stencil by cutting vinyl on the Silhouette Cameo (including the lettering) and stuck it all down to the IKEA board which I had already painted white.

With the vinyl in place I then painted it all flat black. I didn’t leave it all smooth as it sort of looked too polished, so I smeared some paint around with a brush and then with my fingers so it gave it some texture. I’m still not sure that was the right thing to do, but I did it, and there’s no going back.

Once I had the front piece done I found some scrap wood for the frame in my garage and cut it on the table saw. I made sure the wood was wide enough to fit the speakers into. It was, but as I’ll get to in a bit, wider would have been better…


The back of the piece contains a Raspberry Pi, a set of speakers, and a Teensy 3.0 with a few buttons connected to it. It’s all powered by a power bank from Brown Dog Gadgets.)

The speakers are USB powered so they, along with the Raspberry Pi, connect to the power bank. Turning on the power bank boots up the Pi and starts a script called “” which is a Perl script that starts running and waits for keyboard input to do something. That “something” is playing an audio file if you press the red button on the front of the piece. There’s also a small button on the back of the piece that safely shuts down the Pi if you want to turn it all off.

Yeahs! Pi!

It’s been suggested that the Teensy in addition to the Raspberry Pi is overkill, and… it is! I originally had a separate project that used some of this code and hardware and ended up just grabbing what I had lying around because it was quick and easy. Sometimes it works out that way, and that’s fine…

I should have gone with the more powerful speakers I had, because as I learned last time, if you’re doing something with audio in a public space, make it much louder than you think it should be. I had a louder pair of speakers, but they would have required AC power, so I compromised. Oh well. (You can’t tell from the photo, but there are speaker hole drilled in the side of the frame.)

I’ll probably clean up the code and publish it eventually, but essentially it gets kicked off by /etc/rc.local and runs it a continual loop waiting for a key to be pressed. If you press “a” (the button on the front) it randomly selects a WAV file and plays it. If you press the button on the back the script sees a “r” and shuts down. Why an “r” instead of an “s”? I don’t know… There’s another button that was taped up that types a “q” for quit, which quits the script, and is handy for debugging or troubleshooting if you have a monitor and keyboard attached.

That’s the summary of my Raspberry Pi based interactive painting titled “A Life Time of Yeahs!”

I hope you enjoyed it… As always, let me know if you have any questions.


In case you’re wondering, this is what you see the first time a computer running Mac OX sees a Teensy (or other controller) acting as a USB HID device. (You know, like a keyboard.)

Mac OS X Keyboard

No worries, just hit the “Continue” button…

Mac OS X Keyboard

And then hit the little red dot in the upper left to close the window. Hopefully you’ll only see this the first time.

That’s it!


Teensy 2.0
Teensy is teensy

For the past few years I’ve been building devices that can emulate computer keyboards. Typically I’ve used the Teensy microcontrollers for this along with the Arduino IDE and the Teensyduino add-on. The things you can do with a Teensy to emulate a keyboard are very impressive! Basically, it’s the best way I know of to create your own custom USB keyboard.

Size matters – A-Star with Arduino Micro and Leonardo

When the Arduino Leonardo was introduced, one of the features I was interested in was the ability to emulate a USB keyboard. I never actually got a Leonardo to test this with, mainly because the form factor was too large for my projects. Sometimes shield compatibility is good, sometimes the smallest board wins.

Size matters!

I recently got a Pololu A-Star 32U4 Micro, which is a tiny (and cheap, under $13USD) board very similar to a Leonardo, once again using the Atmel ATmega32U4.

There may be a little bit of work involved in getting the A-Star up and running. There are drivers needed if using Windows, and (supposedly) a little more work to get things going with Linux. I had no issues with Mac OS X, but I’m pretty familiar with add-ons for the Arduino IDE due to using Teensyduino. You can also just pretend this is an Arduino Leonardo and that seems to work fine.

(I also can’t tell if the Pololu A-Star 32U4 Micro is open source hardware. They do have a bunch of files available, but I did not see an explicit “Open Hardware” note anywhere. It’s worth mentioning that the Teensy is not open source hardware. If that’s not a big deal to you, then it’s not a big deal to you. The official Arduino hardware is of course, open source.)

I’ll probably keep experimenting with the Pololu A-Star as a keyboard emulator for simple things, and stick with the Teensy for more complex things. I’ve also heard that the Teensy 2.0 will disappear in the future, which isn’t a huge deal, as the Teensy 3.1 is a big improvement over it, but the 3.1 does cost a bit more than the 2.0, so that’s one factor to consider when evaluating which board to use.

Have fun building your own keyboard!

Update #1: I’ve been talking to Pololu and they suggested the A-Star may actually be able to use the Teensyduino Keyboard libraries. I’m awaiting more info on this, as it would be an exciting development.

Update #2: It looks like the Teensyduino Keyboard libraries cannot be installed onto the A-Star, which is good to know. But don’t worry, I’ll be using the A-Star for some future projects anyway. ;)

« Older Entries |

buy the button:

Buy The Button

top recent artists: