Reading small sensors

Go To Last Post
25 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have finished part one of my pulse oximeter reading the pulse

step two is implementing the infrared readings for SPO2 calculations

I am using OpenTk and a serial data link to my computer for display.

 

I get inconsistent results see two outputs below.

Heartbeat 4 is atypical, not sure what causes that to happen.

This is all on a breadboard too so pretty noisy.

On the sensor receiving the light I use a pulldown to discharge 

Reading 40,000 data points in 5 1/2 seconds

The blue lines are the sensor data

the white line is the exponential moving average 

pretty cool how that calculation pulls out the pattern from all that noise.

 

Attachment(s): 

This topic has a solution.
Last Edited: Wed. Oct 30, 2019 - 03:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cheeky Maybe DocJC could diagnose the patient's malady.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow.

Interesting data set.

 

First question would be why are you sampling a biomedical signal, with a base frequency of 1 Hz, (HR: 60, for sake of argument), at > 7 K Samples/Sec?

 

Need to see a link to your sensor.

Need to see a schematic of your analog front end, if your sensor is putting out analog ( s ) signals.

 

Need to see a data set when ALL ambient light is restricted from reaching the sensor.

 

Need to see a family of curves, (data sets), with the LEDs biased at different intensity levels.

 

Have you AC coupled your signal to the ADC?

If so, what is the bandwidth of your analog front end?

