Building up on IoT in the Pro Code category, and in continuation of our earlier update Edit Post “Magic Sensors: the enchanted Howlers of the tech world—they always tell you what’s wrong, loudly and repeatedly.” ‹ Arctic Cloud Developer Challenge Submissions — WordPress
So, with Yurii the Wise, we are connecting our Bluetooth device to the internet.
This article describes implementing an IoT device: a Bluetooth to MQTT gateway. The idea is to implement a device with both Bluetooth and Wi-Fi connectivity. Then, all captured data from the BLE can be streamed to the IoT Gateway.
The controller is M5Stick C plus2, based on the ESP32 System on the Module.
We implemented the firmware in the Arduino IDE, which can be used to create a fallback Wi-Fi access point to initialize the Wi-Fi and MQTT connection details. The firmware was written in C++ language using the Arduino framework. We also flipped the bit to turn on the Bluetooth proxy oximeter automatically and turned on the screen to render average values of the SpO2 and BPM.
How does it work?
We used the following external library:
- PulseOximeterLib library to interact with the Pulse Oximeter device. This lib provides the parsed pulse data as well.
- WiFiManager facilitates the onboarding process when the device creates the Fallback Access point to configure the Wi-Fi and MQTT connections.
- PubSubClient to communicate with MQTT broken
We are building the firmware with the Single-responsibility principle to encapsulate the logic of interaction with different peripheral devices and make the logic of main.ino file as clean as possible. Unfortunately, making it work in that couple of days was impossible, and the result was unstable. But stay tuned; we will release the repo with the worked code soon.