Hi, this is my first post on the forum so I hope I'm doing this right...
For context, I'm using the ADS1115 to read analog inputs from a pressure transducer. My code has been working perfectly until moments ago (I didn't change anything in the code) when suddenly I found that there's an issue with configuring the register.
The serial monitor output that I get from this code is "Checkpoint 1," but we never make it to Checkpoint 1.1 or Checkpoint 2. Thus, I figure the issue is with adc.init(), which according to some documentation, this "sets the configuration register to default values. Returns false if the ADS1115 is not connected."
If anyone has any suggestions/insights, that would be greatly appreciated!
P.S. Some things I've tried:
Turning everything on/off again
Installing the newest ADS1115 library
Running other code to ensure it's not an issue with the serial communication (it's not.)
Checking that the appropriate voltages are running through the ADC using a multimeter.
The ADS1115 could be the wrong choice.
Most pressure transducers need a ratiometric A/D, which the ADS is not.
Post a link to the transducer.
Which Arduino, and a diagram/picture could also be important.
Hi Leo, thanks for this insight--this is news to me. I'm using an Arduino Uno --> ADS1115 --> Dwyer 626-08-Cb-p1-e5-s1. Can you explain what a ratiometric A/D is and why you would use one for a pressure transducer?
Ratiometric pressure sensors output pressure as a ratio of their supply. Not just a voltage.
You linked to a family of sensors, so I still don't know which one you have.
Choosing the wrong combination of sensor and A/D makes pressure reading of the setup also go up/down with supply variations.
This line comes from the datasheet, and lists the different outputs they can come in.
"10 to 30 VDC (for 4 to 20 mA, 0 to 5, 1 to 5, 1 to 6 VDC outputs); 13 to 30 VDC (for 0 to 10, 2 to 10 VDC outputs); 5 VDC ±0.5 VDC (for 0.5 to 4.5 VDC ratio-metric output), 10 to 35 VDC (for 4 to 20 mA with -CB option); 13 to 35 VDC or isolated 16 to 33 VAC (for selectable output with -CB option)."
Only the 4-20mA or 'voltage' outputs should be read with an ADS1115.
A voltage divider is needed for the 'voltage' outputs, to keep ADS input within the 3.3volt supply it should be powered with (for the 3.3volt-logic ESP32).
The reason rationmeteric sensors are desirable is:
First it is important the sensor voltage and the A/D reference be the same. Given that,
Over small ranges of voltage (5V for this discussion) the voltage for the sensor and the voltage for the A/D will cancel and have very low effect on the resultant reading.
Assume the sensor is at 50% and the power is 5V. the output will be 2.5v
If the A/D reference is 5v then the A/D conversion of 2.5V will result in (1024 counts / 5v) *2.5v = 1024 /2
Now if the 5V -> 5.2V
then the sensor output is 2.6v therefore the counts will be (1024 / 5.2) * 2.6 =1024/2
This is not a 100% cancellation of the 5v variation, there is another term we didn't consider above, that is the (we will assume a pressure sensor) kPa/volt value. However is you assume the 5v will be between 4.8 and 5.2 the kPa/volt value is very small.
Yes, MOST industrial sensors that have analog output are not ratiometric so as to keep their calibration and linearity.
As industrial DC power is basically 24Vdc, and output standards are usually 0-20mA, 4-20mA, 0-5V and 0-10V, output level calibration is "easy" to achieve.
I would not have used a 250 ohm sense resistor.
That value does not match the sensor-A/D very well, so you don't get full resolution.
Use a 100 ohm resistor instead, and switch the A/D to a PGA gain of 2 (2.048volt).
Your 4-20mA diagram is wrong (swap resistor and sensor).
I hope you have connected it right.