Arduino Leonardo R3 Development Board

SKU: AA1001
Arduino Leonardo R3-compatible board with ATmega32U4 chip, micro-USB port, power jack and pin headers, shown with a blue micro-USB cable
Arduino Leonardo R3-compatible board seen from the other side, showing the ATmega32U4 chip, power headers, ICSP header and reset button

Arduino Leonardo R3 Development Board

SKU: AA1001
Type
Regular price $24.99
/
  • Free shipping on all orders over $100
  • Secure payments
  • Low stock - 2 items left
  • Inventory on the way

Add $100.00 more for free shipping

Tax included. Shipping calculated at checkout.

You'll also need

An Arduino Leonardo R3-compatible board built on the ATmega32U4, with native USB so it can appear to your computer as a keyboard or mouse.

The Arduino Leonardo is a 5 V development board with 20 digital input/output pins, a micro-USB port, a power jack, an ICSP header and a reset button. It is programmed with the Arduino IDE, and it suits projects that talk to a computer directly, such as macro pads, custom controllers and sensor loggers.

Chip
ATmega32U4
USB
Native micro-USB
Logic level
5 V
Memory
32 KB flash

Why choose it

  • Native USB — the ATmega32U4 has built-in USB communication, so the board can appear as a keyboard or mouse and as a virtual serial port.
  • Plenty of pins — 20 digital I/O pins, 12 analog inputs and 7 PWM outputs.
  • Easy to program — select Arduino Leonardo in the Arduino IDE and upload over micro-USB, with no separate programmer.

Specifications

Core
Microcontroller ATmega32U4
Clock speed 16 MHz
Operating voltage 5 V
Flash memory 32 KB, of which 4 KB is used by the bootloader
SRAM 2.5 KB
EEPROM 1 KB
Pins and I/O
Digital I/O pins 20
PWM outputs 7 (pins 3, 5, 6, 9, 10, 11, 13)
Analog inputs 12 (A0–A11)
DC current per I/O pin 40 mA
DC current for 3.3 V pin 50 mA
I2C (Wire) Pin 2 (SDA), pin 3 (SCL)
Hardware serial (Serial1) Pin 0 (RX), pin 1 (TX)
External interrupts Pins 3, 2, 0, 1 and 7
SPI ICSP header only
Built-in LED Pin 13
Power and USB
USB Micro-USB, native USB (virtual serial port, keyboard and mouse)
Power jack Barrel plug
Input voltage, recommended 7–12 V
Input voltage, limits 6–20 V
Physical
Length 68.6 mm
Width 53.3 mm

Compatibility

Platform Works Notes
Arduino IDE ✓ Yes Select Arduino Leonardo under Arduino AVR Boards.
Keyboard and Mouse libraries ✓ Yes Built-in USB lets the board act as a keyboard or mouse.
5 V sensors and modules ✓ Yes Operating voltage is 5 V.
3.3 V-only modules ◐ With adapter Use a level shifter on the signal pins and power the module from the 3.3 V pin (50 mA maximum).
Uno-format shields ◐ With adapter The header layout follows the R3 format, but SPI is only on the ICSP header and I2C is on pins 2 and 3, so check which pins the shield uses.

In the box

Included
  • Board Only: 1 × Arduino Leonardo R3-compatible development board
  • With Cable: the board plus 1 × micro-USB cable

Options

Option What is different Choose it when
Board Only The board without a cable You already have a micro-USB data cable.
With Cable The board plus a micro-USB cable You want what you need to connect the board to a computer.

Applications

  • A macro pad that types shortcuts or text when you press a button
  • A custom USB mouse or game controller built from buttons and a joystick
  • A sensor logger that sends readings to your computer over the USB serial port
  • Learning Arduino programming on a board with plenty of pins

Tutorial

Part 1 — Set up the Arduino IDE (once only)

1
Install the Arduino IDE
Download and install the Arduino IDE for your computer. Open it when it finishes.
2
Connect the board
Plug the board into your computer with a micro-USB data cable (some cables only charge, see USB Cable - Micro). The green ON LED lights up.
3
Choose the board
Go to Tools → Board → Arduino AVR Boards → Arduino Leonardo. If you cannot find it, install Arduino AVR Boards in the Boards Manager first.
4
Choose the port
Go to Tools → Port and pick the port that appeared when you plugged the board in (it is marked Arduino Leonardo on most computers).

✓ Check: The board name and port show at the bottom of the IDE window.

Part 2 — Upload your first sketch

5
Paste and upload Example 1
Click File → New Sketch, delete the text in it, paste Example 1 below, then click the Upload arrow.
▸ Example 1 — Blink the built-in LED and say hello
// Wiring: none - uses the built-in L LED on digital pin 13
const int LED_PIN = 13;          // built-in L LED (pin 13)

