XM126 Tank Level/Volume Sensor – BTHome + BLE Firmware Updates, No Custom Integration Needed

Hey all,

I put together firmware for the Acconeer XM126 radar module (A121 radar, nRF52840) that turns it into a battery-friendly tank level/volume sensor for Home Assistant — no custom integration or companion app required, and it supports wireless firmware updates over BLE too.

Repo: GitHub - ThyMYthOS/xm126-bthome-tank: Acconeer XM126 tank sensor compatible with BTHome. · GitHub

What it does

  • BTHome v2 broadcast — Home Assistant’s built-in Bluetooth integration discovers and decodes it natively. No pairing, no custom component. Publishes tank distance, volume, battery %, supply voltage, and MCU temperature.
  • Wireless firmware updates over BLE — a periodic connectable advertising window (right after boot, then every few minutes) exposes an mcumgr SMP service. Update via the mcumgr CLI or the nRF Connect mobile app’s DFU tab — no physical DFU button needed.
  • BLE-configurable tank geometry — a small custom GATT service lets you set the tank’s diameter and the sensor’s mounting height over BLE and persists it to flash, instead of baking it in at compile time.
  • Power-aware by design — radar sampling and BLE broadcasting are decoupled: the radar samples often (cheap), but a BLE broadcast only fires on a meaningful volume change or a heartbeat timeout, since BLE TX is the expensive part battery-wise.

Why I built it this way

Most DIY tank sensors either need a custom HA integration/companion app, or don’t have a good OTA update story once installed inside a tank enclosure. BTHome + mcumgr solves both: HA sees it out of the box, and firmware updates don’t require pulling the module back out to reflash over UART.

Hardware

Just the XM126 module itself — it ships with the MCUboot bootloader pre-flashed, so serial recovery over UART works from day one for the very first flash, then BLE DFU takes over after that.

Status / license

BSD-3-Clause for my own code; Acconeer’s redistributed prebuilt radar libraries keep their own license (details in the repo). It’s a single-purpose extraction of one example from Acconeer’s larger XM126 SDK, kept in its own repo so the CI/history isn’t buried under ~25 other sample apps I don’t use.

Happy to answer questions about the BTHome payload, the tank-config BLE service, or the DFU flow — feedback welcome!

Since you posted your project I’ve been researching the XM126 to possibly build this.

One question I have. When flashing are you using an XB122 breakout/flasher or a different method to breakout uart pins?