Weird Little Server · project plate 03 · home power

EcoWorthyShed

The lean twin: an OLED battery bridge and a hand-cracked frame protocol for the shed's LiFePO4 modules.

STATUS: bench-verified · BOARD: ELEGOO ESP32 + SH1106 OLED

Blueprint plate of the shed bridge: an ESP32 board wired to a small OLED and a LiFePO4 battery block.
Plate 03 — the ELEGOO board, the little OLED, and the battery that answers in a dialect we had to learn by hand. Tap for the full-size plate.
Beelzebubba the Third, engraved ink devil in a striped vaudeville suit and feathered top hat, holding an unfurled blank scroll and giving a thumbs up

Beelzebubba the Third · the brief

# EcoWorthyShed — the OLED twin and the BMC1 dialect

*A field brief by Beezlebubba the Third · Weird Little Server · November 2026*

> Two batteries, two protocols, one afternoon of staring at hexadecimal until it
> started staring back. The shed batteries did not speak any known dialect, so we
> taught ourselves theirs by hand. The checksum is a 16-bit sum of everything
> after the command byte — and if that sentence fills you with delight, this
> brief is for you.

## What it is

A second, leaner battery bridge: an ESP32 with a 128x64 mono OLED that reads
ECO-WORTHY "BMC1"-family LiFePO4 batteries over BLE, cycles through each
battery every 5 seconds, and shows SOC, charge/discharge state, signed watts,
and the device's LAN address. Same BLE engine as the CYD bridge; different
display, different protocol family.

## Hardware

| Part | Notes |
|---|---|
| Board | ELEGOO ESP32 dev board (ESP32-WROOM, CP2102 USB-UART) |
| Display | SH1106 128x64 mono OLED, I2C |
| Radio | BLE (ESP32 native) |
| Battery | BMC1-family 12 V LiFePO4 modules with BLE |

## The BMC1 protocol (the interesting part)

GATT: service `0x0001`, characteristic `0x0002` = write, `0x0003` = notify.

Frame format:

```
AA <cmd> <len> <payload...> <sum_lo> <sum_hi>
```

- `AA` start byte
- `<cmd>` one byte (see commands below)
- `<len>` one byte, payload length
- `<sum>` **16-bit little-endian sum of all bytes from `<cmd>` through the last
  payload byte**
- Responses arrive on the notify characteristic in the same envelope.

Commands:

| Frame | Meaning |
|---|---|
| `AA 20 00 20 00` | info |
| `AA 21 00 21 00` | status |
| `AA 22 00 22 00` | cell voltages |

Status payload (`AA 21`), little-endian:

| Offset | Type | Meaning |
|---|---|---|
| 0..3 | u32 LE, x0.001 | pack voltage (V) |
| 4..7 | s32 LE, x0.001 | current (A), signed |
| 8 | u8 | SOC % |
| 9 | u8 | SOH % |
| 10..13 | u32 LE, x0.001 | remaining Ah |
| 14..17 | u32 LE, x0.001 | nominal Ah |
| 20.. | u8s | temperatures °C |

Cell payload (`AA 22`): 2-byte LE cell voltages in mV.

## How it works

- Scan → connect → subscribe → send the three query frames; decode into the
  shared battery struct; rotate to the next battery every 5 s.
- The OLED page shows: SOC %, CHG/DIS/IDLE, signed watts, and the device's LAN
  address (useful when you need to reach its web page).
- A dangling `c_str()` bug in the scan callback was fixed early — if the screen
  freezes mid-scan on your variant, look for a pointer into a temporary string.

## Build it yourself

1. Arduino core 3.x; board = generic ESP32 dev module.
2. Fill a secrets header: Wi-Fi SSID/password, battery BLE addresses.
3. Flash `EcoWorthyShed.ino` plus `ble.cpp`, `state.cpp`, `bmc1.cpp`, and the
   `ui.cpp`/`web.h` pair (both copied verbatim from the CYD project).
4. Watch the serial log for the first decoded status frame.

## Verification

- Serial prints SOC/voltage/current per battery per cycle.
- Cross-check one reading against the vendor phone app (within a few percent).
- Two batteries, one screen: the rotation should reach each within 5 s.

## Traps and field notes

- The ESP32's CP2102 link on this board is finicky: `erase_flash` and large
  full-chip reads can fail. Write bootloader/partitions/app explicitly and read
  in 64 KB `--no-stub` chunks.
- Battery BLE modules accept exactly one central at a time; close the vendor app.
- The BMC1 checksum does not include the length byte in some clone modules.
  If your frames are rejected, try both checksum starting points before
  suspecting the BLE layer.

## Safety

- Read-only telemetry. No writes to the BMS.
- LiFePO4 banks are high-current DC systems; respect the vendor's fusing and
  wiring rules.

## Use this brief with an LLM

Feed this file to your assistant and ask it to add a web UI, a second protocol
family, or a different display. The frame tables above are sufficient to write
a client in any language.
⤓ Download the brief .md · 4 KB

The short of it

Ink margin figure: the devil covering his face with one hand
Hour four of the frame format.

The shed batteries did not speak JBD, or the minimal profile, or anything in the manuals. So we sat down with a BLE sniffer and a fresh frame format until the shapes made sense: a start byte, a command, a length, a payload, and a sixteen-bit checksum that covers exactly the right bytes.

The result is a tiny bridge that cycles each battery every five seconds and shows SOC, charge state, signed watts and the device's LAN address — leaving the shed's web page one glance away. The protocol notes are the real treasure, and they ship in the brief.

On the board

BoardELEGOO ESP32 (CP2102 USB-UART)
DisplaySH1106 128×64 mono OLED, I2C
RadioBLE, BMC1-family LiFePO4 modules
FrameAA cmd len payload sum_lo sum_hi — 16-bit LE sum of cmd…payload
QueriesAA20 info · AA21 status · AA22 cells

How it works

Field notes

Ink margin figure: the devil with a pocket watch, tapping one foot
The flaky serial retries; the devil counts.

Make your own

Ink margin figure: the devil pointing one long arm off-page
The frame tables are enough; go write your own client.

Give it your Wi-Fi and your battery addresses; the frame tables in the brief are enough to write a client in any language. The BLE engine and web assets are shared verbatim with the CYD bridge.

Frieze: a garden for the shed: scroll-bearing marchers, a nightcapped battery, and ticking checkmarks
Frieze — a garden for the shed: scroll-bearing marchers, a nightcapped battery, and ticking checkmarks.