void setup() {
  pinMode(LED_PIN, OUTPUT);      // make the LED pin an output
  Serial.begin(115200);          // Serial = USB serial port on the Leonardo
  while (!Serial && millis() < 3000) {}   // wait up to 3 s for Serial Monitor
  Serial.println("OK - epartners.co.nz test");
}

void loop() {
  digitalWrite(LED_PIN, HIGH);   // LED on
  delay(1000);                   // you can change this (milliseconds)
  digitalWrite(LED_PIN, LOW);    // LED off
  delay(1000);                   // you can change this
}

✓ Check: The small L LED on the board blinks once a second.

6
See the hello message
Click Tools → Serial Monitor, set the speed to 115200 baud, then press the red reset button on the board. The message prints once at start-up. On the Leonardo, Serial is the USB connection, so pins 0 and 1 are Serial1, not Serial.

✓ Check: The Serial Monitor shows OK - epartners.co.nz test once. If the port disappears after the reset, pick the port again under Tools → Port.

Part 3 — Your first real project: a two-button macro keyboard

The Leonardo can appear to your computer as a USB keyboard. In this project one button arms the keyboard and a second button types a line of text. The arm button matters: a board that is always typing can take over your keyboard, so it only types when you have armed it.

You need: the Leonardo, 2 push buttons, a breadboard and 3 jumper wires (see You may also need above), and the micro-USB cable.

7
Wire the two buttons
Unplug the USB cable first. Connect the parts exactly as in the diagram and table. The Leonardo has built-in pull-up resistors (a pull-up keeps a pin at a steady HIGH until the button joins it to GND), so you do not need any resistors.
Arduino Leonardo with ARM button on D7 and TYPE button on D8 Arduino Leonardo D7D8GND ARM button TYPE button D7 (signal)D8 (signal)GND to both buttons

■ Power ■ GND ■ Signal ■ I2C / SPI / UART ■ Other ⌒ = wires cross, not connected

# Leonardo pin Button pin Wire Notes
1 D7 ARM button, leg A Yellow Turns keyboard control on and off
2 D8 TYPE button, leg A Yellow Types the text while armed
3 GND Leg B of both buttons Black Use the legs on the opposite side of each button

Watch out: Check the pin labels printed on your board before you plug in wires.

8
Upload Example 2
Plug the USB cable back in. Open a new sketch, paste Example 2 below and upload it.
▸ Example 2 — Two-button macro keyboard
// Wiring: ARM button D7 -> GND, TYPE button D8 -> GND (internal pull-ups)
#include <Keyboard.h>

const int ARM_PIN  = 7;          // ARM button on D7
const int TYPE_PIN = 8;          // TYPE button on D8
const int LED_PIN  = 13;         // built-in L LED shows "armed"

bool armed = false;              // keyboard control is off at power-up
int lastArm = HIGH;              // previous button states (HIGH = not pressed)
int lastType = HIGH;

void setup() {
  pinMode(ARM_PIN, INPUT_PULLUP);
  pinMode(TYPE_PIN, INPUT_PULLUP);
  pinMode(LED_PIN, OUTPUT);
  Serial.begin(115200);
  while (!Serial && millis() < 3000) {}
  Serial.println("OK - epartners.co.nz test");
}

void loop() {
  int arm = digitalRead(ARM_PIN);
  if (lastArm == HIGH && arm == LOW) {      // ARM button was just pressed
    armed = !armed;                         // switch keyboard control on/off
    digitalWrite(LED_PIN, armed ? HIGH : LOW);
    if (armed) {
      Keyboard.begin();                     // start acting as a USB keyboard
    } else {
      Keyboard.end();                       // give the keyboard back to you
    }
    delay(200);                             // simple debounce
  }
  lastArm = arm;

  int typeBtn = digitalRead(TYPE_PIN);
  if (armed && lastType == HIGH && typeBtn == LOW) {   // TYPE button pressed
    Keyboard.print("Hello from my Leonardo!");         // you can change this text
    delay(200);
  }
  lastType = typeBtn;
}
9
Try it safely
Click into a text editor (Notepad, TextEdit or similar). Press the ARM button once, the L LED turns on. Press TYPE. Press ARM again to switch keyboard control off.

✓ Check: Pressing TYPE while the L LED is on types Hello from my Leonardo! into the editor. With the L LED off, nothing is typed.

Troubleshooting

