Title: Vital Care
By: Md. Kamrul Hussain
Project Category: Design Challenge
Project Name: Design For A Cause 2021
Blog post: 07
Previous Blogs:
Blog No. | Title |
---|---|
01 | Introduction |
02.a | SpO2 basics [PPG] |
02.b | SpO2 [MAX30102] |
03 | Temperature |
04 | ECG - AD8232 |
05 | Respiration |
In this blog I'll share my experience of Integrating Arduino IOT Cloud in my project. Before that, I'll provide an update [modification] in the basic 'system model' of my project.
System Model:
The Vital Care is based on three modules providing four body parameters -
- Plethysmograph -> SpO2
- Single lead ECG -> Heart Rate
- Temperature
- Respiration
Modules -
Module01: Chest Strap --> ECG and Respiration
Module02: Wrist Band --> SpO2 and Body Temperature
Module03: IOT cloud dashboard or Android App
Previously, the system model was like Module 01 will send the sensor data to Module 02 using BLE and then Module 02 will send all the data to Module 03 [Android or Cloud app] using WiFi. To do that, the NANO 33 IOT board of the Module 02 has to be operated in a mode where both BLE and WiFi exists simultaneously. Now, that needs some tricks. It is possible, but the WiFiNINA firmware of the board has to be modified. I could not get this option to be checked out. I'll do it later on.
Therefore, I modified the system model a little bit.
I am using MKR WiFi 1010 board in Module 01. This board is similar to NANO 33 IOT with the same processor and wireless chip from u-Blox.
So, according to my new plan both the Module 01 and Module 02 will send data to Cloud App using WiFi simultaneously.
I have used Arduino IOT Cloud where the dashboard can support multiple THINGS at a time but limited to 5 variables in the free version.
So, now I need two 'THINGS' assigned for Module 01 and Module 02.
Module 01 - Vital Care
Module 02 - Vital Care chest
Arduino IOT Cloud configuration
Create Things:
Two Things were created -
1. Vital Care - using NANO 33 IOT - with SpO2, PPG placement and Temperature variables to be displayed
2. Vital Care chest - using MKR WiFi 1010 - with ECG, Heart Rate, LEAD on/off and respiration variables to be displayed
Variables:
1. Vital Care -
{gallery} VitalCareThing |
---|
VitalCareThing Variables: 5 Variables are added - HeartRate, PlaceFinger [to detect whether PPG sensor position is ok or not], Respiratoin drived from PPG, SpO2 from MAX30102, Temperature from MAX30102. Only SpO2, PlaceFinger and Temperature are included in the final dashboard. |
Variable - SpO2: defined as percentage variable with INT data type, Read only data fetched periodically at every 1 second |
Variable - Temperature: defined as Float data type, Read only data fetched periodically at every 1 second |
Variable - PlaceFinger: Boolean data type sends status whether finger is placed properly or the sensor is placed on wrist properly. Read only variable updates on value change. |
2. Vital Care chest-
{gallery} VitalCareChest |
---|
VitalCareChest Variables: 3 Variables are added - HeartRate, ecgLEAD [to detect whether LEAD Electrodes are out], Respiratoin drived from ECG. |
Variable - ecgLEAD: Boolean type to get the status of LEAD off detection. Read the value only when a LEAD off takes place. |
Variable - HeartRate: Float type to read the heartRate from the processed ECG signal. Read the value only when a QRS complex is detected. |
Variable - Respiration: Float type to read the Respiratory signal output from the filtered ECG signal. Read the value only when the R-peak value is changed to represent respiratory exhale / inhale. |
Cloud Dashboard:
A dashboard was designed titled as 'Vital Care Cloud'
It contains six widgets -
- SpO2 - Vital Care - Module01
- Temperature 'C - Vital Care - Module01
- PPG Placement - Vital Care - Module01
- Hear Rate - Vital Care chest - Module02
- ECG LEAD - Vital Care chest - Module02
- Respiration - Vital Care chest - Module02
Output:
MQTT issues in NANO 33 IOT:
It has to be very straight forward using NANO 33 IOT board integrating with Arduino IOT Cloud. But actually I faced couple of issues regarding WiFi firmware and I2C communication with MAX30102.
At first the Nano 33 IOT board was unable to connect to the Arduino IOT Cloud through MQTT. Serial terminal printed -
ArduinoIoTCloudTCP::handle_ConnectMqttBroker could not connect to mqtts-sa.iot.arduino.cc:8883
ArduinoIoTCloudTCP::handle_ConnectMqttBroker 1 connection attempt at tick time 22591
I tried to update the onboard firmware using the stable version of Arduino IDE. But I found that it loads version 1.3.0 which is not supported for Arduino IOT Cloud. I had to use the BETA or hourly version of the IDE to update the WiFi firmware version 1.4.5.
But that was not the biggest issue. Even after updating the firmware I received errors -
ECCX08.begin() failed.
***** Arduino IoT Cloud - configuration info *****
Device ID:
Thing ID: cbb49fc3-c7f5-47cf-845b-2830320917a1
MQTT Broker: mqtts-sa.iot.arduino.cc:8883
- WiFi.status(): 0
Current WiFi Firmware: 1.4.5
The ECC608 Crypto authentication chip could not be initialized. It killed lots of my time and effort and eventually I found the MAX30102 module was creating the disturbance in the I2C line. I kept out the power pin Vin [3.3v] and that pulled down the SDA and SCK line voltage to 2.2v due to the pulled up resistors are populated both on the NANO33IOT and MAX30102 board. MAX30102 operates at 1.8v. Due to that, a voltage converter is placed to maintain the I2C communication with the host MCU operating at higher supply voltage.
Powering up the MAX30102 board properly during the MQTT initialization and putting appropriate delays solved the issue.