Go Down

### Topic: Help understanding ADC datasheet (Read 308 times)previous topic - next topic

#### cdb101

##### Aug 21, 2020, 11:51 pmLast Edit: Aug 22, 2020, 01:02 am by cdb101
Hi,

I have a Wheatsone bridge sensor that output a signal of 1,6 volt on the ref arm while the voltage increase when pressure rise on the sensor on the "sensing" arm.  Based on the info I have and measurement I made, the max increase will be 90 mV so the "sensing" arm will reach about 1.7 volt.

I tried with HX711 to convert this data into something for my arduino and realized (too late) that the HX711 can only measure differences of ±20 mV or so. Apparently it don't work for my sensor and saturate pretty fast..... arghh!

There is the ADS1115 available and probably other analogue to digital converter outhere but I get lost in the datasheet info and would like your input to make sure I understand well before I invest in another ADC.

I understand that 1.6 volt (value on both A+ and A- arm of my wheatstone) correspond to the common mode rejection.  As long as it is in the range of the ADC, it will be eliminated from the measurement.

Now there is the gain (PGA). The ADS1115 have different possibilities and depending on gain, the inpout voltage range change from ±256mV to ±6.144 mV.
From what I understand, PGA will be applied on difference between the "sensing arm" and the "ref arm". If there is 5 mV difference, a gain of 8 will make this 40 mV. Is this correct? Now how to relate this to ±256 mV ..... Does the 256 mV correspond to my 5 mV or to the 40 mV (after applying PGA)? Also there is the ± sign. I don't go to -256 mV or -5mV. Will this mean I have headroom of 512 mV? Will the ADC top at 256 mV?

In the same way, ±256 mV correspond to a diferrence between the sensing arm and the ref arm of 512 mV? Then the 16 bit of the ADC will be distributed over 512 mV? Or if I never go in negative number, I will lost all 8 bit related to negative side (-256mV up to 0 mV)?

Datasheet for discussion:

thank you

#### Wawa

#1
##### Aug 22, 2020, 01:31 am
The HX711 is the right choice, the ADS115 with it's absolute A/D is not.
Unless you also measure excitation voltage of the bridge, and compensate measurement results with that.

The output of a Wheatstone bridge depends on it's excitation voltage.
For stability, the bridge must be powered from the E+ pin (~4.3volt) of the HX711.
If the differential output of the bridge is too high, then you can reduce it with a suitable resistor between the two outputs of the bridge.

I guess you're using a 3.3volt logic processor, from "1.6volt on the ref arm".
You MUST power the HX711 from 5volt, for the internal excitation regulator of the HX711 to work.
If you use a 3.3volt processor you must use two supplies to the HX711.
5volt for the analogue part, and 3.3volt for the digital part.
Only Sparkfun.com stocks boards like that, or you have to mod a common board yourself.
Leo..

#### cdb101

#2
##### Aug 22, 2020, 02:15 am
If the differential output of the bridge is too high, then you can reduce it with a suitable resistor between the two outputs of the bridge.

By differential output you mean the 1.6 volt on each wheatstonebridge arm  or the 0 to 90 mV I will get from substracting the 1.6 of each arm?

If the later, 0-90 mV then you suggest to decrease it with the resistor? Ok, I will try but what about sensitivity? 0-90 mV going down to 0-20 mV will decrease my resolution rigth?

It is a 0-40m water depth sensor. Now 0-90 mV to  0-40 m already give me a bad resolution. 0-20 mV will be worst no?

guess you're using a 3.3volt logic processor, from "1.6volt on the ref arm".
Well it is 2 different analog device. The pressure sensor can be powered from 3 to 12 volts and will output a voltage on the bridge accordingly (like you say, about 1/2 Vcc).

The second sensor is a Methane sensor (different animal!). This one only have half a wheatsone bridge (the sensing arm). I need to set the reference arm with a voltage divider + a 2k trim pot and balance the bridge for a 0 mV differential output in clean air. I powered this sensor from the 3.3 volt pin on the arduino. The differential output will rise from 0 mV to 90 mV when in 0% to 100% methane.

My ultimate goal was to power those 2 sensors at 3.3 volts. Wired both of them to a single ADS1115 or HX711 (they have 2 differential input). My goal is also to power the ADS1115 or HX711 at 3.3 volt to excite my sensors with this voltage.  Fortunately they both output a signal between 0 and 90 mV (that I will convert to % methane or water column depth following in lab calibration).

Thing is, the HX711 have very fix gain 32 on channel B and 128 or 64 on channel A.

#### Wawa

#3
##### Aug 22, 2020, 04:15 am
By differential output you mean the 1.6 volt on each wheatstonebridge arm  or the 0 to 90 mV I will get from substracting the 1.6 of each arm?
"difference" in "differential" must be a clue.
The output of a Wheatstone bridge is the difference between two voltage dividers.

Output of a pressure bridge depends on two things. Pressure AND excitation voltage.
A sensor rated for 0-90mV@10volt excitation will output 0-30mV@3.3volt excitation.
Therefore you should use a ratiometric A/D with these types of sensor, otherwise you also have to keep track of exact supply voltage, to compensate. Same for the methane sensor.

