USB controlled relay
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ondřej Hruška db1a4c447a typo 1 month ago
src readme 1 month ago
.gitignore readme 1 month ago
LICENSE readme 1 month ago
Makefile readme 1 month ago typo 1 month ago
makefile.broken readme 1 month ago


Simplest USB GPIO output with Arduino Pro Micro.

There is no input function. It can be easily added, but I didn't need it.

How to use it

The device appears as a USB-serial ttyACMx. Write characters to it. Everything works in character mode. There's no harm in sending CRLF, these are discarded with no reply.

  • Uppercase letters turn GPIOs on, their lowercase counterparts turn them off.
  • Valid commands return the same character back. Unknown commands return "?".
  • "0" turns all off, "1" turns all on. This is handy if you need just one signal, or want to shut everything down.

Mapping - see the X-table in main.c

GPIOs on the pro micro board are like so:

A  D3 ---(usb)--- raw
B  D2             gnd
   gnd            rst
   gnd            vcc
C  D1              F4  R
D  D0              F5  Q
E  D4              F6  P
F  C6              F7  O
G  C7              B1  N
H  E6              B3  M
I  B4              B2  L
J  B5 ------------ B6  K    

        top view

The left LED blinks on activity, right LED blinks with ~5s interval to indicate operation.

Hardware connections

Hook this up to a SSR or LEDs or whatever that needs switching on and off. All GPIOs on the board are accessible.

Remember: Max current per pin is 10mA, max total current is 150mA. It can take a bit more, but it's not recommended. Use transistors or driver IC if needed.


This is a firmware for Arduino Pro Micro ("Leonardo"), using ATMEGA32U4.

It can be ported to any AVR that's supported by LUFA.

To compile it, download the LUFA library and update LUFA_PATH in Makefile.

The exact version I used is 2021-01-30:

Run "make all" to build everything, or "make hex" to build only the elf and hex.


use avr-gcc and avrdude, flash with "make flash".

How to enter bootloader

This board is old and dumb, there is no reset button and the bootloader often fails to start.

To go into BOOT, tap the RST button twice (if there is a button), or touch a wire from GND to RST twice within a second. I don't know how this works, maybe the bootloader disables the reset function temporarily.

This trick sometimes doesn't work. Also, there is a timeout, then it exits bootloader by itself.