explaingit

druidus/brompton-electric-ble

Analysis updated 2026-05-18

0C++Audience · ops devopsComplexity · 4/5Setup · hard

TLDR

A DIY ESP32 device that reads a Brompton Electric e-bike's battery and ride data over Bluetooth and sends it to Home Assistant for dashboards and charge automation.

Mindmap

mindmap
  root((Brompton BLE Monitor))
    What it does
      Reads battery over BLE
      Publishes to MQTT
      Home Assistant sensors
    Tech stack
      ESP32
      C++
      PlatformIO
      MQTT
    Use cases
      Battery dashboard
      Charge automation
      Ride stats
    Audience
      Hobbyists
      Home Assistant users

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Monitor a Brompton Electric e-bike's battery level and health from a Home Assistant dashboard.

USE CASE 2

Automatically turn off a smart plug once the bike's battery reaches eighty percent.

USE CASE 3

Track ride distance and motor usage statistics for the bike over time.

USE CASE 4

Get notified when the bike's battery is low or fully charged.

What is it built with?

C++ESP32PlatformIOMQTTHome Assistant

How does it compare?

druidus/brompton-electric-bleachanana/mavsdkalange/llama.cpp
Stars00
LanguageC++C++C++
Last pushed2024-05-20
MaintenanceDormant
Setup difficultyhardmoderatemoderate
Complexity4/54/54/5
Audienceops devopsdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires an ESP32 board, a working Home Assistant and MQTT broker setup, and the bike's frame number engraved on the frame.

In plain English

This project lets you build a small hardware monitor for a Brompton Electric Mk1 folding e-bike using a cheap ESP32 microcontroller board. The ESP32 connects to the bike over Bluetooth Low Energy, reads its battery charge level, voltage, battery health, and ride statistics, and then sends all of that information to Home Assistant, a popular home automation system, so it can show up on a dashboard or trigger automations. The Brompton Electric Mk1 uses its own private Bluetooth protocol with an encrypted pairing code generated from the bike's frame number. An earlier open-source project figured out how to talk to the bike over Bluetooth but did not connect it to any home automation system. This project builds on that earlier work and adds WiFi and MQTT support so sensors appear automatically in Home Assistant, a keepalive signal so the bike does not fall asleep while charging, and saved Bluetooth pairing that survives power cycles, along with a fuller set of diagnostic readings like battery cycle count and motor distance. Setup involves finding the six digit frame number engraved on the bike, copying a template file to fill in your WiFi and MQTT details along with that frame number, then flashing the code onto the ESP32 board using PlatformIO, a tool for programming microcontrollers. Once running, the ESP32 publishes its readings to Home Assistant automatically, and the README includes an example automation for turning a smart plug off once the battery reaches eighty percent charge. The README notes some rough edges: the bike only accepts one Bluetooth connection at a time, so the official phone app must be unpaired first, some sensor readings are unreliable or return no data at all, and one health reading does not clearly match any obvious unit yet. Several Bluetooth services on the bike remain unexplored. This is a hobbyist hardware project built for a specific bike model, not a general purpose tool.

Copy-paste prompts

Prompt 1
Walk me through flashing this ESP32 firmware onto a board using PlatformIO for my Brompton Electric bike.
Prompt 2
Help me write a Home Assistant automation using the battery sensor this project creates to control a smart plug.
Prompt 3
Explain how the BLE pairing passkey is derived from the bike's frame number in this project.
Prompt 4
Help me figure out why my ESP32 keeps disconnecting from the bike using this firmware's keepalive logic.

Frequently asked questions

What is brompton-electric-ble?

A DIY ESP32 device that reads a Brompton Electric e-bike's battery and ride data over Bluetooth and sends it to Home Assistant for dashboards and charge automation.

What language is brompton-electric-ble written in?

Mainly C++. The stack also includes C++, ESP32, PlatformIO.

How hard is brompton-electric-ble to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is brompton-electric-ble for?

Mainly ops devops.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.