Connect with us

Need help hacking a respiratory monitor

Discussion in 'General Electronics Discussion' started by DougB, Nov 12, 2013.

Scroll to continue with content
  1. DougB


    Oct 13, 2012
    I have an old, no longer supported respiratory monitor that is used to measure flow rates and tidal volumes of a patient's breath. It does this with a sensor that has a rotating vane inside a plastic tube with a device hanging over it on the outside of the tube. The device on the outside has 2 pairs of LEDs pointing toward the vanes. I would like to use the sensor to measure water flow instead of air flow by connecting it to an Arduino processor. But I need to know what the sensor needs from the Arduino and what signal is sent back from the sensor that the Arduino would monitor. I'm at a loss on how to figure that out and would like someones help.

    The sensor has 6 wires coming out of it. I know on the board inside the monitor, two of those are connected together and are the ground. I can turn the monitor on and monitor the 6 lines to the sensor. From that I can tell that one other line is supplied with 5VDC from the monitor. Another line seems to have 6VDC on it when the sensor is connected to the monitor but no voltage coming out of the monitor when sensor is not connected. The other two lines have, I believe, the data since they vary depending on the speed of the vane. I only have a multimeter to test the signal, so I don't really know exactly what those two lines are doing.

    Can someone suggest a way of figuring out with my limited equipment and limited knowledge how the sensor works?

    Attached Files:

  2. OLIVE2222


    Oct 2, 2011

    According to your pic it's looks like there is a led on the sensor. Other side should have a photodiode or a phototransistor to made the optical detection. Maybe be a sharp picture of the module inside can help.

  3. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    You've figured out most of it already.

    The sensor contains two LEDs and two photodiodes (or phototransistors or similar). They are placed in such a way that the rotating vane interrupts the light and produces two signals that are "quadrature", or out of phase with each other. This allows the unit to detect the direction of rotation of the vane, as well as the speed. It is the same system as that used in ball-type mice.

    The sensor needs a supply voltage to drive the LEDs. They are probably infra-red LEDs so you won't be able to see the light. The +5V supply is probably used for this; in that case, there will be one or two resistors inside the sensor unit to limit the current to the LEDs.

    The signals from the two photodetectors are digital. The simple, common connection is with the photodetectors connected from the 0V rail (ground) to the signal wires. In this case, the signal wire is pulled low (pulled to ground) when the photodetector is illuminated. The signal needs to be pulled up; usually just a "pullup" resistor to a positive rail is used. These resistors (one for each photodetector) may be in the sensor, or they may be in the unit.

    You can test the sensor easily (with it still connected to the unit) by removing it from the tube and interrupting the light to each photodetector using your hand. With neither photodetector blocked, the signal wires should read low (less than 1V). When you block each light path, one signal should go high. That will confirm that it works as I suspect.

    It should be very easy to interface the sensor to an Arduino. Just connect the 0V and +5V connections as they were, and connect the two signals to digital inputs. If the pullup resistors are inside the sensor, that's all you need to do. If they aren't, you'll need to add them on the Arduino circuit. A typical value would be 10k but you may be able to get an exact value from the unit if you follow the two signal tracks and look for two resistors with the same value, one connected to each signal.

    Google quadrature decoding to find out how to process the signals.

    You might want to check first that the moving water will not disturb the path of the infra-red light through the tube.
  4. DougB


    Oct 13, 2012
    Thanks for the replies.

    KrisBlueNZ: I did remove the tube from the sensor and could verify that each opposing pair operates, except that when not covered, it reads 4.2VDC and when covered it reads .5VDC. That's the opposite of what you said but I assume that is not a significant difference. Thanks for the reference to quadrature decoding - that was interesting to see how that's done. In my case, I will not need to detect reverse flow. What kept me from trying it on an Arduino was the presence of the 6VDC on one line and knowing what to do with it. I was wrong in my original post - the 6VDC is supplied by the monitor. But now I see that if I disconnect that 6VDC line, it all still operates so maybe I'll ignore it unless you can guess at its use.

    Are you familiar with an Arduino and can say that I will be able to decode the pulses fast enough to get the data? I haven't thought too much about that yet, but I assume I will have to measure the time between pulses and convert that to flow rate. My interest is measuring the flow out of a water tank in my boat in order to know how much water is left in the tank (I have no access to the tank so this is the easiest method I've come up with -plus the most fun!).

    Thanks again Kris - you are always very helpful. I appreciate your time!

  5. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    Right, if the signals have opposite polarity that doesn't really make any difference. But you should check that the data lines pull firmly high (> 3V) and low (< 0.8V) with no pullup or pulldown resistors connected to them, i.e. when the sensor has power but the data signals are only connected to your multimeter.

    If you don't need to monitor direction, obviously you will only need one signal.

    I can't suggest what 6V DC might be used for. It would be very interesting to see inside the sensor unit, but I assume that's sealed and you don't want to break into it unless you have to.

    Firmware running in an Arduino will certainly be able to keep up with the pulse rate from the sensor. You can use various methods to process the pulses. Here is a simple way to time the intervals. Set up a timebase that increments at a particular rate, for example 1000 increments per second, either using a hardware timer that can be read at any time or using a periodic interrupt that increments a counter variable. Poll the input to detect an incoming pulse, and when one is detected, read the counter and subtract the last counter value to calculate the interval.

    Your code should also test the counter periodically while nothing is happening, to detect and handle timer wraparound (when the timer overflows - for example, a 16-bit timer will wrap from 0xFFFF to 0x0000 periodically).

    If each pulse represents a particular volume of water, and you only want to keep track of the volume remaining in the tank, you may not even need to convert the period into a flow rate at all.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day