Macropad Design Files

Worked for 2 mins 6 sec
Thought for 5 sec
Referenced guidance.
Thought for 13 sec — Delegating task execution
Thought for 2 sec
Thought for 1 sec — Executing skills workflow
Thought for a moment — Executing skills workflow
Referenced guidance.
Thought for 3 sec
Thought for 3 sec — Inspecting schematic components
Thought for a moment — Inspecting schematic components
Getting a schematic overview.
Getting a layout overview.
Looking at the board for ENC1, U1.
Reading the BOM for C*.
Reading schematic details for LED, WS2812.
Reading schematic details for ATmega32U4.
Thought for 10 sec
Read KEY6_D7_PE6, KEY8_D9_PB5, ENC_SW_D16_MOSI_PB2 and 24 more.
Looking at the board in a region of the board.
Reading schematic details for LED1, C11, R7.
Reading layout details for LED1, C11, R7 and 2 more.
Thought for 3 sec
Thought for 4 sec
Thought for 3 sec — Evaluating LED placement
Thought for a moment — Evaluating LED placement
Wired pins.
Thought for 9 sec
Board too small for placement
Baking PCB layout data.
Placing 49 components.
Thought for 2 sec
Thought for 6 sec
Moved 3 component(s)
Thought for a moment

Flux stopped

U1
U2
SW1 2 - SW2 2
GND
J1 GND - U2 GND
J1 GND - U2 GND
J1 GND - U2 GND
SW1 2 - SW2 2
J1 GND - U2 GND
SW1 2 - SW2 2
J1 GND - U2 GND
J1 GND - U2 GND
GND
J1 GND - U2 GND
ENC1 SHIELD__1 - J1 17
LED1 VSS - C11 P2
SW1 2 - SW2 2
GND
J1 GND - U2 GND
SW1 2 - SW2 2
J1 GND - U2 GND
SW1 2 - SW2 2
J1 GND - U2 GND
J1 GND - U2 GND
SW1 2 - SW2 2
SW1 2 - SW2 2
SW1 2 - SW2 2
U1 GND_4 - J1 GND
SW1 2 - SW2 2
GND
J1 GND - U2 GND
U1 GND_4 - J1 GND
J1 GND - U2 GND
SW1 2 - SW2 2
J1 GND - U2 GND
ENC1 SHIELD__1 - J1 17
J1 GND - U2 GND
J1 GND - U2 GND
J1 GND - U2 GND
GND
LED1 VSS - C11 P2
SW1 2 - SW2 2
SW1 1 - D1 C
J1 VBUS - F1 P1
D7 A - U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0B/SCL/INT0)_PD0
D1 A - U1 (SDA/INT1)_PD1
R7 P2 - LED1 DIN
U1 (SS/PCINT0)_PB0 - R7 P1
D5 A - U1 PD7_(T0/OC4D/ADC10)
D10 A - U1 (PDO/PCINT3/MISO)_PB3
J1 DP2 - U2 I/O1
D9 A - U1 PB6_(PCINT6/OC1B/OC4B/ADC)
J1 CC2 - R6 P1
SW5 1 - D5 C
SW9 1 - D9 C
J1 DP2 - U2 I/O1
SW2 1 - D2 C
F1 P2 - U1 UVCC
U1 UCAP - C6 P1
D1 A - U1 (SDA/INT1)_PD1
F1 P2 - U1 UVCC
R3 P2 - U1 D+
U1 UCAP - C6 P1
U1 AREF - C10 P1
D8 A - U1 PB5_(PCINT5/OC1A/~OC4B~/ADC)
F1 P2 - U1 UVCC
SW5 1 - D5 C
U2 I/O1 - R3 P1
D12 A - U1 (PDI/PCINT2/MOSI)_PB2
J1 DN2 - U2 I/O2
R1 P2 - U1 ~RESET
SW10 1 - D10 C
SW8 1 - D8 C
D4 A - U1 PC6_(OC3A/~OC4A)
U1 AREF - C10 P1
F1 P2 - U1 UVCC
J1 VBUS - F1 P1
SW11 1 - D11 C
D11 A - U1 (PCINT1/SCLK)_PB1
R4 P2 - U1 D-
F1 P2 - U1 UVCC
D3 A - U1 PD4_(ICP1/ADC8)
J1 CC1 - R5 P1
D9 A - U1 PB6_(PCINT6/OC1B/OC4B/ADC)
SW7 1 - D7 C
ENC1 A - U1 PF7_(ADC7/TDI)
F1 P2 - U1 UVCC
D6 A - U1 (INT.6/AIN0)_PE6
Y1 P2 - U1 XTAL2
SW3 1 - D3 C
D11
SW10
D1
SW6
D2
D5
SW9
D4
SW4
D7
SW1
D6
SW3
SW11
D9
D12
D10
SW8
SW5
SW7
D3
D8
SW2
C6
Capacitance
1uF
R6
Resistance
5.1kΩ
F1
R5
Resistance
5.1kΩ
R2
Resistance
10kΩ
C7
Capacitance
4.7uF
C11
Capacitance
100nF
C10
Capacitance
100nF
C8
Capacitance
22pF
C2
Capacitance
100nF
C1
Capacitance
100nF
C4
Capacitance
100nF
C3
Capacitance
100nF
ENC1
Y1
R3
Resistance
22 Ω
J1
R7
Resistance
330Ω
LED1
C5
Capacitance
100nF
C9
Capacitance
22pF
R4
Resistance
22 Ω
R1
Resistance
10kΩ
SW_RESET

Refine this doc
Ask about this doc
Firmware Starter — ATmega32U4 Macropad
Platform & Toolchain
  • MCU: ATMEGA32U4-AU
  • Framework: Arduino AVR core, Leonardo-compatible pin numbering
  • Build system: PlatformIO or Arduino IDE
  • USB mode: Native USB HID keyboard/macropad
Mapping note: this schematic maps D18/D19 using the common ATmega32U4 Leonardo mapping: D18 = PF7, D19 = PF6. The pasted requirement labels these as A4/A5; verify the exact firmware variant before committing production firmware.
Pin Mapping

Table


FunctionArduino pinATmega32U4 pin/netConnected toDirectionNotes
Key 1D2PD1SW1 + D1Input pull-upActive-low through diode
Key 2D3PD0SW2 + D2Input pull-upActive-low through diode
Key 3D4PD4SW3 + D3Input pull-upActive-low through diode
Key 4D5PC6SW4 + D4Input pull-upActive-low through diode
Key 5D6PD7SW5 + D5Input pull-upActive-low through diode
Key 6D7PE6SW6 + D6Input pull-upActive-low through diode
Key 7D8PB4SW7 + D7Input pull-upActive-low through diode
Key 8D9PB5SW8 + D8Input pull-upActive-low through diode
Key 9D10PB6SW9 + D9Input pull-upActive-low through diode
Key 10D14PB3 / MISOSW10 + D10Input pull-upActive-low through diode
Key 11D15PB1 / SCKSW11 + D11Input pull-upActive-low through diode
Encoder pushD16PB2 / MOSIENC1 push + D12Input pull-upActive-low through diode
Encoder AD18PF7ENC1 AInput pull-upQuadrature channel A
Encoder BD19PF6ENC1 BInput pull-upQuadrature channel B
ResetRESETRESETSW_RESET + R1HardwareR1 = 10 kΩ pull-up
HWBHWBPE2 / HWBR2Boot strapR2 = 10 kΩ pull-down
USBNativeD+ / D-J1 via U2/R3/R4USBUSB HID device
PlatformIO Setup
Create platformio.ini:

Ini


[env:leonardo]
platform = atmelavr
board = leonardo
framework = arduino
monitor_speed = 115200
lib_deps =
  nicohood/HID-Project@^2.8.4
Complete Starter Firmware

Cpp


#include <Arduino.h>
#include <HID-Project.h>

// Key inputs: active-low, using internal pull-ups.
static const uint8_t KEY_PINS[] = {
  2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 15, 16
};
static const uint8_t NUM_KEYS = sizeof(KEY_PINS) / sizeof(KEY_PINS[0]);

static const uint8_t ENC_A_PIN = 18;
static const uint8_t ENC_B_PIN = 19;

