I have been asked to make a personal wearable heart monitor that could be easily hidden. In order to prototype the heart monitor transmitter I chose to use an M5StickCplus along with the M5Stack Heart monitor unit produced by M5Stack.
Connecting everything together is easy as all cables are provided with the devices. Take the Heart Rate monitor and connect it to one end of the included cable and plug the other end of the cable into the bottom of the StickCplus.
To program the StickCPlus to read the Mini Heart Unit, we will use M5Stack's, online IDE UIFlow
Before we can program the M5StickCPlus we first need to connect the StickCPlus to UIFLow.
Click on the icon of the three horizontal lines to open the dropdown menu and click on settings.
This will bring up the settings panel:
The API Key is shown on the screen of the StickCplus after connecting it to a WIFI network. Type the 8 character code into this box, select the darker orange StickC icon to select the StickCPlus and then click ok. UIFlow will return to the main screen and attempt to connect to the StickCPlus over wifi.
When connected, the text at the bottom of the screen will change from a red "Disconnected" to green "Connected".
There are times when UIFlow will not connect to a device even when the credentials and codes are correct, this is often out of the users hands as it it often caused by issues connecting to the M5Stack UIFLow server which is hosted in China.
The code for this is simple and show below:
All the code consist of is label that shows the readings from the heart unit placed inside a loop and a block before the program loop that sets the Mini Heart Rate unit into Heart mode or Heart mode with SP02 reading.
To run the program for testing, click on the blue triangle at the top right of the screen which will send the code to the M5StickCPlus in test mode but if the M5StickCPlus is reset the code will be lost.
Step 4 - Install the code permanently.In order to have the code continue running after resetting the M5StickCPlus we need to download the code.
Between the Play and menu button is an Icon with a down arrow. Click on this icon and the program will be saved to the memory of the M5StickCPlus which will be run when ever the M5StickCPlus is powered off and switched on again.
And that's all it takes.
Comments
Please log in or sign up to comment.