ADS1115 input pin good practice

I measure voltages from a methane sensor using 2 of the 4 available single ended input of a ADS1115 board. I average 5 consecutives single shot reading after which I turn the methane sensor off. I start the sensor again when needed and read voltage again.

Most of the time this work but I can also end up with small offset in the reading or worst, very off value (ex: 700 mV instead of 1800 mV). Can I conditionned the ADS input pin to minimize this? Adding a pulldown resistor on each pin maybe?

I know that with ADS it may be good to "ditch" the first few readings. I can do this through my code but would like to improve this even more with physical component (capacitors or resistors) if any could help?

Also should I ground the unused input pin or leave them floating does'nt matter?

thank you

At this point we don't know what that signal looks like and most likely you don't have a scope to take a screenshot so good practice is sample 10 times then take the average to eliminate spurious signals.

I know that with ADS it may be good to "ditch" the first few readings

This is not true. There is nothing about the first few readings that requires deleting them. The issue is
anomolies that are not consistent with other readings, hence the averaging. If you want to be
ever more diligent you can sample 50 to 100 times before averaging.

Gas sensors usually have a heater that has to stabilize for a minimum time before reading. Which sensor? Post datasheet link or brand name / part number.
https://www.ti.com/lit/ds/symlink/ads1115.pdf

If this is true the OP should delay n seconds before sampling.

@JCA34F
There is a heater. I allow 90sec to heat (as per the sensor datasheet recommandation).

@raschemmel
Ok, I will increase the average sample size.

What do you think of this hypothesis: Once the sensor is turn off, some floating voltage remains stuck in front of the high impedance of the ADS input pin. This create an offset when turning the sensor on again? Adding a pulldown resistor could provide a more constant starting point?

The data sheet is here: SGX Methane Sensor board

nonsense
An analog input pin is NOT like a cupboard.
It doesn't store old bread.
It's a 10Mohm input impedance.
It only samples when you tell it to.
You could see this if you had a scope.
I suggest you do an experiment where
loop through a routine that takes one sample
and stores it in a variable called "one", then add
10 to the sample number "n" and store the average of that in a variable called "ten", then replace the sample number "n" with "100" and store it in a
variable called "100", then replace "n" with 1000 and store it in a variable called "1000" (or "samps1000").
Then print all the sample averages (1,10,100,1000).

perhaps you could post the relevant section of your code - and a schematic?
Your readings should be taken at intervals; and perhaps a capacitor across the ADS input might help?
I dont see a value for the output resistance

It is recommended that the detector and
compensator be run in a simple Wheatstone bridge
circuit at a constant voltage.

@raschemmel
Thanks, this is clear!

@johnerrington
I know it is better with a code and schematic. It is a big code and a even bigger schematic. This is why I tried to avoid this part and ask for "good practice". I will try to extract and post the relevant sections.

The interval is 0.5 sec. Capacitor across input? can you explained a bit more? To maintain the voltage once it is charged?

Wheastone brige.
I initially did the wheatstone bridge circuit and use differential reading. For a lots of reasons I end up choosing single ended reading. In my setup I can measure the sensor signal before it get exposed to methane. I read say: 1800 mV and this become my Zero ref. Then I exposed the sensor to methane and obtained let say 1850 mV. I do the difference in the program and obtained 50 mV for that specific gas concentration. It is suboptimal but well enough for the precision I need.

There is none. Should I add some?

What John is asking is what is the resistance across the wheatstone bridge terminals you are measuring with the power OFF ? (ie: "Output Resistance") since
it is just four resistors in a bridge configuration.

I measured an unstable 2Mohm for the resistance D and 25 ohm for the resistance of C. From page 2 in this application sheet : Sensor app

The sensor is package with half a bridge. The user (me) should add the other half (on the right side of the dash line). I initially put a 2k trimpot there. It allowed me to zero the wheatstone bridge output in air at about half vcc (1700 to 1800 mV). But like I mention in my previous post, I choose to read the output on half the bridge only but read it in sequence with and without methane. I test it in numerous conditions (gas concentrations) and it returned similar mV value with both methods. Because I can, I still measured the trimpot output to have a cue on how the 3v LDO behave but I don't use it for calculation.

I always run the sensor in High TC mode state.

Never heard of a "half" Wheatstone Bridge

At least this is how they named and described it in the application sheet.

Can you post the schematic as a screenshot ?

Here it is. I added in red some details.

So let me see if I understand this correctly:
A voltage divider where R1 = R2 is a 'half bridge" ?

Are you subtracting Ain-11 from Ain-10 ? (or vice versa)

Based on the app notes, this is how they describe it. Of course you understand this correctly! It is "just" a voltage divider and one leg of the wheatstone bridge.
The other part of the bridge, the way I understand it, go from the +3v to C than to D and to ground. The signal is taken at the junction between C and D.

Yes and by adjusting the R1=R2 ratio, you can zero the mV output "balancing the bridge output in zero methane gas". I use a trimpot there.
BUT, I finally end up just measuring the C/D junction voltage with and without methane to achieve just the same thing.
In fact the R1=R2 divider is constant. I just monitor it and it give me an indication about the "health" of my +3v LDO.

edit: basically, this whole thing work and I can obtained good mV reading. It's just that from time to time, the signal out is wrong. I am looking for a way to "stabilize" the output voltage (capacitor resistor ?? I don't know?).

Haven't heard the result of increasing the number of samples.
What's the SITREP on that ?

My issue is hard to reproduce since it's intermittent. See this graph showing the voltage bounce I got while monitoring methane for 2 months at every hour.


In green, this is the raw signal output as I expect it to be.
Sometime, the I2C communication was lost and I got 4095 for long period. It suddenly return after some time without any manipulation of the system. No reboot etc.
In yellow the value move in a weird way. At around data point 700, the signal was higher but constant (over a week at least).

Increasing the averaging to 10 will help and I understand your point about trying up to 100 or 1000 to gain robustness. I will implement it in my code. More averaging will remove anomalies and eliminate the first few weird reading influence if any. This could even explained the 1700 mV or so around data point 700 since averaging 5 data point: 1450 + 1450 + 1450 +1450 + 4095 = 1979 mV.

But there is a transition between the voltage level and it can represent up to 2-3 days. It is far from a single shot reading issue.

I don't know what SITREP means?

Mil-SPEAK for SITUATION REPORT

The values you are seeing between 200 - 400 are not "errors". They are completely spurious and filtering either electrically or with a digital filter (ie averaging) will not help.

The higher values between 600 - 800 and the "sensible" values between 200 - 400 would seem to indicate real changes in the environment.

if as you say its a big code and bigger schematic there are innumerable reasons why you could be seeing spurious readings.

For example if you dont have correctly managed earthing / 0V line you could be introducing errors from other parts of the circuit.

You will need to test with a minimum system - both code and schematic - to see whether the spurious readings are coming from the sensor.