Documentation

Leonardo R3 ATmega32U4 Development Board for Arduino | ShillehTek Product Manual
Documentation / Leonardo R3 ATmega32U4 Development Board for Arduino | ShillehTek Product Manual

Leonardo R3 ATmega32U4 Development Board for Arduino | ShillehTek Product Manual

manualshillehtek

Overview

The Leonardo R3 is an Arduino-compatible development board built on the ATmega32U4 — a microcontroller with USB support built directly into the chip. Unlike the UNO or Mega, which use a separate USB-to-serial converter, the Leonardo talks to your computer natively. That single difference unlocks its party trick: it can appear to your PC as a keyboard, mouse, or MIDI device, making it the classic board for macro pads, game controllers, automation buttons, and assistive input devices.

Beyond HID emulation, it is a normal Arduino: 20 digital I/O pins (7 PWM), 12 analog inputs, and full Arduino IDE support with the familiar shield footprint. Programming, power, and serial monitoring all happen over one USB cable — there is nothing to wire to get started.

At a Glance

Microcontroller
ATmega32U4
Logic Level
5V
USB
Native (HID capable)
Digital I/O
20 pins (7 PWM)
Analog Inputs
12
Flash Memory
32 KB

Specifications

Parameter Value
Microcontroller ATmega32U4 (8-bit AVR, native USB)
Clock Speed 16 MHz
Operating Voltage 5V
Input Voltage (VIN / barrel jack) 7-12V recommended
Digital I/O Pins 20 (7 provide PWM)
Analog Input Pins 12 (10-bit ADC)
Flash Memory 32 KB (4 KB used by bootloader)
SRAM / EEPROM 2.5 KB / 1 KB
USB Interface Built into ATmega32U4 (CDC serial + HID)
Hardware UART Serial1 on pins 0 (RX) and 1 (TX)
DC Current per I/O Pin 20 mA recommended (40 mA absolute max)
Dimensions 68.6 x 53.3 mm

Getting Started

The Leonardo is a USB-powered host board — nothing needs wiring before your first upload. Connect it with a USB cable and set up the IDE as below.

1. Configure the Arduino IDE

IDE Setting Value
Board Arduino Leonardo
Port The port labeled "Arduino Leonardo"

2. Understand the upload behavior

Because USB runs on the same chip as your sketch, the Leonardo briefly disconnects and re-enumerates as a different port during every upload. This is normal — the IDE handles it automatically. If an upload ever fails repeatedly, press and release the reset button just as the IDE reports "Uploading..." to catch the bootloader window manually.

3. Powering the board

USB supplies 5V for normal use. For standalone projects, feed 7-12V into the barrel jack or VIN pin. The 3.3V pin can supply up to 50 mA for low-voltage sensors.

Warning: Sketches using Keyboard.h or Mouse.h can take over your computer's input the moment they boot. Always gate HID actions behind a physical button or delay, or a runaway sketch can make the board hard to reprogram.
Tip: Serial (USB) and Serial1 (pins 0/1) are independent on the Leonardo. You can talk to a GPS or Bluetooth module on Serial1 while using the USB Serial Monitor at the same time — something the UNO cannot do.

Code Examples

Blink + Serial (first upload test)

leonardo_blink.ino
// Leonardo R3 - Blink the onboard LED (pin 13) and print to Serial

const int LED_PIN = 13;

void setup() {
  pinMode(LED_PIN, OUTPUT);
  Serial.begin(9600);
  while (!Serial) { ; }        // wait for USB serial (Leonardo-specific)
  Serial.println("Leonardo R3 is alive!");
}

void loop() {
  digitalWrite(LED_PIN, HIGH);
  delay(500);
  digitalWrite(LED_PIN, LOW);
  delay(500);
}

USB keyboard emulation (one-key macro)

leonardo_macro_key.ino
// Leonardo R3 - Type a text macro when a button is pressed.
// Wiring: pushbutton between pin 2 and GND (uses internal pull-up).
// The button guard keeps the keyboard idle until YOU trigger it.

#include <Keyboard.h>

const int BUTTON_PIN = 2;
bool lastState = HIGH;

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  Keyboard.begin();
}

void loop() {
  bool state = digitalRead(BUTTON_PIN);

  // Falling edge = button just pressed
  if (state == LOW && lastState == HIGH) {
    Keyboard.print("Hello from ShillehTek!");
    delay(50);                 // simple debounce
  }
  lastState = state;
}

Frequently Asked Questions

Why does the COM port disappear and reappear during upload?
USB is handled by the ATmega32U4 itself, so the board resets into its bootloader (a different USB device) for each upload, then returns as your sketch. This is expected behavior on all 32U4 boards.
My HID sketch runs wild and I can't upload anymore. How do I recover?
Click Upload in the IDE, and while it compiles, press and release the board's reset button. The bootloader stays active for about 8 seconds — the IDE will catch it before your sketch takes over. Then add a button guard to your HID code.
What's the difference between Serial and Serial1?
Serial is the USB connection to your computer; Serial1 is the hardware UART on pins 0 (RX) and 1 (TX). They are fully independent, so uploads never conflict with devices wired to 0/1.
Can the Leonardo emulate a keyboard and mouse at the same time?
Yes. Include both Keyboard.h and Mouse.h — the board enumerates as a composite HID device and can send keystrokes, mouse movement, and clicks in the same sketch.
Why doesn't my sketch print anything until I open the Serial Monitor?
On the Leonardo, Serial only becomes ready when the USB host connects. Use while (!Serial) {} in setup() if you need to see the very first prints — and remove it for standalone use, or the sketch will wait forever without a PC.
Is the Leonardo compatible with 3.3V sensors?
It is a 5V-logic board. Power 3.3V sensors from the 3.3V pin and level-shift any signal the Leonardo drives into them; sensor outputs into the Leonardo read fine as-is.

Related Tutorials