Hi, I'm working on a project where we're supposed to design a reflectance-based pulse oximeter. The device has a red and infrared LED which takes turns emitting light. There is one photo-transistor which then picks up the reflected light and sends it off to an ADC. The ADC sample rate is 25Hz and the data collection loop is 40ms long. During a time window of 40ms, the data is collected like this: 6ms: Turn RED LED ON 10ms: Start ADC conversion 14ms: Read RED Pulse OX Value from ADC 26ms: Turn INFRARED LED ON 30ms: Start ADC conversion 34ms: Read INFRARED Pulse OX Value from ADC I have very limited knowledge about hardware and electronics, but it seems strange to me that the hardware doesn't have a DC (or bandpass) filter between the photo-transistor and the ADC. I've brought it up with the HW engineer who claims that it will make it impossible to measure the pulses if such a filter was put in place. The reason why I've brought it up is because there's drift in the system (slowly increasing DC) and the ADC will eventually saturate as a result of that. So to "fix" that issue, the HW engineer has implemented some SW logic which lowers the intensity of the LEDs if the digital values from the ADC start creeping outside a pre-defined range. I'm not sure this is a good approach. First of all, changing the LED intensity during sample capture (to "rescale" the signal) is going to cause discontinuities in the digital signal and secondly any signal analysis (as I see it) produce invalid results. If any frequency-domain analysis is done on the digital signal, the "rescaling" will introduce "noise" if I'm not mistaken. I would be happy to hear some opinions on this. Thank you!
Question for the HW engineers
Started by ●April 2, 2015
Reply by ●April 2, 20152015-04-02
On 4/2/15 6:50 PM, Mauritz Jameson wrote:> > 6ms: Turn RED LED ON > 10ms: Start ADC conversion > 14ms: Read RED Pulse OX Value from ADC > 26ms: Turn INFRARED LED ON > 30ms: Start ADC conversion > 34ms: Read INFRARED Pulse OX Value from ADC >i'm reading http://en.wikipedia.org/wiki/Pulse_oximetry to get an idea about what you're doing. why is there a 4 ms gap between LED ON and starting the A/D conversion? just curious. now the photo-transistor measures EM *intensity*, right? not instantaneous EM field, right? then what does it mean to place a "DC (or bandpass) filter between the photo-transistor and the ADC"? what DC do you mean? not DC EM field, i don't think. and i don't think you want to block the "DC component" of the envelope of the intensity of light. it's that intensity that you want to measure, no? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●April 2, 20152015-04-02
Mauritz Jameson <mjames2393@gmail.com> wrote:> I'm working on a project where we're supposed to design > a reflectance-based pulse oximeter. > The device has a red and infrared LED which takes turns > emitting light. There is one photo-transistor which then > picks up the reflected light and sends it off to an ADC. > The ADC sample rate is 25Hz and the data collection loop > is 40ms long. During a time window of 40ms, the data > is collected like this:So, you can take the ratio between them and factor out things that aren't important.> 6ms: Turn RED LED ON > 10ms: Start ADC conversion > 14ms: Read RED Pulse OX Value from ADC > 26ms: Turn INFRARED LED ON > 30ms: Start ADC conversion > 34ms: Read INFRARED Pulse OX Value from ADC> I have very limited knowledge about hardware and electronics, > but it seems strange to me that the hardware doesn't have > a DC (or bandpass) filter between the photo-transistor and > the ADC.It might be good to do that.> I've brought it up with the HW engineer who claims that it > will make it impossible to measure the pulses if such a > filter was put in place.If you can measure the "before" and "after" turning on each LED, and subtract, that doesn't seem bad.> The reason why I've brought it > up is because there's drift in the system (slowly increasing > DC) and the ADC will eventually saturate as a result of that.Where does the drift come from? It sounds like an integrator (DC offset charging a capacitor). For ordinary drift, like thermal effects due to warming, it should eventually level off. Then, all you need to do is be sure that the system is close enough to linear, that the result comes out the same on either end, then you are done.> So to "fix" that issue, the HW engineer has implemented > some SW logic which lowers the intensity of the LEDs if > the digital values from the ADC start creeping outside a > pre-defined range. I'm not sure this is a good approach.If it is thermal drift, that probably works. You have to understand it (calibrate around it), but it should work. If you have an integrator that will drift off to infinity, that won't help.> First of all, changing the LED intensity during sample > capture (to "rescale" the signal) is going to cause > discontinuities in the digital signal and secondly any signal > analysis (as I see it) produce invalid results. If > any frequency-domain analysis is done on the digital signal, > the "rescaling" will introduce "noise" if I'm not mistaken.You have to calibrate for each intensity. And if it is the ratio that counts, and you change both, then it probably works. -- glen
Reply by ●April 3, 20152015-04-03
On Thu, 02 Apr 2015 15:50:25 -0700, Mauritz Jameson wrote:> Hi, > > I'm working on a project where we're supposed to design a > reflectance-based pulse oximeter. The device has a red and infrared LED > which takes turns emitting light. There is one photo-transistor which > then picks up the reflected light and sends it off to an ADC. The ADC > sample rate is 25Hz and the data collection loop is 40ms long. During a > time window of 40ms, the data is collected like this: > > 6ms: Turn RED LED ON > 10ms: Start ADC conversion > 14ms: Read RED Pulse OX Value from ADC > 26ms: Turn INFRARED LED ON > 30ms: Start ADC conversion > 34ms: Read INFRARED Pulse OX Value from ADC > > I have very limited knowledge about hardware and electronics, but it > seems strange to me that the hardware doesn't have a DC (or bandpass) > filter between the photo-transistor and the ADC.I assume you mean a DC-blocking filter, AKA a high-pass filter.> I've brought it up with > the HW engineer who claims that it will make it impossible to measure > the pulses if such a filter was put in place. The reason why I've > brought it up is because there's drift in the system (slowly increasing > DC) and the ADC will eventually saturate as a result of that. So to > "fix" that issue, the HW engineer has implemented some SW logic which > lowers the intensity of the LEDs if the digital values from the ADC > start creeping outside a pre-defined range. I'm not sure this is a good > approach. First of all, changing the LED intensity during sample capture > (to "rescale" the signal) is going to cause discontinuities in the > digital signal and secondly any signal analysis (as I see it) produce > invalid results. If any frequency-domain analysis is done on the digital > signal, the "rescaling" will introduce "noise" if I'm not mistaken. > > I would be happy to hear some opinions on this.In my opinion the HW engineer is fixing a problem by making it worse. This is, alas, not uncommon. Or I'm misunderstanding what he's doing. This is also not uncommon (but I try to remember to ask for clarification before I go off half-cocked). The problem with a DC-blocking filter is that, along with the method you have outlined, you won't know what the values of the readings are. Of course, with the drift you won't know that either. I would implement this system in one of three ways: 1: Fix the stupid drift. Hopefully the reason that this hasn't been done is because it can't be. It doesn't seem like it can't be fixed, but I'm not the man on the spot. 2: Put an "auto zero" circuit in the hardware that zeros out the analog output when the ADC isn't converting (or when the SW says so), then holds that offset when the ADC _is_ converting. Then your ADC readings will be from zero instead of from whatever the drifting value happens to be. It should be possible to implement this with a single op-amp, an electronic switch, and a few passives. 3: Put in a DC-blocking filter, and read the values in the manner suggested by Glen: first take a "no LED at all" reading, then take a "red LED" reading, then take a "infrared LED" reading. Or go red -- none -- infrared. The important thing to do to make this work is to make sure that the DC blocking filter is slow enough that the amount that it changes in response to the LEDs shining on things over the duration of a reading is small enough not to affect the system accuracy. -- www.wescottdesign.com
Reply by ●April 3, 20152015-04-03
On Thu, 02 Apr 2015 22:06:02 -0500, Tim Wescott <tim@seemywebsite.com> wrote: <snip>>I would implement this system in one of three ways: > >1: Fix the stupid drift. Hopefully the reason that this hasn't been done >is because it can't be. It doesn't seem like it can't be fixed, but I'm >not the man on the spot. >This could be an improper use of an instrumentation amplifier in the ADC front-end. Ie, no ground return for bias current. Although you say it is currently DC coupled. Something to look at, I have seen this in other COTS DAQ devices, the end-user is supposed to supply the bias reutrn path. Mark
Reply by ●April 3, 20152015-04-03
On 4/2/2015 6:50 PM, Mauritz Jameson wrote:> Hi, > > I'm working on a project where we're supposed to design a reflectance-based pulse oximeter. The device has a red and infrared LED which takes turns emitting light. There is one photo-transistor which then picks up the reflected light and sends it off to an ADC. The ADC sample rate is 25Hz and the data collection loop is 40ms long. During a time window of 40ms, the data is collected like this: > > 6ms: Turn RED LED ON > 10ms: Start ADC conversion > 14ms: Read RED Pulse OX Value from ADC > 26ms: Turn INFRARED LED ON > 30ms: Start ADC conversion > 34ms: Read INFRARED Pulse OX Value from ADC > > I have very limited knowledge about hardware and electronics, but it seems strange to me that the hardware doesn't have a DC (or bandpass) filter between the photo-transistor and the ADC. I've brought it up with the HW engineer who claims that it will make it impossible to measure the pulses if such a filter was put in place. The reason why I've brought it up is because there's drift in the system (slowly increasing DC) and the ADC will eventually saturate as a result of that. So to "fix" that issue, the HW engineer has implemented some SW logic which lowers the intensity of the LEDs if the digital values from the ADC start creeping outside a pre-defined range. I'm not sure this is a good approach. First of all, changing the LED intensity during sample capture (to "rescale" the signal) is going to cause discontinuities in the digital signal and secondly any signal analysis (as I see it) produce invalid results. If any frequency-domain analysis is done on the digital signal, the "rescaling" will introduce "noise" if I'm not mistaken.> > I would be happy to hear some opinions on this.I think the hardware is messed up. Hard to tell what might be wrong since we don't have any real idea of how the front end is designed. It would be easy to get rid of all your drift problems by pulsing the light and measuring the signal as an AC amplitude rather than a DC value. Then as long as the output from the photo-transistor is always in the ADC range you will get valid data. But if your signal is drifting outside the range of the ADC you would need to add DC blocking so the ADC only sees the AC value. A lot depends on what the hardware is doing with the signal between the sensor and the ADC. This was and I think still is used in "chopper stabilized" amplifiers to eliminate DC offset. But like others have said, if possible, the drift should be designed out rather than dealt with. Any idea of the cause? -- Rick
Reply by ●April 4, 20152015-04-04
On Fri, 03 Apr 2015 22:14:34 -0400, rickman wrote:> It > would be easy to get rid of all your drift problems by pulsing the light > and measuring the signal as an AC amplitude rather than a DC value. Then > as long as the output from the photo-transistor is always in the ADC > range you will get valid data. But if your signal is drifting outside > the range of the ADC you would need to add DC blocking so the ADC only > sees the AC value. A lot depends on what the hardware is doing with the > signal between the sensor and the ADC. > > This was and I think still is used in "chopper stabilized" amplifiers to > eliminate DC offset.Not really apropos to the rest of the thread, but I'll often "chopper stabilize" measurements end-to-end, rather than just using super duper amplifier chips. The problem with chopper stabilized amplifier chips is, generally, the ADC that you feed their output into. ADCs are often the weakest link in the chain as far as DC offset goes, unless they are both slow and expensive. End-to-end chopper stabilization (like pulsing the LED light in this case) means that so long as nothing is saturating, the DC offset of _all_ the stages is taken care of. You do have to worry more about circuit bandwidth, and its effect on the end-to-end gain -- but I've had success with this sort of method more than once. -- www.wescottdesign.com
Reply by ●April 5, 20152015-04-05
The signal from the sensor is not referenced to ground. It is instead referenced to a 3.3V rail. The PGA in the ADC is not able to operate below its power supply voltage divided by 4, so referencing to the upper rail seemed like the best option. The signal is 0.3V away from the rail so it might be possible to reference to ground in the next HW revision. The output from the sensor phototransistor is normally at the 3.3V rail when there is no signal. As light reflecting off the skin increases, the signal drops from 3.3V. This sensor signal goes into one ADC input, and a stable bias point that is now set to 3.3V/11 goes into the other input. The PGA gain in the ADC is set so that we are looking at a range of 8mV below the bias point. The input multiplexor to the ADC is set so that the sensor signal is subtracted from the bias point. Since the ADC output is a two's complement number, the sign bit is shifted out. The result is a 16 bit digital output that covers an 8mV range, on top of an approximately 0.3V bias. The bias is approximate because the power supply has a typical regulation of +/- 0.5%. The 8mV range is determined by the ADC's internal reference voltage, and the initial range for the reference is 2.048V +/- 0.003V, with perhaps a 5 ppm/C drift with temperature. The code adjusts the brightness of the LEDs to keep the ADC output within a narrow range. If the ADC is out of range the DAC feeding the LED changes its value by one. The control SW tries to keep the signal between 92 and 97 percent of full scale, or within the range of 60294 - 63569. If the signal goes beyond either of these values the next sample will jump as a result of the change in the DAC value. Generally, we see long term drift in the signal, over the scale of at least several minutes after start up. We don't have data yet that shows how drift evolves over several hours. The single sensor is illuminated in turn by two different LEDs, so the signal is a series of pulses. We are looking at very small changes in the pulse height and need the top of each pulse to stabilize before we can run the ADC. A DC filter would (presumably) destroy the signal (I don't understand why it would destroy the signal). ADC used: ADS8866
Reply by ●April 5, 20152015-04-05
> I assume you mean a DC-blocking filter, AKA a high-pass filter.Yes> The problem with a DC-blocking filter is that, along with the method you > have outlined, you won't know what the values of the readings are. > Of course, with the drift you won't know that either.Is that because it takes a while before the DC filter reaches steady state and the signal to be measured is measured over a very short time interval? So the output of the DC blocking filter won't even have reached steady-state at the time where the ADC reads the output from the DC-blocking filter?> 2: Put an "auto zero" circuit in the hardware that zeros out the analog > output when the ADC isn't converting (or when the SW says so), then holds > that offset when the ADC _is_ converting. Then your ADC readings will be > from zero instead of from whatever the drifting value happens to be. It > should be possible to implement this with a single op-amp, an electronic > switch, and a few passives.Is there a generic design for an "auto zero" circuit? Or would the selection of such a circuit require more information about the "target system" where it's going to operate? I found this white paper: http://goo.gl/Fd4DtH Is that the kind of circuit you're talking about?> The important thing to do to make this work is to make sure > that the DC blocking filter is slow enough that the amount that it > changes in response to the LEDs shining on things over the duration of a > reading is small enough not to affect the system accuracy.Can you elaborate on this? What exactly do you mean by "slow enough"? My background is in signal processing (SW). I know that with digital filters, there are things like settling time to deal with. I assume the same phenomena exists in the analog HW domain? Is that what you're talking about?
Reply by ●April 5, 20152015-04-05
> So, you can take the ratio between them and factor out things > that aren't important.The ratio between what?> > I have very limited knowledge about hardware and electronics, > > but it seems strange to me that the hardware doesn't have > > a DC (or bandpass) filter between the photo-transistor and > > the ADC. > It might be good to do that.As in: it might be a good idea to use a DC blocking filter? Or as in: It might be good to NOT use a DC blocking filter?> If you can measure the "before" and "after" turning on each > LED, and subtract, that doesn't seem bad.So that's a solution where a HW DC blocking filter is not used and you're proposing a method for how DC can be "removed"? I can see that this would work because with the "after" value you would have the "DC value" to subtract, right?> Where does the drift come from? It sounds like an integrator > (DC offset charging a capacitor).Not sure yet. I provided some more details in this thread, but I'm not sure if those details will tell you much. I do know that the drift isn't short term. The drift continues for minutes. I don't have long captures (hours), but if the drift was "ordinary" I assume it wouldn't take minutes to level off?> Then, all you need to do is be sure that the system is close > enough to linear, that the result comes out the same on either > end, then you are done.And this is a continuation of your proposed solution, right? You're saying that it's safe to assume that the relationship between LED intensity and the signal produced by the photo-transistor is close-to-linear. If we - just for the sake of discussion - imagined that the photo transistor produces a sine signal when the photo transistor is excited by the light from the LED, then you're saying that the relationship between LED intensity and the amplitude of the sine signal is close-to-linear? If that's what you mean, I could map out the relationship between LED intensity and signal amplitude (max value) and then use that information to "normalize" the measured signal (in the digital domain); i.e. scale samples back to what they _would_ look like at full intensity? So to summarize: 1. Get sample, y1, from ADC with LED ON 2. Get sample, y2, from ADC with LED OFF 3. Use look-up table to find scaling factor C(I) where I is the current LED intensity 4. Scale to get result: C(I) * (y2 - y1)






