Getting Your Hands Dirty: Teensy USB Development Board Review

teensy_feat

Here at “The Powerbase”, we usually keep things firmly in the consumer hardware and software area; about the most intensive work we do is compile software from source if there’s no binary available. But in the era of “Makers”, hardware development has become so cheap and easy that literally anyone can get into electronics without any prior experience.

With that in mind, we’ll be trying something a little different. Let us know what you think in the comments.

What’s a Microcontroller?

The vast majority of modern electronics projects are done with microcontrollers (MCUs), which are essentially tiny single-chip computers. They have a processor, RAM, and storage space, just like any other computer; only very limited amounts of it. This means that, unlike a traditional computer that runs many different software programs at once, an MCU runs one single program continuously. Writing these programs is at the heart of any MCU project, and is where you will spend the majority of your time; when using MCUs, connecting up the actual hardware to the chip is by far the easiest part of the process.

The most popular MCU on the market right now is undeniably the Arduino, but it isn’t the only one. Today we’ll be looking at the Teensy, another low-cost MCU which is geared specifically to making it easier to create USB controlled projects.

Teensy USB Development Board

The Teensy was created by  Paul Stoffregen, and primarily distributed via his site, PJRC. The Teensy is also available via retailers such as adafruit and ACE Hackware. The Teensy is currently on version 2.0 (though a Kickstarter campaign for Teensy 3.0 ended successfully just days ago), and comes in two different variants:

Teensy Hardware Variants

[one_half last="no"]

Teensy

  • CPU: ATMEGA32U4
  • RAM: 2.5 KB
  • Flash: 32 KB
  • EEPROM 1 KB
  • I/O Pins: 25
  • Analog Inputs: 12
  • PWM: 7
[/one_half]

[one_half last="yes"]

Teensy++

  • CPU: AT90USB1286
  • RAM: 8 KB
  • Flash: 128 KB
  • EEPROM 4 KB
  • I/O Pins: 46
  • Analog Inputs: 8
  • PWM: 9
[/one_half]

The Teensy++ is more powerful than the standard version, and includes more input/output pins; most projects will probably be fine for the base model Teensy, but having the option to upgrade is nice. The standard Teensy retails for $16, and the Teensy++ for $24, which makes them very competitively priced for the features they have.

The main advantage of the Teensy is that it’s designed from the ground up for USB projects and connectivity, it’s extremely easy to turn the Teensy into something like a USB keyboard and mouse, and directly take control over a computer without any special drivers: for example you could use a Teensy to read several hardware sensors and “type” their values directly into a form on the computer.

You can program the Teensy in straight C, but the Teensy also includes a compatibility layer which let’s it work with the official Arduino tools. That means that existing programs (often called “Sketches”) written for the Arduino can be run on the Teensy. This is a big advantage for beginners, as the Arduino software environment is considerably simplified when compared to normal C, and makes it much easier to get a program up and running a new user.

Teensy Setup

When you order your Teensy, you’ll have the choice of getting it with or without header pins which let you easily plug it into a breadboard for prototyping your circuit layouts. It’s easy enough to solder on your own headers, but for the ~$3 price difference it’s probably worth it to be able to use your new Teensy as soon as it arrives at your doorstep.

As the name implies, the Teensy is very small.

Programming the Teensy with binary programs is done with either the graphical or command line tools offered, both of which are available for Windows, Mac OS, and 32/64 bit Linux. Getting the Teensy working on Linux requires the installation of a new UDEV rule to make sure it’s device node gets created with the proper permissions, which is available via the outstanding documentation on the PJRC site.

Software Development

As previously mentioned, you can develop on the Teensy with straight C. If that’s the route you want to take, you can go ahead and grab a few of the example C programs from the PJRC site, modify them with your editor of choice, and compile them for the Teensy’s specific processor with the GCC compiler. Development in C doesn’t require any software that won’t be available in the repositories of most major Linux distributions, which is a big plus.

On the other hand, programming a bare MCU in C is not very forgiving. The intricacies of setting up the chip’s hardware and low-level tasks like managing the meager RAM take considerable knowledge of both the C language and the chip’s architecture. The advantage of pure C programming is that you can get the maximum performance out of the hardware, but it won’t come without some work.

If you’d rather go the more user friendly route, you can install the Arduino compatibility files and program the Teensy in the simplified language it uses. The Arduino’s language is still C, but things like setting up the hardware are done behind the scenes. The Teensy running in Arduino mode can also make use of the considerable library of software and documentation that has been built up by the Arduino community, saving you massive amounts of time and effort.

For example, the entire Arduino program to make the Teensy pretend to be a USB keyboard and type out “www.thepowerbase.com” over and over again looks like this:

void setup()
void loop()
{
Keyboard.print("www.thepowerbase.com");
delay(5000);
}

Not Fully Open

No matter which route you chose, C or Arduino, the tools used to develop software for the Teensy are all open source. In addition, Peter has made the PCB diagrams and parts lists for the Teensy hardware available on his site.

Unfortunately, some parts of the design are completely closed, such as the source for the Teensy’s bootloader. Even the parts which are well documented are not licensed for redistribution and copying. You’re free to look at (most of) how the Teensy works, but you aren’t free to tweak the design or create your own. In fact, there’s been a rash of counterfeit Teensys which Peter is none too happy about.

This is in direct contrast with the Arduino, which is a fully open hardware project. There are many Arduino clones, which the community excepts as worthwhile variations of the core Arduino hardware.

It’s interesting to consider that both the Arduino and Teensy have third party clones due to their popularity, but one is considered “counterfeit” and the other “an alternative”, simply because of the licensing their respective creators chose. In light of this, it seems rather silly to keep the Teensy’s hardware under wraps, but the choice is Peter’s alone.

Conclusion

There are a number of choices out there if you’re looking to get into MCU hacking, and it can be difficult to pick just one out of the fray.

If your goal is to develop USB based hardware which can easily be interfaced with other computers and devices, the Teensy may just be what you’re looking for. For less than half the cost of the Arduino, you can have a very capable board that runs a good deal of the same software in a much smaller form factor. The smaller size and price tag of the Teensy make it more suitable for leaving inside of your finished projects when compared to the Arduino, which is really designed more for prototyping.

On the other hand, if you’re looking for a product that’s fully open and has a larger library of guaranteed compatible code, the fan favorite Arduino may be your safest bet.

If you’d like to see more hardware oriented posts here on “The Powerbase”, such as in-depth programming guides and project walkthroughs, let us know in the comments.


Tom Nardi

Tom is a Network Engineer with focus on GNU/Linux and open source software. He is a frequent submitter to "2600", and maintains a personal site of his projects and areas of research at: www.digifail.com .

Related posts

Top