Home > Arduino, Code > Arduino Leonardo

Arduino Leonardo

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

REMOTE “KEYBOARD CONTROL”

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
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.send_now();

// press ALT while still holding CTRL
Keyboard.set_modifier(MODIFIERKEY_CTRL | MODIFIERKEY_ALT);
Keyboard.send_now();

// press DELETE, while CLTR and ALT still held
Keyboard.set_key1(KEY_DELETE);
Keyboard.send_now();

// release all the keys at the same instant
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();

ARDUINO vs TEENSYDUINO

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:
* USBAPI.h
* 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 MIDI
  • 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

TRYING LEONARDO WITHOUT LEONARDO

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.

About these ads
  1. w4ni
    2012/08/19 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
      2012/08/19 at 23:59

      The UNO is probably the last DIP-based Arduino…

  1. 2012/01/31 at 16:11
  2. 2012/02/11 at 22:06
  3. 2012/02/15 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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 207 other followers