How to interface NONIN 4100 pulse oximeter to Linux
Rob Kleissen
May 1 2010
Introduction
Self-management of chronic diseases involves recording and monitoring of the time course of physiological data. A simple example is the management of body weight. It is almost self-evident that he effect of a diet and exercise programs is assessed by measuring body weight regularly. What variables need to be recorded is of course depends on the disease, and also on the objectives of the management program.
The idea of the open telecare approach is, that the digital vault stores this type of information, and helps the client to share this information with others eg care professionals and informal helpers, or peers.
This means that the Digital Vault needs to collect this physiological data, store it, and do some processing so that the data becomes information that is meaningful to others.
One way of doing this is te connect a sensor directly to the Digital Vault, and control the data collection process from the Digital Vault.
To demonstrate this principle, I have written some software that collects pulse-oximetry data from a Nonin 4100 device over Bluetooth and decodes it. A simple shell script controls data collection and writes the raw data to a file. This file is subsequently read by a small c-program that derives a string containing date, saturation and heart rate.
Data collection
The shell script pulsox.sh gets the data
from the Nonin device. I tried to write the script in such a way that
the comments and the messages that are echo-ed to the user should be
sufficiently clear to anyone who has some experience with shell
scripts to understand what is going on. It checks if the Nonin device
is active and within range. If it is, it opens up the serial
communication device to the Nonin, sends a command to go into the
measurement mode that I need, and reads a number of bytes from the
serial channel using a c program called readnon.c whose source
code is listed here.
Output from the script goes to stdout. This is
convenient to see what's going on when the data come in from the
Nonin. Using redirection data can be easily written to a file.
The script itself is not likely to give difficulties. The most difficult part is fulfilling the prerequisite that the bluetooth infrastructure of the Linux system should be running properly. In my experience, there is enough information on the web to help you to get Bluez up and running, but it may take quite some time to find out what is the appropriate info that applies to your specific Linux system. In particular finding the solution for successfully pairing the Nonin 4100 and the Linux system took me quite some time. Eventually I found out how to do this on the Mandriva 2009 Spring distribution, using the simple-agent facility. On my ASUS WL-500G Premium running Kamikaze 8.09.1 I paired the Nonin 4100 using dbus messages
Bluetooth Pairing
Measurement devices such as the Nonin 4100 have a preset PIN code.
This makes the pairing procedure different from the usual one as for
a mobile phone.
To show how pairing can be accomplished with such measurement devices
I have written a small script that pairs a TMSi Mobi4 device. The Mobi is
a portable system for measurement of physiological signals such as ECG, EMG
and EEG. Pairing the Nonin 4100 is similar. Just replace the Bluetooth
addresses and the PIN codes
this script.
Raw data file format
The script pulsox.sh generates a raw data file, that contains the raw data coming from the pulse-oximeter. I think it is a good idea if such a raw data file would have a standardised format. This would allow anyone to write his/her own data analysis software for such data. I needed to start somewhere, so I defined an O(pen) T(elecare) I(nitiative) 0.0 filespec. It is very simple, starts with a file header, includes some comment lines to tell you what the information means, and end with and end comment. Here is a sample file, produced by the pulsox.sh script.
Converting the raw data
Eventually we would like to know the oxigen saturation and the heart rate at the time of measurement. The saturation and heart rate information is available in the byte stream that came from the Nonin device. It is coded as described in the Nonin 4100 specification sheet that is publicly available. The time of measurement was recorded by the pulsox.sh script. So we need a processing step that combines the time and date information and the data from the pulse-oximeter and writes that to a file.
The program nonproc.c does this. It takes the raw data file -as produced by pulsox.sh- figures out what are time of measurement, oxygen saturation and heartrate, and writes that to stdout. I used this Makefile for complilation.
Experiences during testing
I have tested this solution with a Nonin 4100 pulse oximeter, a Trust bluetooth dongle, an Acer Aspire PC running Mandriva 2009 Spring edition Linux distribution and Bluez 4.33 Bluetooth stack. Measurements run smoothly. However, sometimes the Mandiva system freezes completely, and I don't have any idea why. I have been able to cross-compile nonin.c for OpenWrt White Russian 0.9, and the solution runs OK there. It took me some time to figure out how the Bluetooth pairing mechanism under Kamikaze 8.09.1 worked, but after succesfully pairing the Asus and the Nonin machines the code ran also correctly there.
Back