I need to get back to contributing to the community.
I wrote the original code for the Bluetooth Low Energy heart rate fan controller back in June 2020 and proceeded to release a YouTube video shortly after. I can’t say much about the code except that it is pretty bad. I’d like to chalk it up to being short on time, but there really is no excuse for that poorly written code.
There are a few problems with the code…
- Problem: Using Bluetooth Low Energy occupies a connection handle on the server. (This is a show stopper for older HRMs that only allow one connection.)
Solution: ANT+ or ??? - Problem: The code requires alteration before it can be used.
Solution: ESP32 sets itself up as an access point and starts a web server that allows user to edit Wi-Fi/zone settings via a webpage. - Problem: The code requires a user to install software to upload the sketch to ESP32
Solution: Create a loadable .bin like CircuitPython?
Anyhow, the time has come where I had some free time and I revamped the code for the better. I’ve pushed the latest code to GitHub and plan to do some more updates down the road.
I cleaned, optimized, and reduced the clutter and made it more easily readable. I hope this helps everyone who had questions!
Future Improvements
- Web Server
I’ve already implemented a web server example on a feature branch (mDNS and all); however, the space on the ESP32 that I’ve used gets tanked if I build it with the BLE stack. Check it out if you’re interestedfeatures\web-server
- ANT+
One of the benefits of ANT+ is that the client (ESP32 in this case) does not occupy a connection slot. Older heart rate monitors allow only one connection which is a problem when you want to transmit your data to two clients.
A major downside of ANT+ is that it requires a special radio which is not on the ESP32 dev boards and also requires a network key which requires the user to sign up to the development forums.
I’ve also thought about setting the ESP32 up as a client and a server. This would allow the ESP32 to occupy a connection to the server (the HRM) and then re-broadcast itself as an HRM for other clients… essentially forwarding the data. The only problem with this is delay. - Single Board Solution
Perhaps I’ll design a single board solution so the user does not have to wire anything other than plugging the fan wires into some screw terminals.
Thanks for this update! It makes connecting the HRM much easier! I added a LCD screen to my fan that displays my HR at a given time. Thanks so much!