Arduino Leonardo: The Versatile Microcontroller with Native USB
The Arduino Leonardo is a microcontroller board based on the ATmega32U4, notable for its integrated USB controller, making it ideal for human interface device (HID) projects.

The Arduino Leonardo is a significant board in the Arduino family, released in 2012. It was one of the first Arduino boards to feature the ATmega32U4 microcontroller, which integrates a full USB 2.0 controller. This built-in USB functionality means the Leonardo can act as a native USB device, such as a keyboard or mouse, without needing a separate USB-to-serial chip. This capability opens up a wide range of unique project possibilities not easily achievable with other Arduino boards.
At its heart, the Arduino Leonardo is powered by the Atmel (now Microchip) ATmega32U4, an 8-bit AVR microcontroller. This chip provides a good balance of processing power, memory, and peripherals for many embedded applications. It features 32KB of Flash memory for program storage, 2.5KB of SRAM for variables, and 1KB of EEPROM for persistent data storage. The ATmega32U4 operates at a clock speed of 16 MHz, offering sufficient performance for typical Arduino projects.
The Leonardo occupies a unique position in the Arduino ecosystem. While many Arduino boards rely on a separate USB-to-serial converter chip (like the FTDI chip on the Arduino Uno), the Leonardo's ATmega32U4 handles both the microcontroller tasks and the USB communication directly. This simplifies the board's design and reduces cost, while greatly enhancing its functionality for projects requiring USB HID emulation. It's well-suited for makers, students, and engineers who want to explore interactive electronics, custom input devices, or projects that interface directly with a computer via USB.
Historically, the Leonardo represented a step forward in making advanced USB capabilities accessible to the Arduino community. Its release provided a powerful yet easy-to-use platform for creating custom keyboards, game controllers, MIDI devices, and more. The board maintains compatibility with the vast Arduino software ecosystem, including the Arduino IDE, making it straightforward to program for both beginners and experienced developers.
Watch
Related video, embedded from YouTube.
Specifications
| Microcontroller / SoC | Microchip ATmega32U4 |
| Architecture | 8-bit AVR |
| Clock speed | 16 MHz |
| Flash / Storage | 32 KB (28 KB for bootloader and sketch) |
| RAM / SRAM | 2.5 KB |
| EEPROM | 1 KB |
| Operating voltage | 5V |
| Digital I/O pins | 14 (of which 7 can provide PWM output) |
| Analog / ADC | 6 (10-bit resolution) |
| PWM | 7 pins (3, 5, 6, 9, 10, 11, 13) |
| Connectivity | 1x ICSP header for in-circuit serial programming |
| USB | Native USB (ATmega32U4), supports HID, CDC, MSC |
| Power input | 7-12V recommended via DC barrel jack or VIN pin, 5V via USB or 5V pin |
| Dimensions | 73.5 mm x 53.3 mm (2.9 in x 2.1 in) |
Pinout & pin functions
| Pin | Function |
|---|---|
| GND | Ground pin |
| GND | Ground pin |
| 5V | Regulated 5V output |
| 3.3V | Regulated 3.3V output |
| AREF | Analog Reference voltage |
| D0 (RX) | Digital I/O, UART RX |
| D1 (TX) | Digital I/O, UART TX |
| D2 | Digital I/O |
| D3 | Digital I/O, PWM |
| D4 | Digital I/O |
| D5 | Digital I/O, PWM |
| D6 | Digital I/O, PWM |
| D7 | Digital I/O |
| D8 | Digital I/O |
| D9 | Digital I/O, PWM |
| D10 (SS) | Digital I/O, PWM, SPI Slave Select |
| D11 (MOSI) | Digital I/O, PWM, SPI Master Out Slave In |
| D12 (MISO) | Digital I/O, SPI Master In Slave Out |
| D13 (SCK) | Digital I/O, PWM, SPI Serial Clock |
| A0 | Analog Input, Digital I/O |
| A1 | Analog Input, Digital I/O |
| A2 | Analog Input, Digital I/O |
| A3 | Analog Input, Digital I/O |
| A4 (SDA) | Analog Input, Digital I/O, I2C Data |
| A5 (SCL) | Analog Input, Digital I/O, I2C Clock |
| VIN | Power input (7-12V recommended) |
| RST | Reset pin |
Wiring & circuit basics
Powering the Arduino Leonardo can be done via its USB connection, the DC barrel jack, or the VIN pin. When using the barrel jack or VIN pin, an external power supply providing 7-12V is recommended. The board has an onboard voltage regulator that steps this down to 5V for the microcontroller and other components. If powering via USB, ensure the USB port can supply at least 500mA, especially if connecting external devices. Avoid powering the board through both USB and the barrel jack/VIN pin simultaneously unless you understand the implications for voltage regulation.
The Arduino Leonardo operates at a logic level of 5V. This means its digital pins output 5V for HIGH signals and 0V for LOW signals. When interfacing with components that operate at different voltage levels, such as 3.3V sensors or devices, it is crucial to use level shifters or voltage dividers to prevent damage. For example, connecting a 3.3V sensor's output directly to a Leonardo input pin might work if the sensor's HIGH output is above 3V, but connecting a 5V output from the Leonardo to a 3.3V input could cause damage. Always check the voltage requirements of your external components.
A simple LED circuit demonstrates basic wiring. Connect an LED's anode (longer leg) to a digital pin, such as D13, through a current-limiting resistor (typically 220-330 ohms). Connect the LED's cathode (shorter leg) to a GND pin. This resistor is essential to prevent the LED from drawing too much current and burning out the pin or the LED itself. When the pin is set to HIGH (5V), current flows through the resistor and LED, illuminating it. When set to LOW (0V), the circuit is broken, and the LED turns off.
Programming & getting started
The primary toolchain for programming the Arduino Leonardo is the Arduino IDE. Download and install the latest version from the official Arduino website. Once installed, connect the Leonardo to your computer via USB. In the IDE, navigate to Tools > Board and select 'Arduino Leonardo'. Then, go to Tools > Port and select the COM port or /dev/ttyACM* that corresponds to your Leonardo. You can then write your sketch, compile it (Verify button), and upload it to the board (Upload button). The ATmega32U4's native USB capability means the board will appear as a serial port automatically.
For more advanced development, PlatformIO, an open-source ecosystem for IoT development, supports the Arduino Leonardo. It integrates with various IDEs like VS Code and offers features like project management, library management, and automated testing. MicroPython and CircuitPython are also options, though official support might vary and require specific firmware flashing procedures. The Leonardo's HID capabilities can also be leveraged with libraries like 'Mouse.h' and 'Keyboard.h' within the Arduino IDE for creating custom input devices.