Activity Monitor for Patients on Supplemental Oxygen

For my Microcomputer Applications class at Arizona State University we were tasked with designing and building a medical device that utilized some sort of microprocessor.

I had heard about a friend on supplemental oxygen who often had difficulty remembering to adjust her oxygen supply to match her level of exertion. Essentially, when she transitioned form sitting to standing/walking without increasing her oxygen flow rate, her oxygen consumption increased (due to more exertion), but her supply did not. This resulted in oxygen deprivation and a high risk of syncope. Likewise, if she transitioned from standing/walking to sitting without reducing her oxygen flow rate, she could become hyperoxic, which is also dangerous. As such, I decided to build a device that would help her to remember to adjust her oxygen supply.

I used an Arduino Nano, MPU6050, MaxBotix Ultrasonic rangefinder, HC-05 Bluetooth transceiver (for debugging), broken ear bud, a momentary switch, a regular switch, protoboard, and a project box from Fry’s Electronics.

The idea was to use the MPU6050 in combination with the rangefinder to determine if the person wearing the device was sitting or standing/walking by measuring both activity (movement) and the distance to the ground (the device was intended to be worn on the waist). Doing this with only an inertial measurement unit (the MPU6050 for example) would be extremely difficult as there is not much information to work with (for example, how can you tell the difference between sitting motionless and standing motionless with inertial information only?). Hence the choice to use the rangefinder to measure the distance to the ground. The device functioned by playing a series of tones when a transition in activity was detected (sitting to standing, or standing to sitting). The series of tones ascended in frequency to signal a transition from sitting to standing (which would require an increase in oxygen flow rate), and descended in frequency to signal a transition from standing to sitting (which would require a decrease in oxygen flow rate). This alarm (which played through my broken ear bud) could be dismissed by the user by pressing a momentary switch. The following figures provide further information.

The device worked quite well after several problems were addressed. First, the initial position of the device was too low on the belt, resulting in the range finder being too close the the target (the chair) when the user was sitting. This resulting in failed range measurements. Second, if the device was angled when the user was sitting, aliasing occurred (where sound reflected off of the chair, then off of the ceiling or wall, then returned to the sensor, resulting in a long range measurement > 100in occasionally). This was corrected by ensuring that the device pointed squarely at the target. A future modification would be to mount the device on a swivel mount so that it was always pointing straight down. With these two problems corrected, the device performed with 95.84% accuracy during controlled testing. However, the device has a fatal flaw. If the chair that the user is sitting on is not wide enough to enter the field of view of the ultrasonic rangefinder, the rangefinder will not see the chair, and likely measure the distance to the ground. Hence, the device will think that the user is still standing, especially if the chair is high off the ground. Despite this flaw, the device was well-received for its advanced construction, functionality, user friendliness (comparatively) and interesting application. The code can be found here (I had to switch from using Dropbox to host my downloads as they are ending the download link service. I have switched to Mega, which seems to work really well. I had some trouble using the Mega links with Safari, but Chrome seems to work).

Figure 1: Block diagram of device function, encompassing hardware (including communication protocols), processing of data in software, and communication with user. bme370_schem
Figure 2: Wiring diagram of the device components (not including the ear bud, which acted as the speaker).  picture1
Figure 3: Device enclosure (black) with power switch and ultrasonic rangefinder (round with slits) top left on. Mental belt clip is shown beneath the device. picture2
Figure 4: Side view of device enclosure (black) with power switch and labels. Shown holding belt clip.picture3
Figure 5: Device enclosure (black) showing speaker (white) and dismissal button (black, top left).picture4
Figure 6: Device internals and lid. MPU-6050 is the component with the yellow light. Rangefinder shown top left. Bluetooth transceiver is top right. Arduino Nano is center. Speaker and button on bottom.picture5
Figure 7: Modular constructional allows most components to be easily unplugged/detached from main body and protoboard.  picture6
Figure 8: Bottom of protoboard shows wire management.
Figure 9: The device is mounted high on the belt, maintaining a measurable distance from the chair.



2 thoughts on “Activity Monitor for Patients on Supplemental Oxygen

  1. Hi Cody,

    I appreciate you taking the time to suggest a solution to the problem. I’m sure that one of the wide-beam sensors would be better for this application, but I just used one that I had sitting around. If I ever return to this project I will be sure to reach out.



  2. Hello, this is Cody from MaxBotix Inc.,

    I saw your post, and I would like to reach out to you with some information.

    You state: However, the device has a fatal flaw. If the chair that the user is sitting on is not wide enough to enter the field of view of the ultrasonic rangefinder, the rangefinder will not see the chair, and likely measure the distance to the ground.

    I didn’t see which ultrasonic sensor of ours is being used in this application. As we offer a wide assortment of sensors there is a chance we could find one with greater ability to detect the chair while still ignoring the person. Please reach out to us, if you would ever like any help in the sensor selection process.

    Ultrasonic Sensor Selection Guide:

    Please let me know if you have any questions.

    Best regards,

    Cody Carlson
    Technical Support
    of MaxBotix Inc.
    Phone: (218) 454-0766
    Fax: (218) 454-0768


    Follow us on Facebook at

    Technical support and sales are subject to
    the terms and conditions listed on our
    website at

Leave a Reply

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

You are commenting using your 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