Introduction: Step by Step Guide to the Arduino Leonardo
The Arduino team is now shipping their latest creation - the Leonardo. It is the first Arduino to use Atmel’s ATmegaXU4 series chip with built-in USB. This change is big and it has big benefits. In addition to the built-in USB, it offers more digital and analog pins. This step by step guide gives you the details you need to know to start using it.
For a more comprehensive guide, see my article - Arduino Leonardo versus Uno – What’s New.
Step 1: More Digital Pins
- D14 – MISO – PB3
- D15 – SCK – PB1
- D16 – MOSI – PB2
- D17 – SS – PB0
Step 2: Extra PWM Pin
- D3: 8-bit timer0
- D5: 16-bit timer1&3
- D6: 10-bit timer4
- D9: 16-bit timer1&3
- D10: 16-bit timer1&3
- D11: 8-bit timer0
- D13: 10-bit timer4
Step 3: More Analog Pins
The correspondence of each analog with their digital counterparts is as follows:
- A0 – D18
- A1 – D19
- A2 – D20
- A3 – D21
- A4 – D22
- A5 – D23
- A6 – D4
- A7 – D6
- A8 – D8
- A9 – D9
- A10 – D10
- A11 – D12
Step 4: SDA/SCL Pins Are Different
The pins supporting I2C/TWI previously used analog pins A4 & A5. Now these pins are located at digital pins D2 & D3. While the SDA and SCL pins are in the same location on the board, because of the underlying hardware mapping changes, it may affect the operation of certain shields and any software using these two pins.
Step 5: Serial Port Differences
There is now a second serial port. The primary port is built into the USB interface and the Tx/Rx LEDs are attached to it. The secondary port is located at pins D0 & D1. This port does not have any LEDs attached.
To use the primary serial port, use the class Serial as usual. For the secondary port, a new serial class called Serial1 has been created. You use it the same way as the Serial class.
Step 6: Keyboard and Mouse Emulation
Of course the most exciting new feature is direct USB support. That means it can operate as an actual USB device. It can emulate a computer mouse, keyboard, or both.
The Arduino library has made it really easy to do by creating a two new classes - one for emulating a mouse, and the other a keyboard.
Step 7: Last Steps
First, you must upgrade your Arudino IDE to version 1.01. It adds the support needed for this new board, plus it has a lot of nice new features.
Second, unless you are using Linux, you will need to install USB drivers for the Leonardo.
This step-by-step guide is a just a brief overview. For more detailed information, please see the article:
It provides the extra details you need to make full use of the new Leonardo.
14 Comments
Question 4 years ago
Hello!
I use my Leonardo as HID keyboard interface to send commands to pc
the use of D17 – SS – PB0 doesn't interfere with the led activity?
thanks
7 years ago
D17 – SS – PB0 is also available from the ATMEGA32u4 pin 8, at a via near A4. I soldered a pin there for access to SS near the SPI port.
Thanks for the info on the Leonardo.
Reply 6 years ago
Can you please post a photo of that soldering? I have to do it because I want to use MCP3208 ADC and at the moment it is not possible :(
Reply 6 years ago
I got the idea from Scott at This site. I traced the circuit to the spot I inserted the pin. If you drill for the pin, make sure the pin contacts both sides of circuit board (solder). Or you can do what Scott suggests and solder a wire/pin to the RX LED area I hope this works for you.
6 years ago
help pleace
i have windows 10 and new to arduino,al my boards are reconiced, but not this one, it wil not instal its usb drivers, the only thing it says as reconition is ATM32U4DF4 with the nice yellow sign tru it. so it sees the chip i think but is not installing it, also tryd out drivers from arduino map. and internet,but no not working, in ardiono it see also no port or board
8 years ago on Introduction
i have an older version of sparkfun xbee stackable shield which doesnt have SCL n SCA pins but i need to use them to read gyro readings wirelessly! Anyone knows how can I get around this? urgent... please help..! :)
8 years ago on Step 7
Nice intro. One addition: in addition to Linux being Leonardo-ready, you don't need to install USB drivers for OSX either. :-)
9 years ago on Introduction
hey,friend it's look like u have a great knowlage on arduino i need ur help,i m new to arduino..i want to run arduino programme which i'hv (made for leonardo board only) and check whether there is any error in programme or not..and than i want to upload this programme in programme board and acorrding to programme it'll run 2 gear motor,so how can i check it and load it..can u please tell me step wise instruction or put this instructable type vedio..i'll be thankfull,thank you
9 years ago on Step 7
The shield is a Motor Shield like a Adafruit v1.2, compatible with Uno but not with Leonardo.
9 years ago on Step 7
Have you got any diagram of how to mapping the pins between a shield for Uno that is not compatible with Leonardo directly?
Can it be done using a breadboard?
Thank you.
10 years ago on Introduction
But... you can't remove the microcontroller? I thought the whole point of Arduino was to program a microcontroller, remove it, and then put it in another project... They expect people to buy/make a new board for every project?
I won't be buying one, not unless they start putting a socket on it instead of surface mount soldering it to the board.
10 years ago on Introduction
All I ever really wanted was an extra 5V pin
10 years ago on Introduction
IF only I'd know a little earlier I wouldn't have bought an Uno, Thanks for sharing.
Reply 10 years ago on Introduction
i know, i bought an uno the day before Maker Faire Bay Area and then it was released there and was introduced by Massimo Banzi himself in his presentation and i felt kinda sad because it was cheaper and better. Luckily i was able to get one before all of the first 100 leonardo's were bought for $20 in the MakerShed there. But then when i got home i examined it and had no idea about the extras, so this instructable has helped me.