The PGA (programmable gain amplifier) of the HX711 can be set to 64x or ±40mV (80mV range).

0-40 m already give me a bad resolution. 0-20 mV will be worst no?
No.
1000 small steps or 1000 large steps is still 1000 steps.
What resolution are you expecting. 1cm, 1" ?
Leo..

#### cdb101

#4
##### Aug 22, 2020, 04:42 amLast Edit: Aug 22, 2020, 04:50 am by cdb101
Output of a pressure bridge depends on two things. Pressure AND excitation voltage.
A sensor rated for 0-90mV@10volt excitation will output 0-30mV@3.3volt excitation.
Therefore you should use a ratiometric A/D with these types of sensor, otherwise you also have to keep track of exact supply voltage, to compensate. Same for the methane sensor.

The PGA (programmable gain amplifier) of the HX711 can be set to 64x or ±40mV (80mV range).
No.
1000 small steps or 1000 large steps is still 1000 steps.
What resolution are you expecting. 1cm, 1" ?
Leo..

From what I have measured yet, the pressure sensor is always outputting 0-90 mV what ever Vin is. I know this with direct measure of A+ - A- with a DMM. Maybe there is some electronic inside? I don't know and the chinese distributor is cheap on info....

Back on the PGA. You say that the HX711 will have a range of 80 mV when set a gain of 64. 64 X 80 mV is 5.12 Volt.  The ADC will then transfer 0 -80 mV to 0 - 5.12 Volt .... in bytes 0 - 16 bit. Correct? At a gain of 32 It should work but not with 128.

1 cm resolution would be very nice but it is a 0 - 40m range sensor. Normaly resolution decrease when range increase.  1 cm is probably very optimistic.

Can you develop why the ADS1115 is not suitable? It can work at 3.3 volts which is a good thing for powering my 2 sensors.

#### Wawa

#5
##### Aug 22, 2020, 06:00 am
From what I have measured yet, the pressure sensor is always outputting 0-90 mV what ever Vin is.
Then it's more than just a Wheatstone bridge, and shouldn't be measured with a HX711.
If that's the case, it has a 'voltage' output, and should be measured with an absolute A/D (like the ADS1115).
Post a link, or an image.

The ADC will then transfer 0 -80 mV to 0 - 5.12 Volt .... in bytes 0 - 16 bit. Correct?
No.
It converts a differential input voltage into a 24-bit digital value (not a voltage).
Leo..

#### johnerrington

#6
##### Aug 22, 2020, 09:14 am
You are seeing a 90mV change, so your fisrt task is to do some signal conditioning to match that to the input range of the ADC. So you need to remove any DC offset, and provide some gain. You can do both with the simple differential amplifier of the HX711 (You MAY need an instrumentation amplifier depending on the characteristics of your sensor.)

So lets say you now have a ground referenced signal in the range 0-4500mV.

If your 0-90mV represents 0-40m then for a 1cm resolution you need 1 part in 4000 or a 12 bit conversion.

The level will not be changing very rapidly, so conversion speed isnt an issue.

The HX711 can do all this, and the SD conversion is relatively slow, but robust (resistant to noise and less subject to non-linearity)

Provided the excitation voltage to the bridge is stable the HX711 should do the job.

Does your sensor offer the level of precision you are seeking?
I'm trying to help. If I find your question interesting I'll give you karma. If you find my input useful please give me karma (I need it)

#### cdb101

#7
##### Aug 22, 2020, 04:40 pmLast Edit: Aug 22, 2020, 08:06 pm by cdb101
First of all thank to both of you.
Leo already suggest me to ditch the sensor and buy a digital one and he still help my stuburn idea of harnesting this analog sensor. He is probably rigth but I also choose this sensor because it is common in oceanographic research and when properly configure, they are very responsive and I have not seen one broken for a decade of utilisation. They are reliable.

John suggest me to condition my signal with an instrumentation amplifier in an other post.
I did it with relative success because the output signal needed to be bias to 2.5 volt thus I end up with a single channel signal that change from 2.5 to 2.6 volt. Arduino ADC resolution of 4.88 mV don't give me much with such low changes so now I try the ADC way.

Piezoresistive sensor

I retest the differential output and Leo is rigth, the output vary according to the E+. It double if E+ double. With E+ = 5 volts, the sensor change from 0 to 90-100 mV when I gradually apply pressure on the film. With E+ = 10 volt, the output reach 200 mV.

In term of resolution, if I can amplify this 0 - 100 mV output to 0 - 5volt analogue and convert this to 0 to 4096 digital bit signal, I will have about 1.25 cm resolution. This is good for me.

So now I understand I can add a resistor between A+ and A- to decrease 0 - 100 mV to something between 0- 80 mV and use the PGA of 64 (± 40mV or 80 mV) of the HX711 sensor.

I have this board : HX711 board

Can you guide me to reach 0 - 4096 bit output on the arduino? I will be able to convert to voltage and depth on my own.

