Home > Arduino, Code > Arduino Leonardo

Arduino Leonardo

September 30, 2011 Leave a comment Go to comments

Arduino Leonardo is a lower cost Arduino, but with enhanced capability. The lower cost comes from the use of the ATmega32u4, which has a USB core built in (eliminating one chip out of the board).

Very likely it was inspired by Teensy

In addition, compared to the “regular” Arduino it has the following enhancements:

  • Extra .5K of RAM
  • Additional 4 pins
  • Can be programmed to emulate a USB HID (Human Interface Device -such as a mouse or keyboard)
  • Number of external interrupts?  The chip supports 4 external interrupts. I have not found out how many interrupts are supported by the Arduino s/w

One of the main attractions is the USB HID aspects of the chip. Since I use a computer (iTunes) as music server, you can do some navigation (of  iTunes) with a keyboard. Arduino Leonardo (and Teensy) can be programmed as a keyboard, sending keyboard strokes to the computer through USB.

Update (4/1/12): I got my own teensy


Readers might remember that the “left” and “right” buttons of the Apple remote have not yet been mapped to anything in my code. This is a great opportunity to map these buttons to keystrokes that would allow song navigation in iTunes with the remote control.

You can already do this with “Teensyduino”, the add-on s/w to enable the use of Arduino s/w on the Teensy board. This example shows how to program sending a CTRL-ALT-DELETE sequence to a computer attached to the board:

// press and hold CTRL

// press ALT while still holding CTRL

// press DELETE, while CLTR and ALT still held

// release all the keys at the same instant


There is some information here regarding the support for USB HID in Arduino:

The Arduino 1.0 RC1 (found here: http://code.google.com/p/arduino/wiki/Arduino1 ) includes the core and a single example so you can get a feel for it.  There are a few remaining issues to be fixed and a lot more examples to write and I’d love to hear your feedback.

The core files are in hardware/arduino/cores/arduino.  The relevant bits are:
* USBCore.cpp and .h
* USBDesc.h
* CDC.cpp
* HID.cpp
* plus a few changes in HardwareSerial, main.cpp, Arduino.h, and pins_arduino.h (now located under the new variants/leonardo structure)

This is all subject to change, of course, but this should be pretty close to complete.

The example is in libraries/Mouse.

On the other hand, Teensyduino has bee supporting USB HID for quite some time and it already supports Arduino 1.0 RC1, and everything is documented. Teensy can emulate the following USB devices:

  • USB Mouse
  • USB Keyboard
  • USB Joystick
  • USB Serial

The current support and documentation for USB HID in Arduino is pretty bare. Not enough to write some code [at least for the non-expert]. For the time being I think the only viable option is Teensy.  It is also good to see that the developer of Teensy is also involved in the development of Arduino, so we can expect that all the features of Teensy will be migrated to Arduino


Adafruit board: (Now with Leonardo bootloader)

For now, the Arduino Leonardo board is not yet available for purchase but support for the ATmega32u4 chip is already included in Arduino 1.0 RC1. You can try the software with probably any ATmega32u4-based board. morecat_lab has done just that.

  1. w4ni
    August 19, 2012 at 12:27

    no no stick with uno – the dip socket allows easy cloning which neither teensy or leonardo can do – what arduino needs is a doublesided adc not more adc channels

    • BlogGeanDo
      August 19, 2012 at 23:59

      The UNO is probably the last DIP-based Arduino…

  2. September 14, 2016 at 14:57

    cheap pest control

  3. September 14, 2016 at 14:59

    marketing b2b

  4. Anonymous
    January 19, 2018 at 23:24

    Are they testing this against production? I just checked on legacy STB connected to production feed in Brazil and I see ECM PID in the guide. Here is the info I see:

    Channel 730:
    0: languageIndicator = 1, pid = 700, streamType = 0x03, iso639LanguageCode = por, ecmPid = 3331
    1: languageIndicator = 0, pid = 814, streamType = 0xc7, ecmPid = 0

    Channel 776:
    0: languageIndicator = 1, pid = 676, streamType = 0x03, iso639LanguageCode = por, ecmPid = 3294
    1: languageIndicator = 0, pid = 814, streamType = 0xc7, ecmPid = 0

  1. January 31, 2012 at 16:11
  2. February 11, 2012 at 22:06
  3. February 15, 2012 at 04:44

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s