Seeed Pulse Oximeter .NET Gadgeteer Module

The Seeed Pulse Oximeter is a monitoring device that measures pulse and noninvasively detects oxygen saturation of the blood.  This post demonstrates use of the Pulse Oximeter in a .NET Gadgeteer application.

Plug the PCB module into a mainboard socket that has the U label.  This example uses socket number 8 on the GHI Electronics Fez Spider mainboard.  (Do not plug in any module while the mainboard power module is connected to power.)  Plug the Pulse Oximeter measurement device into the PCB module with the connector supplied with the device.

Create a new .NET Gadgeteer Application using the Visual Studio template as described in earlier posts about the .NET Gadgeteer Designer.

Pulse Oximeter in .NET Gadgeteer Designer

Pulse Oximeter in .NET Gadgeteer Designer

The Pulse Oximeter measurements are contained by an object of type Gadgeteer.Modules.Seeed.PulseOximeter.Reading, which includes the members PulseRate and SPO2 .  Pulse rate per second and SPO2 oxigen saturation of the blood are both integer values. To get measurements of these values we have to first make sure the device is attached. The probe is closed on the finger of the of the subject to be monitored, with the fingernail in contact with the red sensor. This should activate the PulseOximeter.ProbeAttached event.  The handler delegates for PulseOximeter.ProbeAttached  and PulseOximeter.ProbeDetached events are initialized in the following code segment.

    pulseOximeter.ProbeAttached +=
        new PulseOximeter.ProbeAttachedHandler(pulseOximeter_ProbeAttached);
    pulseOximeter.ProbeDetached +=
        new PulseOximeter.ProbeDetachedHandler(pulseOximeter_ProbeDetached);

We intitialize or stop the PulseOximeter.HeartbeatHandler in the ButtonPressed event handler. In the following code segment the Button.IsLedOn Boolean property indicates whether the PulseOximeter.HeartbeatHandler is running and then adds or removes the delegate accordingly.  We also verify that the probe is attached before attempting to monitor the values.

    void button_ButtonPressed(Button sender, Button.ButtonState state)
    {
        if (!button.IsLedOn && pulseOximeter.IsProbeAttached)
        {
            pulseOximeter.Heartbeat +=
                new PulseOximeter.HeartbeatHandler(pulseOximeter_Heartbeat);
            button.TurnLEDOn();
        }
        else
        {
            pulseOximeter.Heartbeat -=
                new PulseOximeter.HeartbeatHandler(pulseOximeter_Heartbeat);
            button.TurnLEDOff();
        }
    }

Each time the Heartbeat event occurs, the monitor values can be read from the PulseOximeter.Reading parameter of the
handler method. In this example the pulse and oxygen saturation values are printed to the debugger. In a real application the results would be sent to a display or Web service.

    void pulseOximeter_Heartbeat(PulseOximeter sender, PulseOximeter.Reading reading)
    {
        Debug.Print("PulseRate: " + reading.PulseRate);
        Debug.Print("Oxygen Saturation: " + reading.SPO2);
    }

All the code for this example is shown in the following code block.

using Microsoft.SPOT;

using GT = Gadgeteer;
using Gadgeteer.Modules.Seeed;
using Gadgeteer.Modules.GHIElectronics;

namespace SeeedPulseOximeter
{
    public partial class Program
    {
        void ProgramStarted()
        {
            pulseOximeter.ProbeAttached +=
                new PulseOximeter.ProbeAttachedHandler(pulseOximeter_ProbeAttached);
            pulseOximeter.ProbeDetached +=
                new PulseOximeter.ProbeDetachedHandler(pulseOximeter_ProbeDetached);
            button.ButtonPressed +=
                new Button.ButtonEventHandler(button_ButtonPressed);

            Debug.Print("Program Started");
        }

        void pulseOximeter_ProbeDetached(PulseOximeter sender)
        {
            Debug.Print(pulseOximeter.IsProbeAttached.ToString());
        }

        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            if (!button.IsLedOn && pulseOximeter.IsProbeAttached)
            {
                pulseOximeter.Heartbeat +=
                    new PulseOximeter.HeartbeatHandler(pulseOximeter_Heartbeat);
                button.TurnLEDOn();
            }
            else
            {
                pulseOximeter.Heartbeat -=
                    new PulseOximeter.HeartbeatHandler(pulseOximeter_Heartbeat);
                button.TurnLEDOff();
            }
        }

        void pulseOximeter_Heartbeat(PulseOximeter sender, PulseOximeter.Reading reading)
        {
            Debug.Print("PulseRate: " + reading.PulseRate);
            Debug.Print("Oxygen Saturation: " + reading.SPO2);
        }

        void pulseOximeter_ProbeAttached(PulseOximeter sender)
        {
            Debug.Print(pulseOximeter.IsProbeAttached.ToString());
        }
    }
}

Advertisements
  1. #1 by Robert on May 31, 2013 - 8:13 AM

    The SEEED Pulse Oximeter uses an Edan sensor (P/N 1147B13A finger sensor). Does anyone know which Edan SpO2 Pulse Oximeter model is compatible with the SEEED Pulse Oximeter?

  1. Blog J.Schweiss | Sending .NET Gadgeteer Sensor Data to a REST Web Service

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: