{"id":15170179,"url":"https://github.com/johnbigeon/domobibiche","last_synced_at":"2026-01-23T13:47:24.947Z","repository":{"id":247219954,"uuid":"825268383","full_name":"JohnBigeon/DomoBibiche","owner":"JohnBigeon","description":"A serie of multiple microcontrollers (Clients) are communicating through ESPNow technology to a main microcontroller (Broker) developed with Micropython.","archived":false,"fork":false,"pushed_at":"2025-01-26T15:34:37.000Z","size":8850,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T16:28:48.443Z","etag":null,"topics":["esp-now","esp32","influxdb","micropython","rpi","rpizero"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"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/JohnBigeon.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2024-07-07T10:02:38.000Z","updated_at":"2025-01-26T15:34:41.000Z","dependencies_parsed_at":"2024-07-07T12:59:04.520Z","dependency_job_id":"03b1344f-2f03-4f5d-9bb1-e63e8ab9edef","html_url":"https://github.com/JohnBigeon/DomoBibiche","commit_stats":null,"previous_names":["johnbigeon/domobibiche"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnBigeon%2FDomoBibiche","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnBigeon%2FDomoBibiche/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnBigeon%2FDomoBibiche/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnBigeon%2FDomoBibiche/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohnBigeon","download_url":"https://codeload.github.com/JohnBigeon/DomoBibiche/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239195275,"owners_count":19598034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["esp-now","esp32","influxdb","micropython","rpi","rpizero"],"created_at":"2024-09-27T08:00:43.818Z","updated_at":"2026-01-23T13:47:24.909Z","avatar_url":"https://github.com/JohnBigeon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Domotic, Micropython and InfluxDB\n\n## Concept\nA serie of multiple microcontrollers (Clients) are communicating through ESPNow technology to a main microcontroller (Broker) developed with Micropython. The broker is then agglomerating all informations, parse the data, and transfer them to a Raspberry Pi (RPI) via a simple serial communication. This RPI is submitting informations to a database (InfluxDB) and display latest received message on a display (e-ink).\nThe philosophy used here is similar to this great project here [https://github.com/timmbogner/Farm-Data-Relay-System/].\n\n## Visuals\nThe main interface looks like:\n\u003cdiv\u003e\n  \u003cimg src=\"Screenshots_and_Pictures/influxdb_screenshot.png\" alt=\"InfluxDB.\" width=\"800\" /\u003e\n\u003c/div\u003e\n\nand the devices:\n\u003cdiv\u003e\n  \u003cimg src=\"Screenshots_and_Pictures/device_broker_parser.jpg\" alt=\"Parser.\" width=\"200\" /\u003e\n  \u003cimg src=\"Screenshots_and_Pictures/integration_v01.jpg\" alt=\"Client.\" width=\"200\" /\u003e\n\u003c/div\u003e\n\n\n## Hardware \u0026 Integration\n\n### Wiring\n\n```\nESP32        BME280    BH1750   Battery\n----------   -------   ------   -------  -----\n       3V3 - Vin     - Vcc       -Vcc     - Vcc\n       GND - GND     - GND      - GND     - GND\n       G26 - SCL     \n       G25 - SDA     \n       G33 -         - SCL\n       G32 -         - SDA\n```\n\n\n### Elec design\nThe schematic and pcb design has been designed via KiCad:\n\u003cdiv\u003e\n  \u003cimg src=\"KiCad_files/schematic_Domotik.png\" alt=\"Schematic.\" width=\"200\" /\u003e\n  \u003cimg src=\"KiCad_files/pcb_Domotik.png\" alt=\"PCB.\" width=\"200\" /\u003e\n\u003c/div\u003e\n\n\n## Price\n```\n         Object           Price (€)\n-----------------------   -----\n                  ESP32 - 5\n                 BME280 - 5 \n                 CCS811 - 5\n            Rpi zero 2w - 25\n        WaveShare e-ink - 15\n```\n\n\n## Components selection\nThe comparison between boards made by Andreas Spiess can be found here [https://www.youtube.com/watch?v=ajt7vtgKNNM] and summarized by him here [https://docs.google.com/spreadsheets/d/1Mu-bNwpnkiNUiM7f2dx8-gPnIAFMibsC2hMlWhIHbPQ/edit#gid=0].\n\n### Issues observed\nUsing micropython and the associated espnow package seems to draw a lot of current (oscilloscope measurement in progress). With an esp32 and a TP4056 connected to the board, even with capacitors to reduce the peak, the esp32 board never achieved the connection and lead to an infinite loop of reboot sequence.\nWith direct integration of the battery system at the board level, this behaviour is no longer observed.\n\n\n### Power consumption\nTo reduce the power consumption of this project, an e-ink display has been selected. The cpu frequency of the microcontroller has been reduced via the micropython command:\n\n```\nmachine.freq(80000000)\nfreq_machine = machine.freq()\n```\n\n\n## ESP-now\nThe distant communication between microcontrollers is here based on the 'ESP-Now' technology [https://github.com/espressif/esp-now/blob/master/User_Guide.md]. The performance of this protocol is really promising [https://ieeexplore.ieee.org/document/9573246], with around 180m of maximum range. However, the current consumption is higher than the bluetooth.\n\n### Direct communication through the computer\nDuring the early phase of this project, the direct communication for the raspberry pi \u003c-\u003e esp32 has been investigated.\nHowever, due to the complexity to decrype the interlayer communication of this esp-now protocol, this strategy has ben avoided (for now ?).\nFor a better overview of the problem, the projects [https://github.com/thomasfla/Linux-ESPNOW], [https://esp32-open-mac.be/], [https://iot.stackexchange.com/questions/2345/802-11-action-frames-send-and-receive-in-software] clarify the actual status.\n\n\n## Installation\n\n### Clients \u0026 Broker\n\n#### Flash them\nPrepare the esp32 boards with the latest version of Micropython.\nConnect the usb to the USB port and execute the following commands:\n\n```\nesptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash\n```\n\nNote the mac adress:\n\n```\nMAC: 11:22:33:44:55:66\n```\n\nand then upload the firmware:\n\n```\nesptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 ESP32_GENERIC-20240602-v1.23.0.bin \n```\n\n\n#### Update the MAC address\nFor communication between the clients and the broker, you will need to update the mac address in the micropython scripts. For the client and the broker, that will be respectively, the files in Src/Client/main.py and Src/Broker/main.py.\nUpdate the lines:\n\n```\nreceiver_mac = 'a1:b1:c1:d1:e1:f1'\n```\n\nand \n\n```\nsender_mac = 'a2:b2:c2:d2:e2:f2'\n```\n\nIf you have two usb ports on the board, don't forget to switch to the COM port.\nThen, upload the micropython files on the board (via Thonny for example) to the corresponding microcontroller. \n\nFinally, to associate this address of the client with a 'Generic' name of the localisation (for example the living room, ...), you can update the parser register in Src/Parser/intellectron_main.py:\n\n```\nMAC address to name mapping dictionary\nmac_to_name = {\n    'a2:b2:c2:d2:e2:f2': 'Living Room',\n    'a3:b3:c3:d3:e3:f3': 'Device 2',\n    # Add more mappings as needed\n}\n```\n\n### Parser\nThe parser is a simple rpi zero 2w with a crontab task executing a python script. The database is populated via the InfluxDB strategy and displayed on the e-ink screen.\n\n#### Setup the RPI\nTest if the device is on the wifi and establish first connection\n\n```\nping rpi.local\nssh -X me@rpi.local\n```\n\n#### InfluxDB\nThe protocol to install influxdb is inspired from [https://fleetstack.io/blog/install-influxdb-raspberry-pi]. To achieve this, first, install the influxdata package:\n\n```\ncurl -LO https://download.influxdata.com/influxdb/releases/influxdb2_2.7.6-1_arm64.deb\nsudo dpkg -i influxdb2_2.7.6-1_arm64.deb\n```\n\nand the required package for the parser\n```\npip install influxdb-client --break-system-packages\npython -m pip install pyserial --break-system-packages\n```\n\nStart the InfluxDB service:\n\n```\nsudo service influxdb start\nsudo service influxdb status\n● influxdb.service - InfluxDB is an open-source, distributed, time series database\n     Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; preset: enabled)\n     Active: active (running) since Sun 2024-05-26 16:00:35 CEST; 23s ago\n```\n\nUse ifconfig to get your ip's adress:\n\n```\nwlan0: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST\u003e  mtu 1500\n        inet \u003cYour-Raspberry-Pi-IP-Address\u003e\n```\n\nOpen a web browser and navigate to \u003cYour-Raspberry-Pi-IP-Address:8086\u003e.\n\nRecord your token:\n\n```\nThis_Is_A_Token\n```\n\n#### Set the e-ink display\nTo setup the e-ink, the installation described by [https://www.waveshare.com/wiki/2.13inch_e-Paper_HAT_(B)_Manual#Working_With_Raspberry_Pi] has been used.\nFirst, enable the SPI interface:\n\n```\nsudo raspi-config\nChoose Interfacing Options -\u003e SPI -\u003e Yes Enable SPI interface\nsudo apt-get update\nsudo apt-get install python3-pip\nsudo apt-get install python3-pil\nsudo apt-get install python3-numpy\nsudo pip3 install RPi.GPIO --break-system-packages\nsudo pip3 install spidev --break-system-packages\n```\n\nAnd then install the python package of the waveshare display with:\n\n```\ncd Downloads\ngit clone https://github.com/waveshare/e-Paper.git\ncd e-Paper/RaspberryPi_JetsonNano/python\npip install . --break-system-packages\n\n```\n\nA nice tutorial to install it can be found here [https://dev.to/ranewallin/getting-started-with-the-waveshare-2-7-epaper-hat-on-raspberry-pi-41m8] an for more control over the e-ink display, this project seems to be interesting [https://github.com/txoof/epd_display#readme].\n\n\n#### Crontab\nTo execute the python script on RPI at every startup, update the crontab as:\n\n```\ncrontab -e\n@reboot python /home/Me/SubMe/intellectron_main.py\n```\n\n\n### Test and Deploy\n## First integration\n![Integration](Screenshots_and_Pictures/integration_V01.jpg)\n\n## Roadmap\nThis is the expected roadmap for this project:\n\n\n### Proof of concept: version 0.0.1\n- [x] Establish ESPNow communication from clients to Broker.\n- [x] Track errors during script execution using the logging package\n\n\n### Breadboard: version 0.0.2\n- [x] Integrate sensors\n- [x] Fix issue due to too low current for enabling the ESP-Now communication\n- [x] Readme: add 'as it is' words\n\n\n### Be professional\n- [ ] Add a casing to the clients: 3D Print a casing\n- [ ] Determine the lifetime of the client on battery\n\n\n## Project status\nThis project is still in progress and should be completed soon.\n\n\n## Support\nNo technical support can be provided.\n\n\n## Authors and acknowledgment\nThe authors would like to express their gratitude to all the people who took part in the project.\n\n\n## License\nThis project has been developed under MIT license.\n\n\n## Contributing\nNot yet filled.\n\n\n## Credits\nThis script was mainly developed by John Bigeon. If you have any questions or feedback, please don't hesitate to contact me.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbigeon%2Fdomobibiche","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnbigeon%2Fdomobibiche","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbigeon%2Fdomobibiche/lists"}