Third Year Engineering Project – Wearable ECG Monitor
Repository: Firmware, Hardware, BOM, Spec & Report
https://github.com/Masitech/WearableECGMonitor
Summary
Background
It is estimated by WHO 17 million people die of cardiovascular disease-related every year. To put that in perspective, it’s the equivalent of the population of the Netherlands. It the recent years the development of IoT in the embedded system and especially in the health sector has grown exponentially.
Aim
This project aims to develop a highly integrated battery-powered embedded system with wireless capability. To get an understanding of engineering development that moves past the educational / preconfigured hardware module and into the industrial territory. To gain experience on tools, software, hardware and engineering design process which is relevant in future employment.
Objectives
The objective of this project is to develop a wearable device that can monitor a human heart and extrapolate the ECG waveform from the single channel biopotential signal. The system should be designed to operate from lipo power with optimization targeted towards low power consumption and all-day battery life. The system should be built from small SMD components and follow the best-practiced industry standard for the development of high-density multi-layer custom printed circuit board. Develop firmware using commercially licensable software development package from the manufacture on a professionally supported platform.
System Designs
The system is designed around the max30003 analogue front end from Maxim and nRF52832 microcontroller with on-chip 2.4Ghz radio which can support the BLE stack with full battery management in a package size of 25 * 70mm.
Test result
The final test has been completed on several factors to ensure the hardware and software are functional in different working condition. Comparison between existing system data has been made. The system met the deliverables and objectives outlined in the initial specification.
Project - Result / Testing
BLE Testing
The system was tested with web Bluetooth which runs on the browser and android app (nRF BLE application from Nordic semiconductor). The GATT service protocol is a BLE standard therefore any application which integrates the battery, heart rate service it can interface without any firmware changes. The ECG service is nonstandard, any application written must use the UUID from the firmware. There is not enough time in this project to design a custom android application to display real-time ECG data. BLE diagnostic tool from Nordic semiconductor was used to verify the firmware is working on Android.
Web BLE was used to display ECG data; it uses JavaScript on the web and has a much shorter development period than Android application. However, it was identified during testing the speed of web Bluetooth is significantly slower than the rate to of the ECG data. The web BLE is developed by Google to run Bluetooth application from a web browser to speed up BLE related software development.
Table 8 Ble functionality test list
BLE Tests | Pass? |
BLE client scan shows advertising data (name, service ) | Pass |
BLE success connection | Pass |
Battery level transmission | Pass |
Heart rate transmission | Pass |
ECG transmission (web BLE) | Pass |
ECG transmission (app BLE) | Pass (no GUI) |
Range 0 – 10m | Pass |
Range 11 – 25m | Some packet drops |
Range 25m + | Fail |
Connect to multiple clients simultaneously | Fail |
Disconnection, Reconnection | Pass |
Sleep mode if no connection | Pass |
Disconnect then reconnect to different program/hardware | Pass |
Auto reconnection (loss of connection) | Pass |
Power consumption
Figure 70 Peak power consumption during streaming data in real time
Test condition: normal operation
BLE: connected (streaming)
Power: Battery 2000mAh lipo
Other: onboard LED off, leads on 128sps
The multimeter in current mode measured the current consumption from the battery leads to the custom board. The length of timer the system will be in operation id determined by the battery capacity. The test battery is estimated to last 2000mAh / 7.6mA = 263.15 hours (10.96 days).
Table 9 Hardware test preformed on version B PCB
Hardware Test | Pass? |
Battery charging via micro usb | Pass |
System powers from micro usb when usb present else from battery | Pass |
3.3V voltage rail @ 4.2V battery | Pass |
1.8V voltage rail @ 4.2V battery | Pass |
3.3V voltage rail @ 2.9V battery (see table 10) | Fail |
1.8V voltage rail @ 2.9V battery | Pass |
EMC | untested |
Since version B PCB uses LDO which has a voltage drop between 0.35 – 0.45V see section [5.7.2, 4.1.5]. Test is preformed to ensure the hardware operates correctly as the voltage on the 3.3V rails drops below 3.3V.
Table 10 Hardware functionality test preformed on version B PCB at different voltage level
Functionality Test : 2.9V – 3.7V battery | Pass? |
System brown out | Pass |
BLE | Pass |
SPI | Pass |
UART | Pass |
GPIO | Pass |
PWM | Pass |
LED | Brightness affected |
Normalised ECG Stream to UART – Serial plotter to display the data.
BLE HRM nRF APP
Conclusion
This project aims to develop a highly integrated battery-powered wearable embedded system with wireless capability. To get an understanding of engineering development that moves past the educational / preconfigured hardware module and into the industrial territory. Implementing custom design at chip-level using manufacture provided datasheets. Adopting the use of commercial tools and software and overcoming development problem niche to project in hand with a unique solution. This has been achieved with a custom-designed PCB using the max30003 AFE chip to measure the ECG data from 2 wire, without body bias. The nRF52832 microcontroller with integrated 2.4GHz radio, interfaces with the AFE to acquire the ECG, heart rate data and transmit it over the air using BLE protocol. The embedded hardware supports lithium-ion polymer battery with recharging capability onboard.
Two versions of the PCB have been designed using Autodesk eagle software. Version A has a richer feature set than version B: body temperature sensor, onboard file storage via SPI nor flash. During the development of the project COVID-19 pandemic occurred, this project was more so affected than others, since the designed PCB was manufactured professionally in china during the lockdown. To recover time lost the reduced feature version B was developed; it kept the core objective of the project to meet the aim and objective. This has saved time during the development of embedded firmware.
To develop software while PCB was being manufactured, breadboard prototype hardware was created. It consisted of max30003Wing, a breakout board for the Max30003 AFE IC and spark fun nRF52832 microcontroller. The basic software to acquire ECG data from the AFE chip and send it over serially to a host computer was developed. There were few bugs on the hardware side which was resolved to obtain the Initial result. It proved the proof of concept of the hardware design works. To overcome current difficulties at the time of development the project Gantt chart was altered to adjust to the changes.
Single version B board was assembled at the developer’s house apart from nRF52832, max30003 chip which was installed in the antenna lab since it required hotplate and no-clean flux. There is a single hand mod on the custom PCB to bring over the interrupt pin from the max30003. The initial design used polling however using interrupt in the prototype board proved to be more convenient for the firmware.
The software transition from breadboard prototype to custom board resulted in some minor hardware and software bugs [5.7, 4.5.1] which required unique solution; specifically [5.7.1] which took a long time to resolve to the source of the issue. However, debugging is considered one of the prominent skills an engineer can have; to fix a system there must be an in-depth understanding of the system at a much lower level, in many ways, it’s much harder than creating the system in the first instance.
Version B PCB firmware consisted of SPI AFE software which obtained data from max30003 determined by the interrupt registers on-chip. The serial software is responsible for transmitting the ECG and debug data to a host computer using a reliable wired method. The battery management software monitored the battery voltage level since low battery level can result in inaccurate ECG data and result in system failure due to brownout. The BLE software is developed to make the embedded device wearable and still be able to transmit relevant data over the air. The software is written in C++ with C for specific elements. Complex features such as objects, singleton class, inheritance and template function/class are utilized to make the software more modular and reduce repetition code.
Final testing shows the system designed meets the current aims, objective and deliverable with further changes to make the system more robust outlined for future developers.
Deliverable Checklist
Table 11 Deliverable checklist
Deliverable: Initial specification, Aim, Objective | Check |
Arm Cortex M4 embedded design | Yes |
Custom PCB | Yes |
Onboard battery management | Yes |
Low power wireless communication | Yes |
Firmware: embedded RTOS | Yes |
Firmware: UART, SPI, PWM, SAADC | Yes |
Use of commercial tools and software used in industry | Yes |