Problem Likely cause Fix
No port appears under Tools → Port Charge-only USB cable or a loose connection Use a micro-USB data cable and try another USB port. The ON LED should be lit.
Arduino Leonardo is not in the board list Arduino AVR Boards is not installed Install Arduino AVR Boards in the Boards Manager, then restart the IDE.
Upload fails or the port changes during upload The Leonardo resets its USB port when it is uploaded to, so the port can disappear for a moment Press the reset button, then upload again. The bootloader stays active for about 8 seconds after a reset, so start the upload straight away.
Serial Monitor shows nothing The message is printed only once at start-up, or the wrong port is selected Open the Serial Monitor, then press reset. Re-select the port if it changed. Use Serial1 (pins 0 and 1) only for a separate serial device.
Typed characters look wrong Your computer uses a different keyboard layout Pass a layout to Keyboard.begin(), for example Keyboard.begin(KeyboardLayout_en_US).
Keyboard keeps typing and you cannot stop it A sketch is sending keystrokes without a way to stop it Unplug the USB cable, then re-upload (press reset first). Keep the ARM button in your sketches.

Try next: change the text in Keyboard.print(), or use the Mouse library to move the pointer from a button. Both libraries are linked under Resources.

Spotted a problem in this tutorial? Email support@epartners.co.nz and we'll check it and update the tutorial.

Good to know
  • Serial is USB. On the Leonardo, Serial is the USB virtual serial port. Use Serial1 for a serial device on pins 0 and 1. Opening and closing the port at 1200 baud resets the board, and the bootloader stays active for about 8 seconds.
  • Keyboard control. When a sketch uses Keyboard or Mouse, the board takes over your keyboard or mouse. Add a button or switch that turns it off, as in the tutorial.
  • 5 V logic, 40 mA per pin. Each I/O pin supplies up to 40 mA. Drive motors, relays and other heavy loads through a driver or transistor, and use a level shifter for 3.3 V-only modules.

Datasheet

Key figures from the manufacturer's datasheet for the ATmega32U4, the microcontroller on this board.

ATmega32U4 microcontroller
Core 8-bit AVR
Flash memory 32 KB
SRAM 2.5 KB
EEPROM 1 KB
Operating voltage 2.7–5.5 V
Maximum frequency 8 MHz at 2.7 V, 16 MHz at 4.5 V
Operating temperature −40 °C to +85 °C
Programmable I/O lines 26
ADC 12 channels, 10-bit
USB USB 2.0 full-speed and low-speed device
Serial interfaces USART, SPI and 2-wire (I2C)
Package 44-pin TQFP or QFN
Write endurance 10,000 cycles (flash), 100,000 cycles (EEPROM)

Download the ATmega32U4 datasheet (PDF, 7.9 MB)

▸ Preview the datasheet

If the preview does not load on your device, use the download link above.

Source: Atmel (now Microchip Technology), ATmega16U4/ATmega32U4 datasheet, document 7766.

Resources

Which one should I choose?

Product Key difference Best for
This product (Arduino Leonardo R3-compatible) ATmega32U4 with built-in USB: can appear as a keyboard or mouse USB keyboard, mouse and controller projects
Arduino Uno R3 Board ATmega328P microcontroller General Arduino projects that do not need keyboard or mouse emulation

FAQ

▸ Can the Arduino Leonardo act as a keyboard or mouse?

Yes. The ATmega32U4 has built-in USB, so the board can appear as a keyboard or mouse using the Keyboard and Mouse libraries. Keep a way to turn keyboard control off, because the board takes over your keyboard while it is running.

▸ Why does the Serial Monitor show nothing on my Leonardo?

The Leonardo's Serial is the USB virtual serial port, and the port can change when the board resets. Open the Serial Monitor, press reset, and select the port again if it moved. Pins 0 and 1 use Serial1.

▸ Is the Leonardo a 5 V or 3.3 V board?

It is a 5 V board (operating voltage 5 V). Use a level shifter for 3.3 V-only modules. The 3.3 V pin supplies up to 50 mA.

▸ What power supply can I use?

You can power it from the micro-USB port or the barrel power jack. The recommended input voltage is 7–12 V, with limits of 6–20 V.

▸ How do I upload a sketch?

Select Arduino Leonardo under Tools → Board, choose the port, and click Upload. If the upload fails, press the reset button and upload again.

Technical question about this part? Email support@epartners.co.nz with your board and wiring, and we'll help you get it working.

Shipping: $5.99 urban, $9.99 rural. Free shipping on orders of $100 or more.

Order by 10:30am (NZT), Monday to Friday, and we dispatch the same day. Orders placed after 10:30am, on weekends or on public holidays are dispatched the next business day.

Delivery usually takes 1–2 business days after dispatch (2–3 for rural addresses). See our Shipping Policy for full details.

This site is protected by hCaptcha and the hCaptcha Privacy Policy and Terms of Service apply.

Recently viewed