Author Topic: Accurately measuring using ADC in the millivolt range  (Read 1418 times)

0 Members and 1 Guest are viewing this topic.

Offline pman92Topic starter

  • Contributor
  • Posts: 29
  • Country: au
Accurately measuring using ADC in the millivolt range
« on: August 31, 2022, 11:04:04 am »
Hey guys,

I'm working on a project trying to measure oxygen using a microprocessor and a commercially available and relatively cheap electro-chemical oxygen sensor.
These sensors are normally used in diving and work chemically to produce a current output (in the uA range) that is proportional to oxygen availability and temperature. They include an internal resistor network that is temperature compensating (using a NTC thermistor) to produce an output voltage (in the millivolt range) that is more or less linearly proportional to oxygen. See http://www.advanceddivermagazine.com/articles/sensors/sensors.html

In air (~21% oxygen) they typically output around 10mV. I would like to use them to measure from 0-100% as accurately as I can. That means my measurement range is around 0-50mV.

The microcontroller already has an internal 10 bit ADC. Using a 1.2v reference that is still worse than 1mV per division. I would like to get atleast 1% accuracy (what the sensor itself is rated at), which will require at least 0.5mV resolution.

I considered using an external ADC with higher resolution. And have also considered amplifying the voltage somehow so I can use the existing 10 bit ADC.

I would like to know what the pros/cons of each option are?
If you had this problem what would you do?
And if you were going to amplify the voltage, how would you go about it accurately?

Thanks in advance
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14749
  • Country: de
Re: Accurately measuring using ADC in the millivolt range
« Reply #1 on: August 31, 2022, 11:24:02 am »
An external ADC like MCP3421 would be one option. This also includes the reference and may not need any calibration if the sensor is accurate from the start.

The other good alternative is a simple amplifier (1 OP + 2 resistors). Resistors or ready made dividers (e.g. div23) in the 0.1 % range are available. A relatively accurate reference would also be needed. Alternatively one could also go with a simple calibration. The oxigen content in outside air should be resonable fixed and could be used as a reference point to calibrate the combination of sensor, amplifier and voltage referene. Alternative an external ref. voltage or DMM could be used to measure the scale factor.

For the µC internal ADC oversampling over windows of 1 or more power line cycles may help to reduce the noise and mains hum effect.
 

Offline gamalot

  • Super Contributor
  • ***
  • Posts: 1380
  • Country: au
  • Correct my English
    • Youtube
Re: Accurately measuring using ADC in the millivolt range
« Reply #2 on: August 31, 2022, 11:25:47 am »
The external ADC is overkill for the 1% accuracy requirement. I would use an op amp (with the correct gain setting) to match the sensor's output to the input range of the MCU's built-in ADC

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10220
  • Country: nz
Re: Accurately measuring using ADC in the millivolt range
« Reply #3 on: August 31, 2022, 11:52:56 am »
Check your MCU datasheet and see if the ADC has any internal gain settings you can use.
AVRs often have a 20x gain option. some even have 200x.
Nordic mcus have 2x 4x
etc
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 496
  • Country: us
Re: Accurately measuring using ADC in the millivolt range
« Reply #4 on: August 31, 2022, 01:49:16 pm »
First of all, the sensor is a tiny current source and the voltage is measured as the drop across a (large) precision resistor. That means you really don't want to connect it directly to an ADC as the ADC will affect the load seen by the sensor and consequently result in inaccurate voltage readings. You need to buffer the output of the sensor. If the output of the sensor already made good use of the range of the ADC, a unity gain buffer would be used. But in this case you probably want to add gain anyway. So, as far as I'm concerned, the question of whether or not to add gain is answered.

Secondly, the ADC in a typical MCU is going to be noisy. You have a very slow moving signal so you can average as much as you need or want. In noisy laboratory setting I have averaged 2048 samples over 100 ms (6/60 second or exactly six power line cycles) and have been able to get 12 ENOB out of a noisy 10 bit ADC. You could probably average over several seconds.

Third, if you really want 1% accuracy, then I would make some effort to calibrate the final system. The ADC gives you an integer over some fixed range that you need to multiply by some constant to convert to %PPO2. If you have other sensors (with electronics and readouts) that you trust, then you might be able to use them determine that constant experimentally. That would mean your sensor is as well calibrated as your existing ones. Or calculate the constant based on information from the sensor datasheet, which is what you were probably going to do anyway.
90% of quoted statistics are fictional
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 17117
  • Country: us
  • DavidH
