What is Arduino Leonardo?Arduino Leonardo is a board microcontroller based on the low-power, high-performance ATmega32u4 chip. It features 20 digital I/O pins (12 double up as analog inputs and seven as PWM outputs), a micro USB port, a 16 MHz crystal oscillator, a reset button, and an ICSP header. The Arduino Leonardo Source: Wikimedia Commons
Arduino Leonardo PinoutThe Arduino Leonardo's pinout broadly falls into the following nine categories. There's also a built-in LED connected to pin 13. If set to one (high), this LED turns on. If low (0), it turns off.
Arduino Leonardo Specifications
The Arduino Leonardo SchematicArduino Leonardo is open-source hardware, so you can build the board using this schematic and pinout file. It is vital to note the following points.
PowerYou can power the Leonardo using the micro USB connection or an external (non-USB) power supply. The external power source can either be a battery or an AC-DC adapter, and the board will select the power source automatically.
USB Overcurrent ProtectionThis microcontroller features a resettable polyfuse. Its function is to protect the built-in USB ports from shorts and overcurrent. The fuse provides an extra protection layer to the computer's internal protection mechanism, safeguarding the system from currents above 500mA.
MemoryThe ATmega32u4 controller contains 1KB EEPROM that you can read/write using the EEPROM library. There's also 2.5KB SRAM and 32KB flash memory.
Input/OutputLeonardo has 20 digital pins for I/O. Each operates at 5V and can provide or handle 40mA max. Additionally, every pin has a 20-50 kΩ internal pull-up resistor (disconnected by default). The Arduino Leonardo with the power jack and ICSP header attached. Note the pin numbers/labels. Source: Wikimedia Commons
Physical CharacteristicsThe max dimensions of the Leonardo are 68.6 x 53.3mm (2.7 x 2.1 inches). However, the power jack and USB connector extend beyond these dimensions. The space between pins 7 and 8 is 160 mil, and the board should have four screw holes for attaching to a case or surface.
CommunicationThis board has multiple communication facilities for interacting with other Arduino boards, computers, or microcontrollers. For instance, it provides UART, digital pin, and USB serial communication, a serial monitor in the Arduino software, I2C, and SPI communication. The microcontroller appears as a generic keyboard and mouse, and you can program it using the mouse and keyboard classes to control these input devices. A modified Arduino Leonardo schematic for a USB keylogger Source: Wikimedia Commons
ProgrammingYou can program this board using the Arduino software, but you must select Arduino Leonardo in the Tools > Board menu. However, you can bypass the built-in bootloader by using Leonardo's 6-pin ICSP header to program the board directly using the Arduino ISP.
Auto Reset (Software) and Bootloader InitiationInstead of requiring a physical reset button address before uploading, Leonardo allows resetting by software running on a connected computer. Opening the CDC (virtual) serial/COM port at 1200 baud rate, then closing it triggers the reset. But you can also initiate the bootloader by pressing the onboard reset button.
Connection and Firmware of the Arduino LeonardoUse the following steps to install the Leonardo driver.
- Connect the device to the PC
- Wait for the software installation wizard to launch (select Arduino Leonardo line and press update under the hardware section if it fails to launch)
- Search for drivers on the PC and click next
- Select the required driver in the software folder
- Accept installation
- Press and hold the reset button until uploading begins
- Control the bootloader startup (should see a new port)
Comparison with Arduino UNO, NANO, MEGACompared to its predecessors (Arduino NANO, UNO, and MEGA), Leonardo runs on a single chip, the ATmega32u4 microchip. This chip gives Leonardo more functionality than the other three. The Arduino UNO rev 2 Source: Wikimedia Commons Additionally, using a single chip makes the serial ports virtual. Real serial ports require a dedicated chip for serial communication. The Arduino NANO Source: Wikimedia Commons
- A computer can detect the microcontroller as a keyboard, mouse, HID device, or serial port.
- Opening a serial port on the PC does not trigger automatic restarting
- More PWM inputs and RAM
- Increased connectivity and functionality from the micro USB connection
Arduino Leonardo Applications
- Industrial automation
- Wireless keyboards
- USB trackpad
- Embedded systems
- Security and health systems
- Automatic pill dispenser