{"id":23430134,"url":"https://github.com/softplus/esp01-fast-button","last_synced_at":"2026-02-10T18:32:28.171Z","repository":{"id":155417258,"uuid":"548427128","full_name":"softplus/esp01-fast-button","owner":"softplus","description":"ESP-01 Wifi-button, using MQTT to trigger, using fast wifi-connection tricks.","archived":false,"fork":false,"pushed_at":"2023-11-25T17:18:32.000Z","size":274,"stargazers_count":0,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T08:28:03.824Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/softplus.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":"2022-10-09T14:47:48.000Z","updated_at":"2024-01-25T14:28:12.000Z","dependencies_parsed_at":"2023-11-25T18:30:25.988Z","dependency_job_id":"8d5cf4e2-924f-4dca-8f0a-822f7316c323","html_url":"https://github.com/softplus/esp01-fast-button","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/softplus/esp01-fast-button","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softplus%2Fesp01-fast-button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softplus%2Fesp01-fast-button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softplus%2Fesp01-fast-button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softplus%2Fesp01-fast-button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softplus","download_url":"https://codeload.github.com/softplus/esp01-fast-button/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softplus%2Fesp01-fast-button/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271043504,"owners_count":24689767,"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-08-18T02:00:08.743Z","response_time":89,"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":[],"created_at":"2024-12-23T08:15:51.856Z","updated_at":"2026-02-10T18:32:23.124Z","avatar_url":"https://github.com/softplus.png","language":"C++","readme":"# esp01-fast-button\n\nESP-01 Wifi-button, using MQTT to trigger, using fast wifi-connection tricks.\nRegularly connects to wifi and sends MQTT requests within 1300ms.\n\n[MIT license](LICENSE) / (c) 2022 [John Mueller](https://johnmu.com/)\n\n# Hardware\n\nSample hardware uses an ESP-01 module, with pin 3 being used to control the power to the module. The hardware could be simplified to go to deep sleep, but I like the idea of pulling out your own power cord :).\n\n## High-level hardware flow\n\n1. Button turns power on briefly (needs ca 100ms at least)\n2. ESP-01 wakes up, pulls power line high to keep power on\n3. ESP-01 does a fast connect to the wifi AP\n4. ESP-01 sends MQTT packet as desired\n5. ESP-01 turns power line low \u0026 goes offline\n\n# Wifi fast connection\n\nPart of what makes the wifi connection to the AP slow is getting the BSSID of the AP, getting the right channel, getting a local IP address, getting the DNS information, and getting the IP of the MQTT server. We can cache all of these and reduce the timing significantly. This is particularly possible if the device we're using is in a stable location (same AP, channel), and the AP being connected to is mostly static (same channel, local IPs).\n\n## High-level flow\n\n1. Check if we have a cache available\n    1. If so:\n        1. try to connect to the last-known BSSID\n        2. try to use the last-provided device IP, DNS\n        3. pre-connect to MQTT using the IP address, port\n        4. send MQTT packets\n    2. If not:\n       1. Connect using traditional methods\n       2. Get MQTT server's IP address\n       3. save cached connection information (BSSID, IPs, etc)\n       4. connect \u0026 send MQTT packets\n    3. If no valid settings:\n       1. Jump to AP mode below\n\n2. Blink a bit and pull own power plug\n3. If someone's still pushing the button, refresh the wifi connection cache\n4. Wait 4 seconds\n5. If someone's still pushing the button, start AP mode (blink at 0.5Hz). \n6. Remain in AP mode 5 minutes, await connection\n7. If connection: remain in AP mode for 5 minutes\n\n# Access point for configuration\n\nImplements a captive portal so you just need to connect to the AP with your (Android) phone and it'll take you to the home page directly.\nFor direct access, use http://192.168.4.1/ .\n\nThe name of the access point depends on the device's MAC address, it looks something like \"AP_AA1122\".\n\n![](docs/settings.png)\n\nThe homepage of the access point allows configuration of wifi name, authentication, MQTT server settings, and MQTT request to send upon click.\nIt does not check the wifi settings, but if they're wrong, it'll revert to the AP mode again.\n\n# To-do's\n\n* add hardware schematic, circuit board\n* confirm timings of individual steps\n* double-check char-array sizes\n\n# FYI\n\n* OTA not possible on 500MB devices: Flash usage \u003e 250MB\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftplus%2Fesp01-fast-button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftplus%2Fesp01-fast-button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftplus%2Fesp01-fast-button/lists"}