LilyGo BadUSB - ATMEGA32U4 - Info & Pinouts

Updated 28/07-2020

Here is some info about LilyGo BadUSB and you are welcome to add more info about the subject.

After I bought some pieces of LilyGo BadUSB, my first thought was that the board should also be used for anything other than keyboard emulation and evil things.

But first, just a little info about keyboard emulation for non-US:
Finding a library for the Arduino IDE for my Keyboard Layout was a bit difficult, but found “Keyboard_DE” and it works: GitHub - BesoBerlin/Arduino-German-Keyboard: Workaround to use Arduino Leonardo/Micro with german keyboard layout

I’ve tried searching the web for pinouts, schematic and similar.
But ended up separating one of my own LilyGo BadUSB board, and here are some pictures.

I have put on a label with pinouts, because I always forget which pins are which.
(So many pins :smiley: )

Found out that it is an ISP connector that is inside and a red LED.

And here are the pinouts:

Pins in Arduino IDE (board is Leonardo):
SCK = 15
MOSI = 16
MISO = 14
LED = 13

Here near the screwdriver we have an LED.

Another picture of PCB


I have also tried playing a bit with SoftwareSerial and works fine with pins 14, 15, 16 (MISO, SCK, MOSI)

Board Specs:
Microcontroller: ATmega32u4
Clock Speed: 16 MHz
Operating Voltage: 5V DC
Digital I / O Pins: 4 (Onboard LED = 13, MISO = 14, SCK = 15, MOSI = 16)
USB: 1
Flash Memory: 32KB, but 4KB used by bootloader (Caterina-Leonardo / Arduino Leonardo Bootloader)
SRAM: 2.5 KB

It is also possible to remove LED & resistor.

The resistor near the LED on my device are marked “331” (330 Ω)

After removing the resistor, I drilled a hole with a 0.8 mm drill bit between the 2 pads where the resistor was soldered.

With Pin 13 free, it is possible to have SPI interface with e.g. SD card etc.

SD / µSD card tested & works fine with LilyGo BadUSB board.
(CS / Chip Select Pin = Pin 13)

Link for pictures in high resolution & Original Arduino Leonardo Bootloader HEX:

Feel free to drop a post/reply about what cool projects you have gotten out of this little board.

Like “BionicRiddle” did.

(Description, Pictures & Code)

Stay safe and stay legal guys/girls!!

Arduino Leonardo (34.8 KB)

Thanks! I did not know that there was a LED built-in on the board. I repurpose mine as a discord mute indicator using GitHub - Oxmaster/Discord-mute-indicator
I remapped “Ctrl + <” to “Scroll Lock” using AutoHotKey
I changed some things in Oxmaster’s code so it would use pin 13 on the LilyGo


Arduino code:

/*  License
 *  Version 3, 29 June 2007
 *  Copyright (C) 2007 Free Software Foundation, Inc. <>
 *  Everyone is permitted to copy and distribute verbatim copies
 *  of this license document, but changing it is not allowed.
 *  see LICENSE.txt

/*  DiscordMuteIndicator
 *  Version: 1.0
 *  Date: 24.03.2019
 *  Author: Paul Oleszczyk
 *  Twitter: @oxmstr
 *  Email:
 *  Github:

#include <HID-Project.h>

// config ------------------------------------------------------------

/*  which LED will trigger the images
 *  possible choices:
#define triggerLed LED_SCROLL_LOCK

const bool mutedMicrophoneImageWhenTriggerLed = 1;            // LED on if triggerLed (scroll lock by default) is ON (1) or OFF (0) 

// vars --------------------------------------------------------------

bool micState = 0;                                            // current status of triggerLed (scroll lock by default)

// functions declarations --------------------------------------------

void poll();                                                  // poll the status of the triggerLed
void updateLED();                                             // updates the LED, dependent on the micState

// main --------------------------------------------------------------

void setup()
  pinMode(13, OUTPUT);

void loop()

// functions ---------------------------------------------------------

void poll()
  micState = (BootKeyboard.getLeds() & triggerLed) ? 1 : 0;   // compare bit masks if triggerLed (by default scroll lock) is ON or OFF

void updateLED()
  static bool previousMicState = !micState;
  // if there was no change, there is no need to update the LED
  if (previousMicState != micState)
    if (micState == mutedMicrophoneImageWhenTriggerLed)
      digitalWrite(13, HIGH);
    } else
        digitalWrite(13, LOW);
    previousMicState = micState;

// I Love You
	^VKE2::ScrollLock	; Discord Mute (remap Ctrl + < to ScrollLock
	!VKE2::|		; Alt + < fix	(Nordic keyboard)
	<^>!VKE2::|		; AltGr + < fix	(Nordic keyboard)



Thanks for the useful information. I somehow scred up the bootloader. The USB is not getting detected in my Linux Box anymore. tried with



dmesg -w

command. no device detected. trying to use the SPI pins in order to upload the bootloader into the device.

Can you please upload the bootloader hex file?

Any suggestions in this regard will be of great help.

Bootloader is for Arduino Leonardo.

So i’ve received a usb drive as a present that looks exactly like the one in Nico’s post except it isn’t labeled.
Since it seemed a bit suspicious i’ve decided to check it out in a VM. After about 5s it starts a cmd prompt and that’s about it.

So…i don’t have any Arduino or BadUSB experience but i’d like to turn this device into something useful like a security key necessary for the windows login.

So far i’ve disassembled the drive, downloaded and installed the Arduino IDE.

Is it possible to connect the pcb directly via USB to my laptop? I’d know where to connect the red and black wires but what about the white and green one?

Thanks for the feedback :smiling_imp:
It’s great to see someone can use this for something :slightly_smiling_face:

I’ve updated #0 a little bit.

Now also with link to Original Leonardo Bootloader HEX & all pinouts (also USB) via Google Drive.

Unfortunately, I am rarely online on this forum, so do not expect me to respond very quickly :slightly_frowning_face: :sob: