m4 — 2×2 LEGO Macropad
Status: Rev 1 & Rev 2 Tested
2×2 Ortho (4 Keys)
Seeed XIAO nRF52840 BLE / RP2040
2× 74HC595 Shift Registers
Rotary Encoder + OLED
ZMK & QMK

A compact 2×2 ortholinear macropad set in an 8×12 LEGO frame with an optional rotary encoder and I²C OLED display.
Built around the Seeed Studio XIAO RP2040 and Seeed Studio XIAO BLE nRF52840, the m4 served as the hardware and firmware proving ground for chaining two 74HC595 shift registers over SPI before scaling the design up to the 65-key m65 Rev 7.
Other boards in the Seeed XIAO family (SAMD21, XIAO BLE Sense, and ESP32C3) share the same footprint.
Status: All OK
* [x] Gerbers designed
* [x] Firmware (ZMK & QMK)
* [x] Breadboard tested
* [x] Gerbers printed
* [x] Board tested
Features
- Layout: 2×2 ortholinear (4 keys, 5-pin PCB-mount MX switches)
- Controller: Seeed Studio XIAO nRF52840 BLE (Rev 1) or XIAO RP2040 (Rev 2)
- Matrix Expansion: 2× chained
74HC595SMD shift registers - Peripherals: Optional EC11 rotary encoder and I²C OLED display
- Firmware: ZMK (BLE & RP2040) and QMK (RP2040)
3D Render & PCBs
3D Render

KiCad PCB (Front & Back)

BOM
- 1× Seeed Studio XIAO BLE nRF52840 or Seeed Studio XIAO RP2040
- 2× 7-pin DIL/DIP female sockets + matching male headers
- 2×
74HC595surface-mount shift registers (SOIC-16) - 4×
1N4148signal diodes (DO-35 through-hole or SOD-123 SMD) - 4× 5-pin Cherry MX–compatible switches
- 1× EC11 rotary encoder (optional)
- 1× I²C OLED display (optional)
- LEGO 8×12 baseplate (or 2× 4×12 plates) and perimeter bricks/plates
Case & Assembly
- LEGO Enclosure: Uses an 8×12 plate base (or two 4×12 plates). See the m65 Case section for stacking details.
- Soldering & Build: Follow the step-by-step Assembly Guide.
Gerbers & KiCad
- Rev 1 Gerbers
- Shift-Register KiCad Project:
m-lego/m4on GitLab - Direct-Pin KiCad Project (v2):
m-lego/m2x2-v2on GitLab
Firmware
Rev 1 — XIAO nRF52840 (ZMK)
- Prebuilt UF2: firmware/mlego2x2_rev1-seeeduino_xiao_ble-zmk.uf2
- Source:
alinelena/mlego-zmk
Rev 2 — XIAO RP2040 (QMK & ZMK)
- Prebuilt ZMK UF2: firmware/mlego2x2_rev2-seeeduino_xiao_rp2040-zmk.uf2 (ZMK RP2040 source)
- Prebuilt QMK UF2: firmware/mlego_m4_rev2_default.uf2 (QMK source)
Compile QMK from source:
git clone --recurse-submodules -b mlego https://github.com/alinelena/qmk_firmware.git qmk-alin
cd qmk-alin
qmk compile -kb mlego/m4/rev2 -km default
Pinout Reference
- Rows:
1 (D0),4 (D3) - Columns:
C0: Shift Register 1 —QAC1: Shift Register 2 —QA
74HC595NShift Registers:Data (MOSI):11 (D10)Latch (RCLK):8 (D7)Clock (SRCLK):9 (D8)
- Encoder:
Pad_A = 2 (D1),Pad_B = 3 (D2) - OLED (I²C):
SDA = 5 (D4),SCL = 6 (D5)
Additional Photos
