CPAP (Continuous Positive Airway Pressure) therapy is the most common form of treatment for Obstructive Sleep Apnea (OSA). For the CPAP therapy patients, it is important to wear the CPAP mask at all times while sleep in order for the therapy to effective, and also to meet the CPAP compliance criteria required by the insurance companies.
However, many people have issues while adjusting to sleeping with a CPAP mask, including the problem of waking up consistently to find their CPAP mask off. Although many modern CPAP devices are sophisticated enough to differentiate the mask actually being on the person or if the person just turns it on but doesn’t wear the mask, not all of them have alarm or alarm loud enough to wake up the patient when the CPAP mask is removed, or there is a large air leak.
This project is about making digital manometer to monitor the air pressure inside the CPAP piping. It will display the real-time air pressure inside the CPAP piping, and device will sound an audible alarm when the CPAP mask is likely off or there presents large air leak during the therapy.
Supplies:- MPXV7002DP breakout board
- Arduino Nano V3.0 with I/O expansion board
- Serial LCD 1602 16x2 module with IIC/I2C adapter blue or green
- 12x12x7.3mm Momentary Tactile Push Button Switch with a keycap
- DC 5V Active Sound Buzzer
- 2mm ID, 4mm OD, Flexible Silicone Rubber Tubing
- 3D-printed sensor body and the case
- Dupont jumper wires and self-tapping screws (M3x16mm, M1.4x6mm, 6 each)
A manometer is a device to measure pressures. In the normal condition during the CPAP therapy, there is a significant change in the air pressure inside the CPAP piping due to breathing as patient inhale and exhale the air. If there is a large air leak or the mask is off, the air pressure fluctuation in the piping will become much smaller. So essentially we can check the mask status by constantly monitoring the air pressure inside the CPAP piping with a manometer.
Digital Manometer
In this project MPXV7002DP Integrated Silicon Pressure Sensor is used as a transducer to convert the air pressure to digital signals. The MPXV7002DP breakout board is widely available as a pressure differential sensor to measure the airspeed of RC models and is relatively cheap. This is the same technology inside commercial CPAP machines.
MPXV7002DP is a monolithic silicon pressure sensor designed for a wide range of applications. It has a measuring range of air pressure from -2 kPa to 2 kPa (approximately +/- 20.4 cmH2O), which covers nicely the typical pressure levels for treating Obstructive Sleep Apnea range from 6 to 15 cmH2O.
MPXV7002DP is designed as a differential pressure sensor and have two ports (P1 & P2). In this project, MPXV7002DP is used as a gauge pressure sensor by leaving the backside port (P2) open to the ambient air. This way pressure is measured relative to the ambient atmospheric pressure.
MPXV7002DP will output an analog voltage from 0-5V. This voltage is read by the Arduino analog pin and covert to corresponding air pressure using the transfer function provided by the manufacturer. The pressure is measured in kPa, 1Pa = 0.10197162129779 mmH2O. The results then are displayed on the LCD screen in both Pa (Pascal) and cmH2O.
CPAP Machine Monitor
Study shows breathing movements are symmetrical and did not change significantly with increasing age. The average respiratory rate is 14 during quiet breathing for both sexes. The rhythm (inspiration/expiration ratio) is 1:1.21 for men and 1:1.14 for women during quiet breathing.
The raw data of air pressure measurements from the CPAP piping goes up and down as people breath and also has many 'spikes' since Arduino 5.0V supply is quite noisy. Therefore the data needs to be smoothed out and evaluated over time in order to reliably detect the pressure changes introduced by inhalation and exhalation.
Several measures are taken by the Arduino sketch to process the data and monitor the air pressure. In a nutshell, the Arduino sketch uses the running average library by Rob Tillaart to first calculate the moving average of the air pressure measurements in real-time to smooth out the data points, then calculate the minimum and maximum observed air pressure every a few seconds to determine whether the mask has been disconnected by checking the differences between the peak and trough levels of air pressure. So if the incoming data line becomes flat, then it is likely that there's a large air leak or the mask has been disconnected, an audible alarm will sound to wake up the patient to make necessary adjustments. See the data plots for the visualization of this algorithm.
Parts and SchematicsAll the parts are available from Amazon.com and the BOM with links are provided above.
Additionally, the sensor body and the case which consists of device box and back panel need to be 3D-printed using the STL files below. The sensor body should be printed in vertical position with support to for best results.
A schematic is provided for reference.
Build and Initial TestingFirst prepare all the parts for final assembly. Solder the pins to the Nano board if needed then install the Nano board to the I/O expansion board. Then, attach or solder the jumper wires to the button switch and the buzzer. I used some leftover servo connectors instead of using jumper wires. For MPXV7002DP, you can either use the wire that comes with the breakout board without soldering or solder the wire to the breakout board as shown in the picture. Also, cut about 30 mm silicon rubber tubing and attach it to the topside port (P1) on the MPXV7002DP.
Once the parts are prepared, the final assembly is very simple due to the use of the I/O expansion board and the serial I2C LCD.
Step 1: Install the MPXV7002DP breakout board to the 3D-printed sensor body. Inert the open end of the silicon tubing to the measurement hole then secure the board with 2 small screws. Connect the sensor to the S pin at port A0 on the expansion board.
- Analog --> A0
- VCC --> V
- GND -- > G
Step 2: Connect the LCD to the Nano expansion board S pins at port A4 and A5
- SDL -->A4
- SCA -->A5
- VCC --> V
- GND --> G
Step 3: Connect the Buzzer and Switch to the expansion board port D5 and D6
- Switch: to port 5 between S and G
- Buzzer: to port 6, the positive to S and the ground to G
Step 4: Final assembly
Secure the sensor body to the back plate with 4 M3 screws, then install the LCD screen and the Nano expansion board and secure them with small screws. Push the button switch and the buzzer into the case and secure them with hot glue.
Step 5: Programming
- Add the libraries to your Arduino IDE. The libraries can be found at: LiquidCrystal-I2C and RunningAverage.
- Connect your Arduino to the computer and install the Arduino sketch.
That's it. Now power the unit up with either USB or apply 9-12V power to the DC port on the expansion board (recommended). If the LCD display back-light is on but the scree is blank or the letters are hard to read, adjust the screen contrast by turning the blue potentiometer on the back of the LCD I2C module.
Finally attach the the back plate to the front case with 4 M3 screws.
Simple Manometer Test SetupI was curious about the accuracy of this digital manometer and built a simple test stand to compare the meter readout to a classic water manometer. With an electric air pump controlled by a motor speed controller, I was able to generate variable air pressure and took the measurements simultaneously by both digital and water manometers connected in series. The pressure measurements are pretty close at various.air pressure levels.
Put It Into ActionThe use of this device is pretty simple. First connect the device inline between the CPAP machine and the mask use standard 15mm CPAP pipe. Connect one side of the monitor to the CPAP machine then the other side of the monitor to the mask so the air can pass through.
Power-on Calibration
The MPXV7002DP sensor needs to be calibrated to zero pressure against ambient atmospheric pressure every time when power-on to ensure its accuracy. Make sure the CPAP machine is turned off and there is no additional air pressure inside the tubing when powering up. Once the calibration is finished, the meter will display the offset value and a device ready message.
The meter operates in either Manometer mode or CPAP Alarm mode by the push of button. It is worth noting that the LCD back light is managed according to the operation mode and sensor value to make the meter less distracting during sleep.
Manometer Mode
This is the standby mode and a "-" sign will be displayed at the right bottom corner of the screen. The alarm function is disabled in this mode. The screen will show the real-time air pressure in both Pascal (P) and the cmH20 (H) at the first row, and the Minimum and Maximum pressure as well as the Difference between Min. and Max. observed in the past 3 seconds at the second row. In this mode the LCD back light will be constantly on but will time-out if zero relative air pressure has been measured continuously for over 10 seconds.
CPAP Alarm Mode
This is the alarm mode and a "*" sign will be displayed at the right bottom corner of the screen. In this mode the meter will be checking the differences between the peak and trough levels of air pressure. The LCD back light will time out in 10 seconds and remains off as long as there's no low pressure difference has been detected. The back light will turn back on again if a difference of less than 100 Pascal has been detected. And the buzzer will sound an audible alarm with a "Check Mask" message being displayed on screen if the difference in measured air pressured levels has been persistently low for more than 10 seconds. Once the patient re-adjust the mask and the pressure difference returns above 100 Pascal then both alarm and the back light will be turned off again.
DisclaimerThis device is not a medical device, nor an accessory to the medical device. The measurement should not be used for diagnostic and therapeutic purposes.
Comments