An Overlooked Arduino

This is a guest blog post from Andrew Shepherd. Andrew has been studying electronics in earnest for over a decade and loves working with his mind and hands. He specializes in analog electronics, but his interests are eclectic and span seemingly unrelated areas.


The Arduino Leonardo came out a few years ago but somehow flew under the radar to most people. There are rather few blogs and tutorials written about it around the web. Older boards like the Duemilanove, Arduino Uno and their clones are so ubiquitous that they are used in most projects where a basic microcontroller is needed. Later models like the Due and Yun fit the bill for more complicated computational needs. The Leonardo sits between these two extremes. It is more useful and more powerful than a standard Uno with the ATmega328 chip. It uses a different chip (ATmega32u4), which has a built in USB interface among other things. The cost is nearly the same as a ATmega328 model Arduino (like the Uno or Duemilanove), but is more capable.

Arduino Uno
Arduino Leonardo

What’s Better?

  • More analog pins – the Leonardo has 12. A0-A5 are dedicated analog pins, and A6-A11 are on digital pins. Just like the Uno, the input resolution is 10 bits.
  • All of the digital and analog pins can be used as digital inputs and outputs. There are also seven PWM pins instead of six, as with the Uno.
  • Since their is no external USB interface chip, the ATmega32u4 can directly talk to your computer. In other words, it can easily behave like a mouse or a keyboard. This makes for some interesting applications for hardware-software automation or video game controllers. There are handy libraries available for mice and keyboards.

Leonardo in Action

A very common way to use the Leonardo is to create a circuit that can press keys on your keyboard – for instance if you wanted some piece of hardware to trigger a repeatable event on screen. Maybe you want to advance slides in a PowerPoint presentation by pressing one of the arrow keys; it would be ideal to press the key by a serial command instead of a servo or solenoid pushing it. Any device using the ATmega32u4 chip and the keyboard library makes this a simple task.

A slightly more sophisticated use of this feature would be to make a controller or some sort of haptic device to control a p5 script or even a video game. There will not likely be a shortage of pins, since there are 20 available and 12 of those can be analog. You can experiment with new types of user interfaces and not worry as much about getting it to talk to your computer. In fact, the Arduino Esplora is basically a Leonardo in the form of a controller designed exactly for this purpose.

Other Devices with the ATmega32u4 Chip

SparkFun Pro Micro

Arduino Micro (or SparkFun Pro Micro) - SparkFun has a 5V and a 3.3V version.


SparkFun Fio V3

SparkFun Fio - Similar to the Micro/Pro Micro but is LiPo battery-compatible and is even capable of charging the battery when plugged into a USB port. It also has an XBee socket for wireless capability in a small package.


Qduino Mini

Qduino Mini - Like the Fio, it can charge your battery, but it also has RGB LEDs and a library for a “battery fuel gauge.” Naturally, it’s slightly smaller than the Fio because it doesn’t have the XBee socket.


Arduino Esplora

Arduino Esplora - It’s similar to a Leonardo but in the form of a video game controller. It has built-in buttons, a joystick and some other built-in hardware.


Arduino Yun

Arduino Yun - Basically Arduino’s attempt at a Raspberry Pi since it runs Linux. The ATmega32u4 is most likely ancillary and used for its serial communication capability.


LilyPad Arduino USB

LilyPad USB - Probably the smallest device listed here. Designed specifically for fabrics and wearable devices. They sell a 3.3V version so it can run from a single cell 3.8V LiPo battery.


ATmega32u4 with Pins
ATmega32u4 with Pads

Two versions of the ATmega32u4 in non-PTH form.

Unfortunately, the ATmega32u4 chip does not come in a thru-hole package unlike the ATmega328. This might be a problem if you ever want to “roll your own” Arduino for size or cost purposes. However, the price for a Leonardo or similar device is comparable to that of an Uno, and the size can be made quite small with the Micro or LilyPad. In this regard, the inability to easily roll your own is almost a non-issue.

Caveats

Because the Leonardo has a different chip than the Uno, there will be some slight differences when it comes to compatibility. Certain shields and libraries might have discrepancies when used on the Leonardo. Usually, pre-existing products and libraries make sure to mention somewhere if they can be used or not. If you are planning on making your own libraries or shields however, be aware of the slight differences as you plan your design.

comments | comment feed

Leave a Reply

Your email address will not be published. Required fields are marked *