Anyone with treated sleep apnea will tell you that the CPAP (Continuous Positive Airway Pressure) machine is life changing and actually allows for restful sleep. The regular CPAP machines aren't perfect though.
One of the most frequent complaints on CPAP machines (besides the uncomfortable mask) is what happens when the humidifier reservoir runs out of water. Due to seasonal changes in air humidity, the machine sometimes needs to use extra heat to maintain the set humidity level. As the reservoir becomes nearly empty, the air slowly heats up. Eventually when the user been blasted by enough hot dry air, they will wake up dried out and annoyed.
My solution to this common problem would be to monitor the water level, and have an alarm can go off to alert the user that more water needs to be added.The Idea
As a CPAP machine is a totally enclosed and airtight device, the best way to monitor the water level (I believe) is to monitor the weight of the entire machine over time. By knowing the weight of the machine with no water and with full water, I can have an alarm go off when the water level is say 10% of the difference between the max and min.
Components of the idea:
- A flat box housing all components including the load sensor.
2. Calibration Buttons
- Two small buttons would be on the back of the base. One is to be pressed to get a measurement of the CPAP machine with no water. The other would be pressed to get a measurement of the CPAP with full water. These values would be stored in non-volatile EEPROM.
- Used for waking the user up when water is low.
4. Alarm Acknowledge Button
- A larger button the user can press to reset the measurement routine and stop the alarm.
5. Hanger (with Tactile Button)
- This is a custom made hanger with a tactile button that will be activated when the mask strap is hanging on it. This will tell the micro to not bother with any measurements. This ensures that while the mask is not being used, no measurements will be made (and therefore no false positives on the alarm).
The calibration for this will be pretty easy. Simply placing the empty humidifier reservoir on the base and hitting the calibrate button will measure the lowest weight of the design. This will be stored in non-volatile memory. The same will be done with the reservoir full.
When the mask is off the hanger, data recording will begin. A measurement will be taken approximately every 30 seconds. Once the first 10 measurements have been taking. A moving average calculation will be make with every new measurement. If this moving average value represents only 10-20% of the water left, the alarm will trigger.
Hitting the alarm acknowledge button will cause the device to wait 5 minutes and being taking measurements again. Hanging up the mask on the hanger will put the device back into inactive mode. Either way, 10 measurements will always be taken before moving average calculation begins.
And here is a block diagram just for fun.First Testing and Designing
I ordered a 5kg load sensor and HX711 amplifier board that came with it. This amplifier takes in the wheatstone bridge input and outputs the scaled value through a serial pin. I used the Q2HX711 Arduino library to do the work of interfacing with this amplifier.
I won't be doing any scaling to proper weights with this as I am basing the calculations off of percentage of water remaining rather than comparing to any preset weight values. This way I won't need to worry about zeroing the scale or drifting results.Designing the Scale
I will be making this out of wood as it needs to be fairly rigid to hold the weight of the CPAP machine. Below are rough sketches of what I am planning for the scale.
The load bar is set up as shown above so that a moment of force will be exerted on one side of the bar to create strain which can be related to weight.
There was some experimenting and trail and error before looking at the datasheet for the load sensor and realizing that the screw holes were for metric screws rather than imperial screws. It seems obvious now, but prior to this I had not considered imperial and metric screws incompatible.Building the Scale
There were some slight changes to the design from the original drawings. Mainly just bringing the speaker to the top rather than the side, and bringing the scale surface off-center to make the acknowledge button and speaker more prominent. As well as hiding the calibration buttons more as they won't need to be used as much.
I did another test of the scale as shown above. More to come on the enclosure later.Hooking it all up
Now that the general enclosure/scale was complete, the next step is building the inputs/outputs into the design, and soldering it all up.
The two buttons are for calibrating the empty and full water reservoir weights. I chose to semi-hide these to limit the chance of accidentally resetting calibration. The screw terminal is for connecting and disconnecting the mask hanger signal (the jumper was to simulate button press).
The rails on the top were an afterthought to ensure that the CPAP machine would not move around and would be level.Soldering
Power jack and switch.
The board consists of an Arduino Nano and the load cell amplifier.
Revised block diagram showing connections to microcontroller.