Skip to the content
2 layers65 × 57 mmHa pi hat, the printed circuit board in 3D

RFM69 and MGM210L radio board

Size
65 × 57 mm
Copper layers
2
Thickness
0.8 mm
Parts
50
Nets
97
Pads
274
Tracks, vias
753, 346
Pours
6
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
7 May 2026
Updated
8 May 2026

Overview

Ha pi hat is an open-source printed circuit board by agendek78, from the agendek78/radio_board repository on GitHub. It is a 2-layer board of 65 × 57 mm with 50 parts on 97 nets, routed with 753 tracks and 346 vias.

It is built around the RFM69HCW-433M, RFM69HCW-868S2 and LM1117-3.3. Its parts include 12 capacitors, 12 resistors, 8 connectors, 4 ICs and 4 diodes. It belongs with the radio and wireless boards and the STM32 and Silicon Labs (EFR32, EFM) boards of this library.

Main components

3

README

README.md

radio_board

Firmware for an STM32L452-based radio receiver board that captures wireless M-Bus (wMBus) telegrams using an HopeRF RFM69HCW ISM transceiver and streams the decoded datagrams to a host PC over USB CDC (virtual COM port).

The receiver is intended as a low-cost, embedded alternative to an RTL-SDR based wMBus sniffer, and is wire-compatible with host-side tooling that consumes the RTL-SDR text packet format.

Features

  • wMBus reception on the 868 MHz band. The receiver currently boots in mode T1 (WMBUS_MODE_T), and the driver/RX layer also supports WMBUS_MODE_C1, WMBUS_MODE_C2 and WMBUS_MODE_R — change the call to wmbus_rx_init() in Core/Src/main.c to switch.
  • Polled, non-blocking reception loop driven from main().
  • Platform-independent RFM69HCW driver with a small function-pointer HAL, so the driver can be reused on other MCUs.
  • USB CDC output with three selectable packet formats:
    • WMBUS_PACKET_FORMAT_RAW (default) — raw bytes of the clean wMBus datagram (CRC bytes removed).
    • WMBUS_PACKET_FORMAT_HEXSTRING — uppercase hex of the clean datagram, one packet per line.
    • WMBUS_PACKET_FORMAT_RTLSDR — RTL-SDR compatible text frame (MODE;1;1;TIMESTAMP;PACKET_RSSI;CURRENT_RSSI;LINK_LAYER_IDENT_NO;HEX…).
  • LEDs indicate startup state and per-packet activity.
  • UART debug log on USART1 (115 200 8N1).

Hardware

ItemDetail
MCUSTM32L452XX (Cortex-M4F, 80 MHz)
RadioHopeRF RFM69HCW (868 MHz, FSK/OOK)
Radio interfaceSPI1 + DIO0/DIO2 GPIO + RESET
Host linkUSB Full-Speed CDC (virtual COM port)
Debug UARTUSART1 @ 115 200 baud
LEDsLED0 (PB12), LED1 (PB13)

The CubeMX project (radio_board.ioc) is the source of truth for pin mapping and peripheral configuration. See Core/Inc/main.h for pin defines.

KiCad hardware design

The board itself is designed in KiCad and lives under hardware/. The design is a small Raspberry Pi HAT form-factor carrier ("ha_pi_hat" — Home Automation Pi HAT) that combines a sub-GHz wMBus radio with a 2.4 GHz Zigbee/Thread radio module on a single carrier.

text
hardware/
├── ha_pi_hat.kicad_pro         KiCad 9 project file
├── ha_pi_hat.kicad_sch         Top-level (root) schematic
├── ha_pi_hat.kicad_pcb         PCB layout
├── ism_radio.kicad_sch         Hierarchical sub-sheet: STM32L452 + RFM69HCW
├── ism_radio.sch               Legacy (KiCad 5/6) schematic export
├── ha_pi_hat-cache.lib         Project-cached symbol library
├── mgm210l.lib / .dcm / .bck   Symbol library for the Silicon Labs MGM210L
├── footprints.pretty/          Custom footprints (see below)
├── fp-lib-table, sym-lib-table Library tables for this project
├── fp-info-cache               KiCad's footprint info cache
└── bom/
    └── ibom.html               Interactive HTML BOM (open in a browser)

Schematic sheets

The design is hierarchical; the root sheet (ha_pi_hat.kicad_sch) contains the Pi HAT connector, power, and the MGM210L Zigbee/Thread module, and instantiates the sub-sheet ism_radio.kicad_sch, which holds the sub-GHz radio chain that this firmware drives:

  • MCU — STM32L452CEU (LQFP-48) — runs the firmware in this repo.
  • Sub-GHz transceiver — HopeRF RFM69HCW module (868 MHz), connected to the STM32 via SPI1, with DIO0/DIO2, RESET and chip-select routed to GPIOs (matching the pin defines in Core/Inc/main.h).

Opening the project

