Raspberry Pi boards are used in many applications like media streamer, Arcade machine, tablet computer, home automation, many more. And now Raspberry Pi can be used as patient monitor with the help of ProtoCentral's Healthy Pi Hat. This patient monitor is portable and efficient in monitoring ECG, Heart Rate, SPO2, Respiration, Temperature and Blood Pressure of a patient. This project shows how to use Raspberry Pi Board along with the ProtoCentral's Healthy PI Hat to change into Patient Monitor.
The HAT uses the Atmel’s SAMD21 processor which collects the ECG and SPO2 data from ADS1292R and AFE4490 respectively and update the data to Raspberry Pi via UART interface. The SAMD21G18A is a 32-bit ARM cortex-M0+ microcontroller with max CPU speed of 48Mhz. It got a SRAM 0f 32KB and Flash 256KB. It runs with a 1.6-3.6V supply.
The board is pre-loaded with the firmware which works stand alone with the Rpi with fewer setup. However you will need some software. Here's what we're using:
- Atmel Studio 7
Please note that Atmel Studio 7 does not support Mac and Linux . This is the IDE software that can do step & memory debugging and its only for Windows. Also you have to make an account on Atmel's site. The IDE can be downloaded from Atmel Studio's Official Website.
Step 1 : Start by launching Atmel Studio 7.
Step 2 : Open the Project [navigate the path where the project is saved].
Step 3 : You'll see the following, where the sketch is in a window, you can edit the code here if you like.
You need a debugger to load the code into the SAMD21G18A. Atmel-ICE will help get from here http://www.atmel.com/tools/atatmel-ice.aspx
Step 1: Set Up and Check Interface
Step 2 : Identify Interface
- OK now you have your debugger plugged in, its good to check that it works, select Device Programming.
- Programming window will be open.
- Select the programmer from the drop down box. Select interface as “SWD”. Click on “Apply”.
- Now read the Power and Device ID. If you are able to read the Device ID then the interface is fine.
Step 3 : Build & Start Debugging
Ok close out the modal programming window and build the program. If there are no error, then your build will be successful.
Step 4 : Run & Upload
- You will see a window appearing to select a debugging tool. Select the tool and interface.
- Once done, go back and Re-run Program without debugging.
- Now you are ready with the Healthy Pi Hat.
Our ProtoCentral's Helathy Pi Hat is ready and now we need to setup our other important device "The Raspberry Pi". The following are the steps involved to get Raspberry Pi ready for a patient monitor.
Step 1 : Install and Update the OS
- Install the latest Raspbian OS in Raspberry Pi. The image file can be downloaded from the Raspberry Pi's official website.
- Once the installation finishes, update the system with the following command in the Terminal.
sudo apt-get update sudo apt-get upgrade
Step 2 : Enable the Serial Connection
- Serial communication should be enabled to interface with the ProtoCentral Healthy PI Hat.
- Run the configuration command and follow the instructions below:
Step 3 : Disable onboard Pi3 Bluetooth and restore UART0/ttyAMA0
As the ProtoCentral's Healthy Pi Hat communicates with the Raspberry Pi board via GPIO 14/15 which on the Model B, B+ and Pi2 is mapped to UART0. However on the Pi3 these pins are mapped to UART1 since UART0 is now used for the bluetooth module. As UART1 is not stable because it is dependent to clock speed which can change with the CPU load, we have to disable the Bluetooth module and map UART1 back to UART0 (tty/AMA0).
- Run the following command
sudo nano /boot/config.txt
- Add this line to the end of the file
- Save the file and Reboot the Pi.
- To disable the Serial Console edit the file using
sudo nano /boot/cmdline.txt
- Remove the word phase " console=serial0, 115200 " or " console=ttyAMA0, 115200".
- Save and Exit the file and Reboot the Pi.
- Now the your Pi is ready to integrate with ProtoCentral's Healthy Pi Hat.
The two important devices [Raspberry Pi Board and Healthy Pi Hat] are ready to communicate with each other. Now we need to setup the software to achieve the end result. We use " Processing IDE " to interact with the user. Processing IDE is used as visualization software for the patient monitor and it is an open source framework based on Java. The following are the steps to get the visualization software ready for patient monitor:
Step 1 : Download Processing IDE for your operating system
Latest Version of the Processing IDE can be downloaded from the following links:
Unzip the file once downloaded.
Step 2 : Download the Processing code for Patient Monitor Visualization
1. Download the necessary files & directories or clone to your desktop from GitHub.
2. Unzipping the archive should make a folder by name HealthyPi that contains the visualization code.
3. Locate the Processing sketchbook directory on your computer. This should have been created automatically when you installed processing. Depending on your operating system, the path will be as follows:
- On Windows : C:/My Documents/Processing
- On MAC : /Users/your_user_name/Documents/Processing
- On Linux : /Home/your_user_name/sketchbook/
Note: This directory appears as "Processing" on Windows/Mac, and goes by the name "Sketchbook" on Linux.
4. From the above mentioned HealthyPi directory Copy/Move the contents of the HealthyPi/Processing/HealthyPi folder to the Processing sketchbook directory which is also mentioned above (Locate the Processing sketchbook)
5. Download the necessary library files from the processing IDE by following the steps one by one.
6. These libraries will be installed in the libraries folder of the Processing [ or Sketchbook] directory. If not available, copy the libraries from the HealthyPi/ Processing/libraries directory and paste it in /libraries sub directory of the Processing [ or Sketchbook] which is also mentioned above (Locate the Processing sketchbook).
Step 3 : Upload the Processing code Raspberry Pi
- To upload the application to the Raspberry Pi, we have a tool in Processing.
- In Processing IDE, Select Tools from the menu and choose, Add tools.
- Select Upload To Pi tool and click Install button which is present in the button right corner as shown in the below image.
- Now, connect your raspberry pi to the internet with the same network as your laptop is connected.
- If any error occurred in uploading the code, check for the internet connection and repeat the process.
- Now all set for the Healthy Pi Hat + Raspberry Pi Board to change as a patient monitor.
Mount ProtoCentral's Healthy PI Hat carefully onto the Raspberry Pi Board's GPIO Pins. And connect this setup with the Raspberry Pi's Display or HDMI Monitor. The Hat communicate with Raspberry Pi using UART interface. Connect the ECG electrodes and SPO2 Probe to the ProtoCentral's Healthy PI Hat.
Now you have your own patient monitor with the help of Raspberry PI and ProtoCentral's Helathy PI Hat.
Raspberry Pi Display stand
HealthyPi Board Schematics and Layout
HealthyPi Hardware and Software Code
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!