The traditional heart rate monitors in hospitals and nursing homes are wired, giant, and expensive. This project aims to create a portable and affordable heart rate alert system with Matter protocol for people with medical needs.
The functionality of this project is similar to the existing solution. When the heart rate of the user or patient is lower or higher than the defined range, for example, between 40 and 140, the monitor will send the control signal to turn on the alert indicator.
System DesignIf you already have the Matter hub, go to the "Bluetooth Peripheral Heart Rate" step.
This project programmed the original Thread Radio Co-Processor (RCP) sample to the nRF52840 dongle.
To flash the RCP application, follow the Nordic instructions for the detailed information.
Build Configuration in VS Code
I strongly recommend using an SD card with at least 32GB of storage with Raspberry Pi OS Lite for the following steps to avoid out-of-memory issues during the compilation.
Step2.1:Install the prerequisites
Run the following commands:
sudo apt-get update
sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \
libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \
python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev \
gcc-arm-none-eabi
Step 2.2: Buildthe CHIP Tool
Run the following commands:
git clone https://github.com/project-chip/connectedhomeip.git
cd connectedhomeip
git submodule update --init
source scripts/activate.sh
./scripts/examples/gn_build_example.sh examples/chip-tool BUILD_PATH
For detailed information on the CHIP Tool, see the Nordic documentation.
Step 2.3: Configurethe OpenThread Border Router
Plugs the radio co-processor dongle to the Raspberry Pi and run the following commands:
git clone https://github.com/openthread/ot-br-posix.git --depth 1
cd ot-br-posix
git pull --unshallow
git checkout 9185bda
./script/bootstrap
Use Ethernet:
INFRA_IF_NAME=eth0 ./script/setup
Use Wi-Fi:
INFRA_IF_NAME=wlan0 ./script/setup
Modify the /etc/default/otbr-agent configuration file with default RCP baud rate:
spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=1000000
For detailed information on the OpenThread Border Router, see the Nordic documentation.
Step 2.4: Form a Thread network
Run the following commands:
sudo ot-ctl dataset init new
sudo ot-ctl dataset commit active
sudo ot-ctl ifconfig up
sudo ot-ctl thread start
Wait a few seconds, the OTBR is acting as a Thread leader and the state can be checking by the following command:
sudo ot-ctl state
Then, Obtain the Thread network credentials by the following command:
sudo ot-ctl dataset active -x
For detailed information on the Thread network, see the OpenThread documentation.
Step 3: Bluetooth Peripheral Heart RateIf you have a Bluetooth heart rate sensor, go to the "Matter Light Bulb" step.
This project modified the Bluetooth peripheral HR sample and programmed it to the nRF52840-DK to simulate a heart rate sensor.
Build Configuration in VS Code
Heart Rate Threshold
#define HR_DEFAULT_VAL (60)
#define HR_LOW_THRESHOLD (40)
#define HR_HIGH_THRESHOLD (140)
User Interface
LED 1: Show the connection state
- Flashing - The device is advertising.
- Solid On - The device is connected.
LED 3: Indicate the low heart rate state
- On - The heart rate is low, <= 40.
LED 4: Indicate the high heart rate state
- On - The heart rate is high, >= 140.
Button 1: Reset the heart rate value to 60
Button 3: Set the heart rate value to 40
Button 4: Set the heart rate value to 140
Step 4: Matter Light BulbIf you have a Matter light bulb, go to the "Matter Alert Switch" step.
This project programmed the original Matter light bulb sample to the nRF7002-DK.
Build Configuration in VS Code
User Interface
LED 1: Show the overall state of the device and its connectivity.
LED 2: Show the state of the light bulb.
Button 1: Press for more than three seconds to initiate the factory reset.
Button 2: Change the state of LED 2 or enable the Bluetooth LE advertising for discovery.
Step 5: Matter Alert SwitchThis project modified the Matter light switch sample and imported the Bluetooth bridge idea from the Matter bridge sample. The alert switch is developed and tested on the nRF52840-DK.
Build Configuration in VS Code
User Interface
LED 1: Show the overall state of the device and its connectivity.
LED 2: Show the state of the light bulb.
Button 1: Press for more than three seconds to initiate the factory reset.
Button 2: Turn off LED 2.
Button 3: Scan and connect to the Bluetooth heart rate sensor.
Button 4: Enable the Bluetooth LE advertising for discovery.
Step 6: CommissioningIf you use the out-of-self Matter hub, follow the instructions of your hub to commission the light bulb and the alert switch, then go to the next step.
The Bluetooth LE discriminator is set with the same value by default. Only one un-commissioned device can be powered up before commissioning.
Run the following command in Raspberry Pi to commission the matter light bulb (nRF7002 DK) into the Wi-Fi network.
./chip-tool pairing ble-wifi 7002 <SSID> <PASSWORD> 20202021 3840
Run the following command in Raspberry Pi to commission the matter light switch (nRF52840 DK) into the Thread network.
./chip-tool pairing ble-thread 52840 hex:<Network Credential> 20202021 3840
For detailed information on commissioning the matter device, see the Nordic documentation.
Step 7: BindingIf you use the out-of-self Matter hub, follow the instructions of your hub to bind the light bulb and the alert switch, then go to the next step.
Run the following command in Raspberry Pi for the matter light bulb device (nRF7002 DK):
./chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": [52840], "targets": [{"cluster": 6, "endpoint": 1, "deviceType": null}, {"cluster": 8, "endpoint": 1, "deviceType": null}]}]' 7002 0
Run the following command in Raspberry Pi for the matter light switch device (nRF52840 DK):
./chip-tool binding write binding '[{"fabricIndex": 1, "node": 7002, "endpoint": 1, "cluster": 6}, {"fabricIndex": 1, "node": 7002, "endpoint": 1, "cluster": 8}]' 52840 1
For detailed information on binding the matter device, see the Nordic documentation.
Step 8: Pair the Bluetooth heart rate sensorPlace the Bluetooth heart rate sensor next to the Matter light switch and Press the button 3 at Matter light switch to connect the sensor.
Step 9: TestingKnown IssuesFailed to scan the Bluetooth peripheral from nRF7002 DK
- I tried to build the Matter alert switch for nRF7002 DK, the function of the Bluetooth Controller is disabled by default.
Comments