KiCad 9.x is required (the project files use the 20250114 schematic format). Open hardware/ha_pi_hat.kicad_pro from the KiCad project manager. For a quick read-only BOM view without KiCad installed, open hardware/bom/ibom.html in any browser.

Repository layout

text
radio_board/
├── CMakeLists.txt              Top-level build (STM32CubeMX/CMake)
├── radio_board.ioc             STM32CubeMX project file
├── STM32L452XX_FLASH.ld        Linker script
├── startup_stm32l452xx.s       Cortex-M startup
├── cmake/                      Toolchain files (gcc-arm-none-eabi, clang)
├── Core/
│   ├── Inc/                    Application headers (main.h, wmbus_rx.h, …)
│   ├── Src/                    Application sources
│   │   ├── main.c              Entry point, CubeMX init, RX loop, USB output
│   │   ├── wmbus_rx.c          wMBus reception state machine
│   │   ├── rfm69hcw_hal.c      STM32 HAL glue for the RFM69 driver
│   │   └── debug_log.c         Lightweight UART logger
│   └── doc/                    wMBus and RTL-SDR format notes
├── Drivers/
│   ├── CMSIS/                  ARM CMSIS headers
│   ├── STM32L4xx_HAL_Driver/   ST HAL
│   └── rfm69/                  Portable RFM69HCW driver (inc/, src/, doc/)
├── Middlewares/
│   └── ST/STM32_USB_Device_Library/  ST USB device middleware
├── USB_DEVICE/
│   ├── App/                    USB CDC application layer
│   └── Target/                 USB device port (usbd_conf.*)
├── hardware/                   KiCad 9 schematic, PCB, footprints, BOM
└── build/                      CMake build output (Debug)

Build

The project uses STM32CubeMX-generated CMake with Ninja. The default preset uses the STM32 ARM clang toolchain (cmake/starm-clang.cmake); a gcc-arm-none-eabi toolchain file is also provided in cmake/.

Available presets (see CMakePresets.json): Debug, Release.

sh
# Configure (Debug preset)
cmake --preset Debug

# Build
cmake --build build/Debug

Build output: build/Debug/radio_board.elf.

The active output packet format can be selected at configure time by passing a CMake cache variable, e.g.:

sh
cmake --preset Debug \
    -DCMAKE_C_FLAGS="-DWMBUS_PACKET_FORMAT=WMBUS_PACKET_FORMAT_RTLSDR"
cmake --build build/Debug

Alternatively edit the WMBUS_PACKET_FORMAT macro in Core/Src/main.c.

Flashing

Any ST-Link compatible tool works. For example, with st-flash:

sh
arm-none-eabi-objcopy -O binary build/Debug/radio_board.elf radio_board.bin
st-flash write radio_board.bin 0x08000000

Or use STM32CubeProgrammer / OpenOCD against the same ELF.

Using the receiver

  1. Flash the firmware and connect the board over USB. The board enumerates as a CDC virtual COM port.
  2. Open the port with any serial tool (minicom, picocom, screen, …). Baud rate is irrelevant for USB CDC.
  3. Received wMBus datagrams are emitted in the configured format (WMBUS_PACKET_FORMAT_RAW by default — pipe the bytes into your decoder).

For host-side decoding, any tool that understands the wMBus link layer (wmbusmeters, etc.) can be fed the hex or raw output.

RFM69HCW driver

The driver in Drivers/rfm69/ is intentionally MCU-agnostic. It interacts with the radio exclusively through a rfm69hcw_hal_t struct of function pointers (SPI transfer, chip-select, reset, delay, tick). The STM32 binding lives in Core/Src/rfm69hcw_hal.c. To port the driver to another platform, re-implement those callbacks and link against the driver sources.

References

  • Core/doc/wmbus.txt — wMBus mode parameters and 3-out-of-6 coding notes.
  • Core/doc/rtlsdr.txt — RTL-SDR text packet format spec.
  • Drivers/rfm69/doc/RFM69HCW-V1.txt — RFM69HCW datasheet notes.

AI-generated code

Significant parts of the firmware were generated with the help of LLM-based coding assistants and then reviewed and integrated by hand. In particular:

  • Drivers/rfm69/ — the platform-independent RFM69HCW driver (rfm69hcw_drv.c / rfm69hcw_drv.h) was AI-generated from the RFM69HCW datasheet (Drivers/rfm69/doc/RFM69HCW-V1.txt) and the function-pointer HAL contract.
  • Core/Src/wmbus_rx.c / Core/Inc/wmbus_rx.h — the wMBus reception state machine (mode configuration, FIFO polling, frame A/B accumulation, callback dispatch) was AI-generated from the wMBus specification notes in Core/doc/wmbus.txt on top of the RFM69HCW driver API.

Parts

