Sign in Get 3 free credits

Try a job or a niche: tiktok captions, study notes, excel formulas. Press Esc to close.

Atmega32u4 beetle

Firmware development for the Beetle, the CJMCU / DFRobot "Mini Arduino Leonardo" USB board (ATmega32U4 @ 16 MHz, 5 V, 21×28 mm, castellated pads).

Free on GitHub

In detail

Firmware development for the Beetle — the CJMCU / DFRobot "Mini Arduino Leonardo" USB board (ATmega32U4 @ 16 MHz, 5 V, 21×28 mm, castellated pads) — its native USB (CDC serial + HID keyboard/mouse/joystick), Caterina bootloader and 1200 bps touch upload, ten exposed I/O pads, four PWM pins across Timer0/Timer1, five ADC channels, I2C on D2/D3, SPI on the back-side ICSP pads, 28 KB usable flash and 2.5 KB SRAM, and the PlatformIO + Arduino AVR core (`board = leonardo`) setup around them. Use when working on this board or any ATmega32U4 Leonardo/Micro/Pro-Micro-class clone: project setup, platformio.ini, why the board shows up as two different serial ports, uploads that fail or hang, recovering a bricked or HID-spamming board by shorting the ICSP reset pads, pin mapping and which pads are missing, PWM/timer conflicts, Servo and tone, USB HID keyboard projects, the SRAM budget, powering from the + pad, or debugging why something on the board does not work.

Safety check

  • Not rated by Claude yet. We only sell skills Claude has read and rated 7 out of 10 or higher, so this one is a free link to its author.

An automated scan lowers risk but cannot promise zero risk. How we check skills

Preview

The first lines of SKILL.md
---
name: atmega32u4-beetle
description: "Firmware development for the Beetle — the CJMCU / DFRobot \"Mini Arduino Leonardo\" USB board (ATmega32U4 @ 16 MHz, 5 V, 21×28 mm, castellated pads) — its native USB (CDC serial + HID keyboard/mouse/joystick), Caterina bootloader and 1200 bps touch upload, ten exposed I/O pads, four PWM pins across Timer0/Timer1, five ADC channels, I2C on D2/D3, SPI on the back-side ICSP pads, 28 KB usable flash and 2.5 KB SRAM, and the PlatformIO + Arduino AVR core (`board = leonardo`) setup around them. Use when working on this board or any ATmega32U4 Leonardo/Micro/Pro-Micro-class clone: project setup, platformio.ini, why the board shows up as two different serial ports, uploads that fail or hang, recovering a bricked or HID-spamming board by shorting the ICSP reset pads, pin mapping and which pads are missing, PWM/timer conflicts, Servo and tone, USB HID keyboard projects, the SRAM budget, powering from the + pad, or debugging why something on the board does not work."
---

# Beetle — Mini Arduino Leonardo (ATmega32U4)

Board-specific firmware knowledge. The Beetle is an ATmega32U4 with **native
USB** and **ten pads**, and almost every trap on it comes from one of those
two facts: USB means the programming interface is the sketch you are about
to replace, and ten pads means most of the Leonardo pin numbering the
compiler accepts goes nowhere on this board.

- `reference/board-hardware.md` — the complete board reference: pad
  inventory and full pin map, the sixteen I/O lines that are not brought
  out, power tree, clock and PLL, memory map, fuses and the Caterina
  bootloader **plus** a development guide (Part II: §8 toolchain, §9 USB and
  the two serial ports, §10 peripheral cookbook, §11 gotchas, §12 flashing
  and recovery, §13 symptom → cause → fix table).
- `reference/recipes.md` — copy-paste code: `platformio.ini`, `board.h`,
  non-blocking timing, USB-CDC that never blocks, `Serial1` on the TX/RX
  pads, I2C and SPI, the ADC channel map, external and pin-change
  interrupts, PWM and the timer map, Servo vs `tone()`, HID keyboard with
  its safety guards, EEPROM, power-down sleep with USB.
- `template/` — a **project that builds clean**, in three variants, plus a
  scaffold script. See `template/README.md`.

## Orientation

| | |
|---|---|
| MCU | ATmega32U4, 8-bit AVR @ **16 MHz** (crystal), 44-pin QFN. 26 I/O lines on the chip, **10 on the pads** |
| Memory | 32 KB flash, **28,672 B usable** (Caterina bootloader keeps 4 KB), **2,560 B SRAM**, 1 KB EEPROM, + 832 B of USB DPRAM that is *not* part of SRAM |
| Board | DFRobot: 20 × 22 × 3.8 mm; the larger clone this skill was written against: 21 × 28 mm. Castellated pads, micro-USB. **No reset button, no regulator, no VIN, no 3V3** |
| Exposed pads | `RX(D0) TX(D1) SDA(D2) SCL(D3) 9 10 11 A0 A1 A2` + `+` (VCC) and `-` (GND) — DFRobot's own pad↔pin table |
| LED | **D13 = PC7**, on = **HIGH**, no pad. DFRobot advertise a "magic light blue soft BLINK indicator" — the blue LED is D13 |
| PWM | 4 pads: **D3, D11 on Timer0** (the `millis()` timer, ~977 Hz) · **D9, D10 on Timer1** (the `Servo` timer, ~490 Hz) |
| ADC | 5 × 10-bit: A0 (PF7/ADC7), A1 (PF6/ADC6), A2 (PF5/ADC5), and D9 = **A9** (ADC12), D10 = **A10** (ADC13) |
| Interrupts | **4** external: D3→INT0, D2→INT1, D0→INT2, D1→INT3 · pin-change on D9/D10/D11 (PCINT5/6/7) |
| USB | **Native**, on-chip. `Serial` = USB CDC (no baud rate). HID keyboard/mouse/joystick supported |
...

From alexex1993's repository, MIT licence.

Secure checkout

Credits

AUD

  1. 1Choose
  2. 2Pay on Square
  3. 3Credits added