Re: Accurately measuring using ADC in the millivolt range
« Reply #5 on: August 31, 2022, 03:18:18 pm »
Three options come to mind:

1. Amplify the signal with a precision operational amplifier for use with the microcontroller's built in ADC.  This would be a good place for a chopper stabilized operational amplifier.

2. Implement an external ADC which can directly digitize low level signals.  Check out Linear Technology application note 7, Some Techniques for Direct Digitization of Transducer Outputs, for details.

3. Use an external delta-sigma instrumentation ADC; these have microvolt resolution.  Something like an LTC2485 is suitable.

 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3995
  • Country: ua
Re: Accurately measuring using ADC in the millivolt range
« Reply #6 on: August 31, 2022, 10:21:34 pm »
By using 20-24 bit ADC you can get the best result. You can also use 10 bit ADC with op-amp, but such solution can suffers from linearity issues, because 10 bit ADC linearity is not the best and it involves distortions of both ADC and op-amp.
 

Offline pman92Topic starter

  • Contributor
  • Posts: 29
  • Country: au
Re: Accurately measuring using ADC in the millivolt range
« Reply #7 on: September 03, 2022, 06:47:57 am »
Thanks guys.
I think I will go for a precision opamp solution.
Next question, it's my understanding that I can't run the opamp near the voltage rails, unless it's a "rail to rail" opamp, and even then it would not be ideal.

1. What's the easiest and best way to move the ~0-50mV input range I expect to have away from the negative rail so that it works with the opamp, while allowing me to use the most of the 0-5v output range possible (to get the most out of the 10 bit ADC). Should I generate a negative supply for the opamp or is there a better or more precise way?

2. How can I protect the ADC of the microcontroller from overvoltage, in the event that someone inadvertently connects the wrong sensor or something and puts say 200mV or more (instead of the intended ~0-50mV signal) into the opamps input (generating an output voltage over 5v).

I plan to have this project be portable and run off a 9v battery. A solution involving a low impedance voltage dividers etc. wouldn't be great as it would reduce battery life.

Thanks
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14749
  • Country: de
Re: Accurately measuring using ADC in the millivolt range
« Reply #8 on: September 03, 2022, 09:12:52 am »
One can often lift the ground of the sensor a little. The amplifier would not need much to operate - some 10 mV may be enough. A 2nd ADC input could be used to measure the shift.
It depends on the use if one really has to go to zero.

If the amplifier is powered from the same supply as the µC (e.g. 3.3 V) there is no need to add extra protection. Even if the reference at the ADC is low like 1 V the ADCs are usually OK with a signal up to the supply level (and often also some 300 mV more).
The protection would than be at the OPs input, e.g. with a series resistor and maybe added clamping diodes if not already internal to the OP.

Modern zero drift OPs are usually rail to rail anyway and OK to run from 3.3 or 5 V.  They are also OK to work very close to zero, essentially all the way down to the 10 µV range or the like.
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3995
  • Country: ua
Re: Accurately measuring using ADC in the millivolt range
« Reply #9 on: September 03, 2022, 01:28:59 pm »
2. How can I protect the ADC of the microcontroller from overvoltage, in the event that someone inadvertently connects the wrong sensor or something and puts say 200mV or more (instead of the intended ~0-50mV signal) into the opamps input (generating an output voltage over 5v).

you can put two diodes connected in anti-parallel to that pin. If overvoltage happens, diode opens and the current will flow through diode. It allows to limit Voltage to about 0.4-0.9 V (depends on selected diode).

Such protection (with two diodes connected in anti-parallel) is often used in RF electronics to protect sensitive input from overvoltage or static electricity.

Usually such protecting diodes are present inside chip for ADC input, but if internal diode will be burned out, it will needs to replace ADC chip. So, it's more reliable to add external diodes, because it will be more cheap and easy to replace diode instead of entire ADC chip for repair :)

Also you can put some resistor and fuse it may help if current is too high, the fuse will be burned out before diodes. Also gas discharge arrester can be used to protect from high Voltage spikes which may happens during lightning when input is connected to a long outdoor wire.
« Last Edit: September 03, 2022, 01:40:29 pm by radiolistener »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf