Home » Arduino Leonardo Guide

Arduino Leonardo Guide

by devguy71

In this article we look at the Arduino Leonardo.

It has the same pinout as the Arduino Uno and the same form factor. This means a case for the Uno will fit OK and also most Arduino shields may be used – there is a possible exception to this.

If you have an Arduino shield you should realise that the SPI connections are only available on the ICSP connector, so if it does not connect to the Leonardo’s 6-pin ICSP header, the shield will not work.

The Leonardo is different from boards like the Arduino uno in that the ATmega32u4 has built-in USB communication, eliminating the need for a secondary processor like the FTDI chip. This allows the Leonardo to appear to a PC as a mouse and keyboard, in addition to a virtual (CDC) serial / COM port.

The bootloader uses an extra 3.5Kb – this may not be critical but still something to keep in mind.

Features

The ATmega32u4 has 32 KB (with 4 KB used for the bootloader). It also has 2.5 KB of SRAM and 1 KB of EEPROM. You can access this using the EEPROM library,

Microcontroller ATmega32u4
Operating Voltage 5V
Input Voltage (Recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 20
PWM Channels 7
Analog Input Channels 12
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega32u4) of which 4 KB used by bootloader
SRAM 2.5 KB (ATmega32u4)
EEPROM 1 KB (ATmega32u4)
Clock Speed 16 MHz

Power

The Leonardo can be powered via the micro USB connection. The power source is selected automatically.
External  power can come either from an AC-to-DC adapter or battery.

The power pins are as follows:

VIN. The input voltage to the Arduino board when it’s using an external power source. You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

5V. The regulated power supply used to power the microcontroller and other components on the board. This can come either from VIN via an on-board regulator, or be supplied by USB or another regulated 5V supply.

3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current is 50 mA.

GND. Ground pins.

IOREF. The voltage at which the i/o pins of the board are operating. This is 5V.

Pins

Each of the 20 digital pins on the Leonardo can be used as an input or output. They are all 5 volt tolerant.  A maximum of 40mA is the value that must not be exceeded to avoid damaging the microcontroller.

The Arduino Uno has 6 analog inputs, each of which provide 10 bits of resolution. By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin.

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data using the ATmega32U4 hardware serial capability. On the Leonardo, the Serial class refers to USB (CDC) communication; for TTL serial on pins 0 and 1, use the Serial1 class.

TWI: 2 (SDA) and 3 (SCL). Support TWI communication

External Interrupts: 3 (interrupt 0), 2 (interrupt 1), 0 (interrupt 2), 1 (interrupt 3) and 7 (interrupt 4). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value.

PWM: 3, 5, 6, 9, 10, 11, and 13. Provide 8-bit PWM output

SPI: on the ICSP header. These pins support SPI communication.

LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it’s off.

Analog Inputs: A0-A5, A6 – A11 (on digital pins 4, 6, 8, 9, 10, and 12). The Leonardo has 12 analog inputs, labeled A0 through A11, all of which can also be used as digital i/o.

Pins A0-A5 appear in the same locations as on the Uno; inputs A6-A11 are on digital i/o pins 4, 6, 8, 9, 10, and 12 respectively. Each analog input provide 10 bits of resolution (i.e. 1024 different values). By default the analog inputs measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and the analogReference() function

AREF. Reference voltage for the analog inputs.

Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.

Here is a pinout of the board

arduino leonardo pinout

arduino leonardo pinout

Installation

The board works out the box with the desktop IDE and the online IDE.

Many examples online

Cost

The price varies wildly on these boards – these are all clone options and all affiliate links.

Site Link Price
Amazon.com KEYESTUDIO Leonardo R3 Microcontroller Development Board with USB Cable Kit for Arduino Project $15
Aliexpress ATMEGA32U4 Pro Leonardo R3 Module Development Board $6.48
Amazon.co.uk KEYESTUDIO Leonardo R3 ATMEGA32U4-AU Microcontroller Development Board for Arduino Leonardo £13.99

 

Summary

A slightly more expensive development board than the Arduino Uno – if you need t he ability for more analog or want a virtual keyboard o rmouse then this will fit the bill, otherwise I would just stick to an Uno

 

 

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More