edit: I use this code and have output data from -260 000.00 up to 8 400 000.00. This is what to expect? I did not put a resistor to decrease the differential output for now.
Can you define what get_scale / set_scale is and also what the "callibrate_scale" function will do??

Code: [Select]
`#include "HX711.h"HX711 piezo;uint8_t dataPin = 2;uint8_t clockPin = 3;void setup(){  Serial.begin(57600);  piezo.begin(dataPin, clockPin);  piezo.reset();  Serial.print("Set gain was: ");  piezo.get_gain();  Serial.println(piezo.get_gain());  piezo.set_gain(64);  Serial.print("Set gain is now: ");  Serial.println(piezo.get_gain());  Serial.print("Actual tare :");  Serial.println(piezo.get_tare());  piezo.tare_set();  Serial.print("New tare should be 0:");  Serial.println(piezo.get_tare());  piezo.get_scale();                   // what is this?  Channel A vs B?   Serial.print("Scale is:");  Serial.println(piezo.get_scale());} void loop(){    Serial.print("Piezo_data is: ");    Serial.println(piezo.get_value());    Serial.print("Piezo_read is:");    Serial.println(piezo.read());    Serial.print("Piezo_average is:");    Serial.println(piezo.read_average());        delay(1000);} // END OF FILE`

thanks

#### Wawa

#8
##### Aug 22, 2020, 11:47 pm
Can you guide me to reach 0 - 4096 bit output on the arduino?
Did you already tell us which Arduino?
Which 5volt Arduino has a 12-bit A/D?
If you want to use the A/D of the Arduino, then you must make an instrumentation amp yourself.
Don't expect a full rail2rail swing of them, so you will likely not be getting the full range of A/D values.

the output vary according to the E+
So go for the HX711, not the ADS1115.
The HX711 has it's own 24-bit A/D, so you can use any cheap/small Arduino and not loose resolution.
But as said, the HX711 NEEDS a 5volt supply for stability.
Is there a problem with that?
Leo..

#### cdb101

#9
##### Aug 23, 2020, 12:22 am
Did you already tell us which Arduino?
Which 5volt Arduino has a 12-bit A/D?
If you want to use the A/D of the Arduino, then you must make an instrumentation amp yourself.
Don't expect a full rail2rail swing of them, so you will likely not be getting the full range of A/D values.
So go for the HX711, not the ADS1115.
The HX711 has it's own 24-bit A/D, so you can use any cheap/small Arduino and not loose resolution.
But as said, the HX711 NEEDS a 5volt supply for stability.
Is there a problem with that?
Leo..
Maybe my english is not good enough to be clear. Sorry about that.

the result I post are with arduino uno + the HX711 as you suggest. I have results but I am not sure exactly how to deal with them. The HX711 output data between -260000 and + 8 900 000. See the edit line just above my code.

It is clear to me how to convert voltage of an instrument into human data (here pressure or water depth.
It is also clear to me that analogue output 0- 5 volts are transfer into bytes (or steps or the name you want for the biologist that I am). Arduino have 1023 steps. I tough that the HX711 has 4096 step but apparently my calculation is not good.

10 bytes ADC = 1024 (arduino)
24 bytes HX711 = ?? My googling return 4096 but base on your comment it is wrong.

thanks

#### Wawa

#10
##### Aug 23, 2020, 01:52 am
1024 is 10-bit (not bytes) An Uno has 1024 values. 0-1023 is 1024 values.
4096 is 12-bit.
HX711 is 24-bit, but anything more than about ~15-bit is noise. High enough resolution though.

You could use map() to convert HX711 value to water depth.
Default map() works with integers only, so you could convert the range of the HX711 to millimetres, for higher resolution. And then print it in metres or centimetres or millimetres.
Leo..

#### cdb101

#11
##### Aug 23, 2020, 02:07 am
Ok, and for you the range I have -260000 to 8900000 look good? Is expected? Or part of it is noise?

My methane sensors work on 3 volts. No choice. Is there a way to do this? I will burn it at 4.2 volt E+.

#### Wawa

#12
##### Aug 23, 2020, 02:22 am
Depends if those numbers are stable.
You only need 4000 steps to display 40m with a 1cm resolution.
I expect that the sensor itself is the limiting factor.

Which methane sensor. What current draw.
The Uno is limited to 150mA from the 3.3volt pin.
The A/D of the Uno might be good enough for that.
Leo..

#### cdb101

#13
##### Aug 23, 2020, 02:44 amLast Edit: Aug 23, 2020, 02:45 am by cdb101
The methane sensor can be and is actually powered by the 3.3 volt pin of the Arduino in my setup.
It output a differential of 0 to 90 mV which will correspond to 0 to 100 % methane concentration. The Arduino A/D is not good enough because the a+ and a- Wheatstone arms are about 1.6 volt. This force me to use 3.3 volts internal arduino ref. And 3.3 v / 1023 = 3.2 mV or about 2 % resolution. Not enough. I need at least 0.5 %.

Schematic I use

Base on the schematic in page 2 of the application note, I made a voltage divider with a 2 k trimpot and balance the a+ and a- output.
When I exposed the sensor to methane, the differential output rise.

Go Up