static const uint16_t DEBOUNCE_MS = 5;
static bool keyState[NUM_KEYS];
static bool lastRawState[NUM_KEYS];
static uint32_t lastChangeMs[NUM_KEYS];

static int8_t lastEncState = 0;
static int32_t encoderPosition = 0;

// Example keymap. Replace with QMK-style actions or custom HID shortcuts as needed.
static const KeyboardKeycode KEYMAP[NUM_KEYS] = {
  KEY_F13, KEY_F14, KEY_F15, KEY_F16,
  KEY_F17, KEY_F18, KEY_F19, KEY_F20,
  KEY_F21, KEY_F22, KEY_F23, KEY_F24
};

static int8_t readEncoderState() {
  uint8_t a = digitalRead(ENC_A_PIN) == LOW ? 1 : 0;
  uint8_t b = digitalRead(ENC_B_PIN) == LOW ? 1 : 0;
  return (a << 1) | b;
}

static void handleEncoder() {
  static const int8_t transitionTable[16] = {
     0, -1,  1,  0,
     1,  0,  0, -1,
    -1,  0,  0,  1,
     0,  1, -1,  0
  };

  int8_t state = readEncoderState();
  int8_t transition = (lastEncState << 2) | state;
  int8_t delta = transitionTable[transition & 0x0F];
  lastEncState = state;

  if (delta != 0) {
    encoderPosition += delta;
    // Two quadrature transitions per detent is common; adjust for your encoder.
    if (encoderPosition >= 2) {
      Consumer.write(MEDIA_VOLUME_UP);
      encoderPosition = 0;
    } else if (encoderPosition <= -2) {
      Consumer.write(MEDIA_VOLUME_DOWN);
      encoderPosition = 0;
    }
  }
}

static void scanKeys() {
  uint32_t now = millis();

  for (uint8_t i = 0; i < NUM_KEYS; i++) {
    bool rawPressed = (digitalRead(KEY_PINS[i]) == LOW);

    if (rawPressed != lastRawState[i]) {
      lastRawState[i] = rawPressed;
      lastChangeMs[i] = now;
    }

    if ((now - lastChangeMs[i]) >= DEBOUNCE_MS && rawPressed != keyState[i]) {
      keyState[i] = rawPressed;
      if (keyState[i]) {
        BootKeyboard.press(KEYMAP[i]);
      } else {
        BootKeyboard.release(KEYMAP[i]);
      }
    }
  }
}

void setup() {
  for (uint8_t i = 0; i < NUM_KEYS; i++) {
    pinMode(KEY_PINS[i], INPUT_PULLUP);
    keyState[i] = false;
    lastRawState[i] = false;
    lastChangeMs[i] = 0;
  }

  pinMode(ENC_A_PIN, INPUT_PULLUP);
  pinMode(ENC_B_PIN, INPUT_PULLUP);
  lastEncState = readEncoderState();

  BootKeyboard.begin();
  Consumer.begin();
}

void loop() {
  scanKeys();
  handleEncoder();
  delay(1);
}
Build & Flash

Bash


pio run
pio run -t upload
pio device monitor
If the board does not enumerate, press SW_RESET once. For bootloader recovery, use the ATmega32U4 bootloader reset sequence supported by the selected bootloader/core.
  • Platform & Toolchain

  • Pin Mapping

  • PlatformIO Setup

  • Complete Starter Firmware

  • Build & Flash

Assets

Macropad lid STEP reference

Macropad lid STEP reference

Lid_002330.step3D Model
svg

Logo

logo_everythinkDefault
Macropad case STEP reference

Macropad case STEP reference

Case-v3_002302.step3D Model
ATmega32U4 Macropad thumbnail
Production-intent USB-C macropad based on ATmega32U4 TQFP-44 with 11 Cherry-MX hotswap keys, EC11 encoder, per-key diodes, USB ESD protection, and deferred routing until case STEP alignment.

Properties

Properties describe core aspects of the project.

Pricing & Availability

Distributor

Qty 1

Arrow

$6.46–$9.41

Digi-Key

$0.00

HQonline

$8.22–$8.32

LCSC

$11.93–$13.08

Mouser

$9.80

TME

$7.95

Verical

$4.88–$15.64

Controls