An Overlooked Arduino

Let's take a second look at the Arduino Leonardo with Andrew Shepherd.

Favorited Favorite 1

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 9 comments

  • I feel like this should be required reading for people who are starting out with arduino and want to get a little more out of their devices. The Sparkfun Pro Micro is especially nice because you don't need an FTDI chip to load stuff onto it. That micro USB does the trick.

  • Olimex manufacture the olimexino 32u4 which is comparable with the arduino also has battery charge and auto switch over of power and can use 3.3 volt and 5 volt shields via a switch on board its also covered by the arduino ide. It's worth a look I have 5 and they are fabulous little boards

  • Hi, thanks for sharing this wonderful project idea. It will be helpful for students to develop their project and practical skills.

  • I have used the Leonardo/32u4 for years.

    Having said that, I would still point newbies to the Uno/328p to start and then push them to Zero/SAMD21 for more features.

    I might even argue skipping the AVR step all together!

  • I enjoyed the read but notice you didn't make mention of the fact that the Leonardo is a depricated/discontinued board from Arduino. I've found that knowing about the 32u4 is useful, and I've bought some of the alternate boards you list for making USB peripheral devices.

    I feel like maybe you could update this article and put that it's discontinued in the Caveats section.

  • The one persistent problem that I've had with the 32U4 is that sometimes it won't talk to my computer. I've found that plugging/unplugging the USB sometimes works, sometimes I plug it into a different USB port. Sometimes I get really frustrated and reboot. Eventually, it always works, but can take several tries. Doesn't seem to be computer specific either. Never have this problem with the 328; I figure that it is the USB serial interface on the 32u4 that is the problem. The annoyance factor makes me stay away from the Leonardo, pro micro, etc. I just don't care anymore, there are so many other options.

    • Not sure if this is the cause of your issue, but I've noticed 32U4 based boards often get assigned different serial ports when reset. So when reset for programming, they'll come back on a different port than the one the IDE is expecting and so it just times out. Probably doesn't have much to do with the 32U4 as it does with Windows or whatever OS you're using.

      Regarding the 32U4 in general, I really like them. So much easier to design around vs. a 328p since you need so much fewer components to work into a board. And they're inexpensive enough to use even when you don't need all the I/O pins.

  • And more/higher resolution timers on the 32u4 vs the 328.

  • The Leonardo is awesome! Another good thing about it is that without the Uno's second microcontroller, a commercial product made from the Leonardo has less extra parts and can still implement the full Arduino bootloader.

Related Posts

Recent Posts

Tags


All Tags