50
QtyValueFootprintReferences
9100nFCapacitor_SMD:C_0402_1005MetricC4, C5, C8, C10, C11, C12, C13, C14, C15
4RPi_Hat:RPi_Hat_Mounting_Hole, , ,
4220Resistor_SMD:R_0603_1608MetricR3, R4, R7, R8
43.3kResistor_SMD:R_0402_1005MetricR1, R2, R9, R11
4LEDLED_SMD:LED_0603_1608MetricD1, D2, D3, D6
20Resistor_SMD:R_0402_1005MetricR5, R6
212pFCapacitor_SMD:C_0402_1005MetricC2, C3
110kResistor_SMD:R_0402_1005MetricR12
110nFCapacitor_SMD:C_0402_1005MetricC7
112MHzCrystal:Crystal_SMD_2520-4Pin_2.5x2.0mmY1
11kResistor_SMD:R_0402_1005MetricR10
1433MHzConnector_Pin:Pin_D0.9mm_L10.0mm_W2.4mm_FlatForkAE1
1868MHzConnector_Pin:Pin_D0.9mm_L10.0mm_W2.4mm_FlatForkAE2
1Conn_01x08Connector_PinHeader_2.54mm:PinHeader_1x08_P2.54mm_VerticalJ7
1Discovery dbgConnector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_VerticalJ3
1I2CConnector_JST:JST_PH_S4B-PH-SM4-TB_1x04-1MP_P2.00mm_HorizontalJ2
1LM1117-3.3Package_TO_SOT_SMD:SOT-223-3_TabPin2U1
1LOGOfootprints:zigbee_logoG***
1LOGOfootprints:hassG***
1MGM210Lfootprints:MGM210LM2
1RFM69HCW-433RF_Module:HOPERF_RFM9XW_SMDU3
1RFM69HCW-868RF_Module:HOPERF_RFM9XW_SMDU5
1RPi_GPIOConnector_Samtec_HLE_SMD:Samtec_HLE-120-02-xxx-DV-A_2x20_P2.54mm_HorizontalJ1
1STM debugConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ5
1STM32L452CEUxPackage_DFN_QFN:QFN-48-1EP_7x7mm_P0.5mm_EP5.6x5.6mmU2
1Serial consoleConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical_SMD_Pin1LeftJ8
1USB_B_Microfootprints:USB-MICRO-BJ4
1ZB_JTAG/ISA3pi_ikea_hat:Modified_PinHeader_2x05_P1.27mm_Vertical_SMDJ6

Similar boards

  • 2 layers33.7 × 97.8 mmHAN ESP TSS721, the printed circuit board in 3D

    HAN ESP TSS721

    UtilitechAS/amsreader-firmware

    ESP8266 and ESP32 compatible firmware to read, interpret and publish data to MQTT from smart electrical meters, both DLMS and DSMR is supported

    29 parts470
  • 2 layers52.5 × 36.6 mmESP8266-WebRadio, the printed circuit board in 3D

    ESP8266-WebRadio

    karawin/Ka-Radio

    A wifi webradio with only low cost boards ESP8266 and VS1053 by Jp Cocatrix

    52 parts453
  • 2 layers95.2 × 57.2 mmDomesdayDuplicator, the printed circuit board in 3D

    DomesdayDuplicator

    Domesday86/DomesdayDuplicator

    High-speed LaserDisc RF sampler

    66 parts325GPL-3.0
  • 2 layers189.5 × 204.9 mmSmartSpin2k Panelized, the printed circuit board in 3D

    SmartSpin2k Panelized

    doudar/SmartSpin2k

    Transform your spin bike into a Smart Trainer!

    749 parts292GPL-2.0
  • 4 layers121.9 × 109.2 mmPlinkyblack hwmidi jacks, the printed circuit board in 3D

    Plinkyblack hwmidi jacks

    plinkysynth/plinky_public

    a public release of the plinky sw and hw

    300 parts227
  • 4 layers113.5 × 105.5 mmMultistepper, the printed circuit board in 3D

    Multistepper

    eddyem/stm32samples

    Code samples and ready projects based on bare-metal STM32

    243 parts208
  • 2 layers275 × 103 mmKeebee, the printed circuit board in 3D

    Keebee

    blakesmith/embedded

    Blake's embedded projects

    159 parts167
  • 2 layers43 × 34.3 mmEspway, the printed circuit board in 3D

    Espway

    espway/espway

    Segway-like robot implemented on ESP8266

    37 parts122LGPL-3.0

Questions

How big is the Ha pi hat PCB?

It measures 65 × 57 mm and has 2 copper layers, 0.8 mm thick.

What parts does the Ha pi hat use?

50 parts, built around the RFM69HCW-433M, RFM69HCW-868S2 and LM1117-3.3. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Ha pi hat KiCad files?

From the agendek78/radio_board repository on GitHub, at the commit this page was made from: the board is hardware/ha_pi_hat.kicad_pcb and its schematic hardware/ha_pi_hat.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Ha pi hat design in my own project?

Its repository states no licence, so its author keeps all rights: ask agendek78 before reusing the design.