{"id":30715439,"url":"https://github.com/rwbl/make-brickcommander","last_synced_at":"2026-04-04T20:31:36.200Z","repository":{"id":305656935,"uuid":"1023499180","full_name":"rwbl/make-brickcommander","owner":"rwbl","description":"ESP32 BrickCommander: Wi-Fi \u0026 MQTT bridge for LEGO®, BuWizz \u0026 custom BLE bricks.","archived":false,"fork":false,"pushed_at":"2025-07-23T17:06:37.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-03T06:13:15.622Z","etag":null,"topics":["arduino","ble","brick","buwizz","esp-idf","esp32","iot","lego","lego-powered-up","mqtt","python","robotics"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwbl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-21T08:53:16.000Z","updated_at":"2025-07-23T17:06:41.000Z","dependencies_parsed_at":"2025-07-21T11:36:24.891Z","dependency_job_id":null,"html_url":"https://github.com/rwbl/make-brickcommander","commit_stats":null,"previous_names":["rwbl/make-brickcommander"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rwbl/make-brickcommander","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Fmake-brickcommander","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Fmake-brickcommander/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Fmake-brickcommander/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Fmake-brickcommander/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwbl","download_url":"https://codeload.github.com/rwbl/make-brickcommander/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Fmake-brickcommander/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31413267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T20:09:54.854Z","status":"ssl_error","status_checked_at":"2026-04-04T20:09:44.350Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","ble","brick","buwizz","esp-idf","esp32","iot","lego","lego-powered-up","mqtt","python","robotics"],"created_at":"2025-09-03T06:08:33.515Z","updated_at":"2026-04-04T20:31:36.192Z","avatar_url":"https://github.com/rwbl.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BrickCommander\n\n**Project:** `make-brickcommander`\n\n## Brief\n\n**BrickCommander** is an ESP32-based **command dispatcher** for LEGO®, BuWizz, and custom BLE-controlled devices.  \nIt connects to your Wi-Fi and MQTT broker, listens for commands, and forwards them to the appropriate BLE brick.  \n\nDesigned to be modular, scalable, and fun — this is an educational, non-commercial project for personal and learning purposes only.\n\n---\n\n## Educational Goals\n\nThis project demonstrates and teaches:\n- Arduino programming in C++ with ESP32.\n- Python programming with PySide6 to create a simple GUI for controlling bricks.\n- Basics of BLE and MQTT communication.\n- Basics of controlling hardware with ESP32.\n\n---\n\n## Features\n\n- Supports LEGO® PoweredUp Hub No.4.\n- Supports BuWizz2 Ludicrous.\n- Easily extendable to custom ESP32 or other BLE controllers.\n- Accepts commands via MQTT.\n- Reports presence (`online`/`offline`) via MQTT LWT.\n- Modular and lightweight design.\n- Multiple controllers can be connected and controlled simultaneously.\n\n---\n\n## Supported Bricks\n\n- LEGO® PoweredUp [88009](https://www.lego.com/en-us/product/hub-88009) Hub to power and control PoweredUp sensors and motors.\n- [BuWizz](https://buwizz.com/) 2.0 Ludicrous: a remote control \u0026 battery in one brick, compatible with all LEGO® Power Functions motors and lights.\n- Custom BLE-based ESP32 bricks (planned).\n\n---\n\n## Prototype\n\n\u003cimg width=\"553\" height=\"419\" alt=\"image\" src=\"https://github.com/user-attachments/assets/72d7e7f6-4ef1-4071-b1dd-eb3b141584a9\" /\u003e\n\n## Communication\n\n\u003cimg width=\"825\" height=\"458\" alt=\"image\" src=\"https://github.com/user-attachments/assets/0e99ece6-6aa5-4044-986b-81d73813a3ac\" /\u003e\n\n---\n\n## Hardware\n\n- ESP-WROOM-32 for the BrickCommander.\n\n---\n\n## Software\n\n- Arduino IDE 2.3.6 - libraries:\n  - `ArduinoJson`\n  - `PubSubClient`\n  - `ESP32 BLE`\n  - `ESP32 Board Manager 2.3.1`\n- MQTT - `Mosquitto` broker with pub/sub clients.\n- `Python` 3.11.4 - BrickCommander BLE communication tests and GUI Client example.\n- Python `PySide6` 6.9.1 (Qt for Python), `bleak` for BLE communication.\n- `Thonny` 4.1.7 - Python IDE.\n\n---\n\n## MQTT Topics\n\n| Purpose         | Topic                        |\n|-----------------|------------------------------|\n| Command         | `brickcommander/command`     |\n| Config          | `brickcommander/config`      |\n| Status          | `brickcommander/status`      |\n| Availability    | `brickcommander/availability`|\n\nThe prefix `brickcommander` can be changed in `Configuration.h`.\n\n---\n\n## Command Message\n\n**Topic:**  \n`brickcommander/command`\n\n### Payload Fields (JSON)\n\n| Field        | Type      | Description                                     |\n|--------------|-----------|-------------------------------------------------|\n| controller   | `string`  | Controller name: `legohubno4`, `buwizz2`, etc. |\n| mac          | `string`  | BLE MAC of the device                          |\n| port         | `int`     | Port number                                    |\n| power        | `int`     | Power percentage (0–100)                       |\n| direction    | `string`  | `forward` or `backward`                        |\n| disconnect   | `bool`    | Disconnect after command                       |\n\n### Example\n```json\n{\n  \"controller\": \"legohubno4\",\n  \"mac\": \"90:84:2B:C1:94:79\",\n  \"port\": 0,\n  \"power\": 50,\n  \"direction\": \"forward\",\n  \"disconnect\": false\n}\n```\n\n---\n\n## Config Message\n\n**Topic:**  \n`brickcommander/config`\n\nYou can either request status or update the MQTT configuration.\n\n### Request Status\n\n#### Payload Fields (JSON)\n\n| Field   | Type  | Description      |\n|---------|-------|------------------|\n| status  | `int` | Set to `1`       |\n\n#### Example\n```json\n{\n  \"status\": 1\n}\n```\n\n#### Example Output\n```json\n{\n  \"status\": \"OK\",\n  \"message\": \"{\"free\":146584,\"min_free\":144016,\"size\":243356,\"max_block\":110580}\"\n}\n```\n\n---\n\n### Update MQTT Configuration\n\n#### Payload Fields (JSON)\n\n| Field         | Type      | Description                       |\n|---------------|-----------|-----------------------------------|\n| mqtt_broker   | `string`  | Broker IP address                 |\n| mqtt_port     | `int`     | Broker port number (default 1883)|\n| mqtt_username | `string`  | Broker username                   |\n| mqtt_password | `string`  | Broker password                   |\n\n#### Example\n```json\n{\n  \"mqtt_broker\": \"192.168.2.101\",\n  \"mqtt_port\": 1183,\n  \"mqtt_username\": \"\",\n  \"mqtt_password\": \"\"\n}\n```\n\n---\n\n## Status \u0026 Availability\n\nBrickCommander publishes the following topics:\n\n| Topic                          | Values                |\n|--------------------------------|-----------------------|\n| `brickcommander/availability`  | `online` / `offline` |\n| `brickcommander/status`        | JSON-formatted state |\n\n---\n\n## Example Clients\n\n- Python (PySide6 GUI) - implemented.\n- Others planned — see [TODO.md](TODO.md).\n\n---\n\n## Building \u0026 Flashing\n\n1. Install Arduino IDE or PlatformIO.\n2. Install ESP32 board support \u0026 required libraries (`ArduinoJson`, `PubSubClient`, `ESP32 BLE`).\n3. Clone this repository.\n4. Update `Configuration.h` with your WiFi credentials and MQTT broker IP \u0026 port.\n5. Select your ESP32 board (e.g., Wrover Kit).\n6. Flash the firmware and monitor logs via Serial.\n\n---\n\n## Terminal Commands\n\nYou can also interact via the Serial terminal (all commands in lowercase):\n\n| Command   | Description                               |\n|-----------|-------------------------------------------|\n| `restart` | Restart the ESP32 BrickCommander          |\n| `reset`   | Reset configuration to defaults           |\n| `status`  | Print current heap information            |\n\n---\n\n## Next Steps\n\nPlanned \u0026 documented in [TODO.md](TODO.md)\n\n---\n\n## License\n\nMIT License — see [LICENSE](LICENSE) for details.\n\n---\n\n## Disclaimer\n\n- LEGO® is a trademark of the LEGO Group of companies, which does not sponsor, authorize, or endorse this project.\n- The Bluetooth® word mark and logos are registered trademarks owned by Bluetooth SIG, Inc.\n- BuWizz is a trademark of Fortronik d.o.o.\n- All trademarks are property of their respective owners.\n- This is an educational, non-commercial project for personal and learning purposes only.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwbl%2Fmake-brickcommander","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwbl%2Fmake-brickcommander","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwbl%2Fmake-brickcommander/lists"}