{"id":20744556,"url":"https://github.com/avaray/esp32-bme280-micropython-weather-station","last_synced_at":"2026-05-01T22:33:59.617Z","repository":{"id":240368098,"uuid":"797360232","full_name":"Avaray/esp32-bme280-micropython-weather-station","owner":"Avaray","description":"Small project for my Greenhouse","archived":false,"fork":false,"pushed_at":"2024-06-01T08:01:31.000Z","size":2366,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-24T19:47:14.320Z","etag":null,"topics":["bme280","bmp280","device","esp","esp32","esp32-wroom","iot","micropython","micropython-esp32","python","weather","weather-station"],"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/Avaray.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-05-07T17:19:27.000Z","updated_at":"2024-06-01T08:01:35.000Z","dependencies_parsed_at":"2024-05-30T09:30:22.629Z","dependency_job_id":null,"html_url":"https://github.com/Avaray/esp32-bme280-micropython-weather-station","commit_stats":null,"previous_names":["avaray/esp32-bme280-micropython-weather-station"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Avaray/esp32-bme280-micropython-weather-station","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avaray%2Fesp32-bme280-micropython-weather-station","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avaray%2Fesp32-bme280-micropython-weather-station/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avaray%2Fesp32-bme280-micropython-weather-station/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avaray%2Fesp32-bme280-micropython-weather-station/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Avaray","download_url":"https://codeload.github.com/Avaray/esp32-bme280-micropython-weather-station/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avaray%2Fesp32-bme280-micropython-weather-station/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28010791,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bme280","bmp280","device","esp","esp32","esp32-wroom","iot","micropython","micropython-esp32","python","weather","weather-station"],"created_at":"2024-11-17T07:16:07.462Z","updated_at":"2025-12-24T22:20:58.003Z","avatar_url":"https://github.com/Avaray.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Weather Station for my Greenhouse (WIP)\n\n![Image Description](/images/device.jpg)\n\n# Required Hardware\n\n- [ESP32](https://botland.store/1322-esp32-wifi-and-bt-modules) based development board.\n- [BME280](https://botland.store/pressure-sensors/11803-bme280-humidity-temperature-and-pressure-5904422366179.html) or [BMP280](https://botland.store/pressure-sensors/7245-bmp280-digital-barometer-pressure-sensor-110kpa-i2cspi-33v-5904422310042.html) sensor.\n- Power supply, Powerbank (without low current shutoff), or something else to power your device.\n- Cables to connect things together.\n\n# How to run code from this repository\n\n1. Install [Micropython](https://micropython.org/download/ESP32_GENERIC/) (1.13+) on your ESP32 development board.\n2. Connect BME280 or BMP280 sensor to proper Pins.\n3. Modify `config.py` configuration file.\n4. Upload all Python's `.py` files to your device (using [Thonny](https://thonny.org/) or [MPY-Jama](https://github.com/jczic/ESP32-MPY-Jama/releases)).\n5. Reboot device and check terminal. Device will print messages on every important step (when booting, connecting to network, reading sensor, sending data, going to deep sleep).\n\n# Configuring device\n\nYou can configure your device by editing the `config.py` file.  \nBelow you see only the most important settings. You will find more inside the file.\n\n```python\n# List of Wi-Fi networks\nNETWORKS = [\n  {\"ssid\": \"My-Awesome-Network-Name\", \"password\": \"neverGuess123\"}\n]\n\n# List of servers (URL's to upload sensor readings; names are optional)\nSERVERS = [\n  {\"name\": \"primary\", \"url\": \"https://my.website.com\"},\n  {\"name\": \"local\", \"url\": \"http://192.168.0.20:4000\"},\n]\n\n# SCL and SDA pins for the sensor\nSENSOR_SCL_PIN = 22\nSENSOR_SDA_PIN = 21\n```\n\n# Admin Mode (Work in Progress)\n\n`UI not included yet`\n`Code not fully implemented yet`\n\n**Admin Mode** creates an open network on the device. After connecting to the network, you can manage the device in a graphical interface. **Admin Mode** is mainly used to configure and debug the device.\n\nTo start device in **Admin Mode** you must have **GPIO 16** and **GPIO 17** pins connected (shorted with [Jumper](\u003chttps://en.wikipedia.org/wiki/Jumper_(computing)\u003e) for example). Without this connection device will boot in **Normal Mode**.\n\nHowever, you can change the `ADMIN_MODE_REVERSED` variable in configuration file to `True`. After making this change, you will need to connect the mentioned pins to boot in **Normal Mode**. Booting without connected pins will start the device in **Admin Mode**.\n\nYou can also specify in the configuration file which pins should be used for **Admin Mode**.\n\n# The Server\n\nYou can create your own server to receive data from the device. The server must be able to receive [POST requests](\u003chttps://en.wikipedia.org/wiki/POST_(HTTP)\u003e) with [JSON](https://en.wikipedia.org/wiki/JSON) data. You can use any backend technology you want. If you will use Python for server, you can easily convert JSON data to a dictionary using `json.loads()` function.\n\nDevice sends JSON data to specified in configuration file [URL's](https://en.wikipedia.org/wiki/URL).  \nBelow you can see an example of the data sent by the device.\n\n```json\n{\n  \"temperature\": 21.5,\n  \"humidity\": 50.0,\n  \"pressure\": 1013.25\n}\n```\n\nThe device will send only the readings that are available. If the device does not have the ability to measure something, it will not be included in the JSON data.\n\n## Example of server code ([BUN.js](https://bun.sh/))\n\nFollowing code is based on [this example](https://bun.sh/guides/http/server) from official documentation.\n\n```javascript\nconst server = Bun.serve({\n  async fetch(req) {\n    if (req.method === 'POST') {\n      const data = await req.json();\n      console.log('Received readings:', data);\n      return Response.json({ status: 200 });\n    }\n    return new Response('Page not found', { status: 404 });\n  },\n});\nconsole.log(`Listening on ${server.url}`);\n```\n\n# TODO's\n\n**Currently working on**\n\n- Admin Mode + Web UI\n- In Admin Mode, force connected client to open a browser with the device's IP address (Captive Portal).\n- Scan for available Wi-Fi networks and display them in Admin Mode.\n\n**In the first place**\n\n- Do better Wi-Fi connection handling\n\n**Later**\n\n- Do better keyboard interruptions. To have the ability to stop the program execution at any time (except when sleeping, ofc.). Currently, I have programmed it to work, but it can be done better. I need to think about it.\n- Better logging and add the option to disable logging to save energy (does it make sense?).\n- OTA updates, Pre-commit hook to generate hashes for all files, plus code backup (to prevent bricking the device)\n- Custom `machine.wake_reason()` for reboots to Admin Mode. If config is not correct, the device will reboot to Admin Mode.\n\n# Notes\n\n[Camelcase](https://developer.mozilla.org/en-US/docs/Glossary/Camel_case) is used in the code because I came from the JavaScript world. I know that in Python, the convention is to use [snake_case](https://developer.mozilla.org/en-US/docs/Glossary/Snake_case). Formatting in Python is also crazy for me, but I'm working on both of these things. I'm trying to find a good formatter.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favaray%2Fesp32-bme280-micropython-weather-station","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favaray%2Fesp32-bme280-micropython-weather-station","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favaray%2Fesp32-bme280-micropython-weather-station/lists"}