(Don't know if you are reading an I2C, SPI, or analog signals...).

 

A optical pulse plethysmograph does NOT have a negative portion to its signal.

So it isn't clear why your readings appear to be bi-polar in nature, (or so very noisy).

 

JC 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Ross,

Always good to hear from you!

 

Unfortunately I'm not practicing clinical medicine today, or I could hazard a guess as to Metron's underlying condition!

Today I'm off to the Nuc power plant for a few hours.

 

You can spot me easily when I leave, I'll likely be glowing in the dark and in need of Metron's project!

 

JC  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And you also Jay.

 

Do you do routine monitoring of the plant's staff?

 

When I was working in Saudi, we had 3 automatic weather stations located in the Rub Al Khali desert that were powered by strontium 90 generators. I tried, unsuccessfully, to get the UK government to help provide and process dosimeter badges for our repair staff. Sadly, he died before that service could be implemented.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Question 1 -  why 7000 per second? I read how a pulse oximeter works , the sample rate was specified at 1000 per second where three readings were taken

Red led, Uv led and ambient light

Ambient light is zero as I have the sensor enclosed in a finger wrap and ADC reads zero when samples are taken

SO I am reading the red led twice and average the two readings, when I use the UV i would only take one reading of each.

Since I don't know how fast the blood changes per second I thought go as fast as possible for now.

 

LED and Sensor 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is a nuc power plant in the county where I work.

Every year we have training on the emergency response plan should anything ever go wrong.

Today was the training for the emergency operations center staff, about 60 - 70 people, in a big, underground, secure bunker.

I play an incredibly minor role, but it is still fun to be a part of the team.

My role has mostly to do with being a liaison to the hospitals, and communicating with all of the nursing homes in the area.

Others make the shelter in place or evacuate the region, (7 different regions within a 10 mile radius of the plant).

I help determine how the nursing homes will evacuate their patients should that ever be required.

 

Now, back on topic.

7 K S/Sec would seem to be about double what is needed, and that therefore increases the noise within your signal.

 

A PP waveform is only positive, and typically has a sharp rise and a gentler fall off slope.

At times you might see a diacroitic notch, (a glitch), in the falling side of the waveform.

The finger clip pulse ox image below, (me, 5 minutes ago!), shows a typical PP waveform along the bottom of the display.

 

For SaO2 readings you want to measure a pulsatile waveform, typically on the falling side of the pulse.

 

With 10 - 20 data points / pulse you have plenty of samples to see the shape of the curve, detect the maximums and minimums, and then select which data pairs you wish to analyze for the SaO2 data.

You would typically read the data into an array, then process the array's data.

Too much data means you need a larger processor to hold the data array, and a faster processor to process "all" of the data in real time.

Less data, but sufficient for waveform analysis and then SaO2 analysis, means you can fit the data in an array, and have time to process it.

 

I think you should hook up a 10K pot, Vcc to Ground, wiper to ADC, and a 0.1 uF cap from the wiper to Ground, and look at your data from reading a known, steady, value.

 

Your present data seems to have an very large amount of noise, and your signal shouldn't be that noisy.

 

Garbage in --> Garbage out.

You need a better input signal before you even begin to try processing the data.

 

Also, recheck your graph / plotting routine.

Is the time line running from Right to Left, or from Left to Right.

The steeper slope is the leading edge of the PP waveform.

 

JC

 

 

Edit: Typo

Last Edited: Wed. Oct 16, 2019 - 07:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The document I read said to take the unchanging value and subtract it from the changing values to isolate the data of interest. It also showed typically the changing values are only 2 percent of the value. So if the lows are adc value of say 750 I should expect with no noise the next 2 percent or just 15 data points. I am in the 160 range of high to low readings so there must be a lot of noise as you say.

I will experiment with levels of light tonight to see what the delta is highs to lows, I’m thinking with too much light from the led the sensor is picking up light traveling around the edges of the finger and lowering the level might focus more through the vein.

I will also do the pot measurement to see how stable the adc is reading.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

variance of Ok went back to drawing board.

 

ADC input checks out , 1k resistor to 10k pot to ground with .1uf at the voltage divider  voltages are stable with an ADC reading of maximum  variance of 2 from low to high range.

Voltage is 5.11 on the board and adc is 152 +- 1 at a mean 800ma and 931 +-1 at 4.64V

 

Its the OP AMP, when I connect the output on the op amp to the ADC and the voltage divider to the op amp input

I see sometimes that same pattern I thought was a pulse, of course it's not.

Very wild noise at some times and other times a constant (pic noisefloor.gif)

 

So I have to fix the op amp.

 

A direct connection to the sensor in total darkness shows noise of 90 to 95 and my scope shows of course 60 Hz peak to peak 300mv

 

So I have to fix the sensor input to the op amp.

 

So hardware is again my troubles. 

 

Also attached how pulse ox works. And 60hz scope output on the sensor in darkness.

 

Can you help me stabilize the sensor first to remove the 60Hz signal?

Should I try the attached Pulse Sensor Gain Stage circuit attached?

 

 

 

 

 

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
Every year we have training on the emergency response plan should anything ever go wrong.
Has the Sky UK series "Chernobyl" been broadcast in the US? It should be mandatory viewing for "first responders" who might have to deal with a nuclear power incident in "how not to handle things" :-0

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Cliff,

 

Yes, the Chernobyl mini-series was shown Stateside. 

Unfortunately I didn't have the opportunity to watch it, but I hear it was well done and worth seeing.

 

Metron,

Perhaps you would consider starting with a Max30101 chip.

This provides the optical lenses, LEDs, LED drivers, ambient light subtraction, etc., for you.

You then can ignore the analog part of the project, at least for now, and read the data through an I2C interface.

 

You will learn a tremendous amount about pulse oximetery  and processing bio-data via this approach.

 

When you have a working pulse ox using the Max chip, then think about replacing the Max chip with your own analog front end hardware, (and signal filtering, etc.).

Then, when you have a good, clean signal, you will already know how to process the data for pulse detection, HR calculation, and finally for an SaO2 reading.

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Max30101 Very nice reading material, lots of information on the subject. I do notice they use an 18 bit ADC as well.

 

I am reminding myself of my little brother when he was 7 years old working on putting nails in the bottom of a cardboard box.

What are you doing I said, He replied building a space ship to go to the moon.

 

I am moving on to the second project I should be working on. Its a stepper motor that controls the speed and tension of the waste material that gets pulled

apart from an adhesive backed laminate. I have an automatic laminating machine that uses a simple friction clutch, it is critical the tension and wind up

pulls the waste material out of the way, the friction clutch is a constant problem as it needs to manually be adjusted during the running of the machine.

 

A simple sensor on an arm (a pot for example) can give the position of the material to increase or decrease the speed of the wind up.

 

I have a small box to put the pulse ox project in, if I revive my cnc router to make tiny circuit boards instead of using a breadboard I may poke around with it again.

 

I sure like the mega664 and JTAG for debugging and being able to throw data to my main computer will help with everything else I do.

 

I may build a breathing band to put around my chest at night that uses a sliding POT to measure chest expansion/contraction as an easier approach to monitor my Sleep Apnea condition.

Since I am targeting a much lower body weight I want to see if not using a CPAP there are any Apnea events.

 

I would buy an SPO2 monitor that records overnight but I can't seem to find one as I think medical devices like that are just not available to the general public.

Thanks for your help, I very much appreciate it but I know I got in over my head with the complexity of this project with the tools I have to work with i.e. breadboard.

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is a Camtasia 1 frame per second little gif, I was able to send data from the OpenTk game engine to a windows Form

The data is coming from the microcontroller ADC controlled using a voltage divider. Both raw data and the double exponential value are plotted.

Its fast and smooth.

 

Attachment(s): 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ETA 12 15-Nov'19 at Mouser :

SEN-15219 Pulse Oximeter & Heart Rate Sensor - SparkFun | Mouser

...

The MAX30101 senses the light absorbed with its photodetectors through a process called photoplethysmography. This data is passed onto and analyzed by the MAX32664 biometric sensor hub which applies its algorithms to determine heart rate and blood oxygen saturation. 

...

edit : strikethru

edit2 : SparkFun Pulse Oximeter and Heart Rate Sensor - MAX30101 & MAX32664 (Qwiic) - SEN-15219 - SparkFun Electronics

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Oct 30, 2019 - 06:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:

ETA 12-Nov'19 at Mouser :

SEN-15219 Pulse Oximeter & Heart Rate Sensor - SparkFun | Mouser

...

The MAX30101 senses the light absorbed with its photodetectors through a process called photoplethysmography. This data is passed onto and analyzed by the MAX32664 biometric sensor hub which applies its algorithms to determine heart rate and blood oxygen saturation. 

...

 

Ordered this today, it's back ordered may be a few weeks. Thank's for the link.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You're welcome.

Digi-Key has low stock :

https://octopart.com/search?q=SEN-15219

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

I am REALLY curious about the subject line on this thread, and what the size of the sensor has to do with anything?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok ordered one from digigey as well. So far i have not found any datasheet that shows in detail what information is sent over the I2c or specifics on how to request data like a typical eprom datasheet.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MAX30101 datasheet has register descriptions.

SparkFun has Arduino source code.

SparkFun Pulse Oximeter and Heart Rate Sensor - MAX30101 & MAX32664 (Qwiic) - SEN-15219 - SparkFun Electronics

[Documents tab]

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ahh that code will do, thanks for the link.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

I am REALLY curious about the subject line on this thread, and what the size of the sensor has to do with anything?

 

Jim

 

Jim, I can't solder those tiny parts myself heck I have a hard time soldering PDIPs,  I have a bunch of older parts I should give away of various things because they are just too small for me to work with. The sparkfun board is the way to go for me anyway. I can't wait to attach it to my wife's finger to see if she is just snoring or having apnia's 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But you specifically titled your thread, "Reading small sensors" - so how does the fact that they are small have anything to do with reading them?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Oct 30, 2019 - 08:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good question, Small in this case means small signal or low signal sensors that are hard to read due to noise. Should have wrote it differently.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

metron9 wrote:
I can't wait to attach it to my wife's finger to see if she is just snoring or having apnia's 

 

If your wife has apnoeas (note the european spelling - why did the US change the oe and ae to e?) you'll notice by her breathing. If she stops breathing, then you know. No need to measure blood oxygen.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I may build a breathing band to put around my chest at night that uses a sliding POT to measure chest expansion/contraction as an easier approach to monitor my Sleep Apnea condition.

Could you instead use a little microphone near your mouth & "listen" to the breathing---the length of the inhale/exhales, sort of like a duty cycle monitor or frequency counter. 

 

Dreaming of AVR's will cure Sleep Apnea

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. Nov 5, 2019 - 05:49 AM