Closed laloshifrin closed 5 years ago
Can you provide more details about what is actually connect to the ADC channels and how.
I can not recreate this. I wired up an ADS1115 to Pi Zero W and setup a 10k trim pot to voltage divide VCC (3.3V) wired in to channel 0. Set the divider to be about ~0.5V and ran your sketch above. Here's the output:
pi@pizerow:~ $ python3 ads_test.py
2642 0.495 | 3964 0.495 | 7927 0.495 | 15856 0.495 | 31710 0.495 | 32767 0.256
2642 0.495 | 3963 0.495 | 7928 0.496 | 15855 0.495 | 31710 0.495 | 32767 0.256
2642 0.495 | 3963 0.496 | 7927 0.495 | 15854 0.495 | 31707 0.495 | 32767 0.256
2642 0.495 | 3963 0.496 | 7927 0.496 | 15856 0.496 | 31708 0.495 | 32767 0.256
2642 0.495 | 3963 0.496 | 7928 0.496 | 15857 0.495 | 31709 0.495 | 32767 0.256
2642 0.496 | 3964 0.496 | 7928 0.496 | 15855 0.495 | 31710 0.496 | 32767 0.256
2643 0.496 | 3964 0.495 | 7927 0.495 | 15855 0.496 | 31709 0.495 | 32767 0.256
2643 0.496 | 3965 0.496 | 7927 0.495 | 15856 0.496 | 31710 0.495 | 32767 0.256
The raw values increase as expected with the last gain setting being saturated, which is also expected for ~0.5V input. The voltage values (except for the saturated case) are all about the same, since the voltage math takes into account the gain setting.
I have a PH probe directly connected with BNC connector on channel 0 and nothing connected to channel 1 I also tested channel 2 connecting VDD to it:
17450 3.270 | 26161 3.270 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17449 3.272 | 26180 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17451 3.272 | 26179 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17453 3.272 | 26182 3.273 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17453 3.272 | 26180 3.273 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17451 3.272 | 26177 3.273 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17453 3.274 | 26178 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17451 3.271 | 26177 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17453 3.271 | 26176 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17452 3.272 | 26176 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17451 3.271 | 26178 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17451 3.272 | 26178 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17450 3.271 | 26179 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17451 3.274 | 26177 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
17450 3.272 | 26178 3.272 | 32767 2.048 | 32767 1.024 | 32767 0.512 | 32767 0.256
and connecting GND to it:
-23 -0.005 | -32 -0.004 | -66 -0.004 | -124 -0.004 | -268 -0.004 | -503 -0.004
-21 -0.004 | -33 -0.004 | -62 -0.004 | -117 -0.004 | -250 -0.004 | -457 -0.004
-21 -0.004 | -30 -0.004 | -63 -0.004 | -120 -0.004 | -242 -0.004 | -466 -0.004
-22 -0.004 | -31 -0.004 | -60 -0.004 | -116 -0.004 | -255 -0.004 | -453 -0.004
-20 -0.004 | -32 -0.004 | -62 -0.004 | -115 -0.004 | -251 -0.004 | -460 -0.004
-20 -0.004 | -31 -0.004 | -61 -0.004 | -111 -0.004 | -243 -0.004 | -460 -0.004
-20 -0.004 | -32 -0.004 | -62 -0.004 | -114 -0.004 | -247 -0.004 | -475 -0.004
-22 -0.004 | -32 -0.004 | -61 -0.004 | -115 -0.004 | -253 -0.004 | -468 -0.004
-24 -0.004 | -31 -0.004 | -61 -0.004 | -121 -0.004 | -249 -0.004 | -476 -0.004
-19 -0.004 | -32 -0.004 | -63 -0.004 | -115 -0.003 | -252 -0.004 | -467 -0.004
-20 -0.004 | -33 -0.004 | -61 -0.004 | -118 -0.004 | -258 -0.004 | -461 -0.004
-21 -0.004 | -30 -0.004 | -65 -0.004 | -115 -0.004 | -246 -0.004 | -480 -0.004
-21 -0.005 | -30 -0.004 | -61 -0.004 | -121 -0.004 | -254 -0.004 | -460 -0.004
-22 -0.004 | -30 -0.004 | -62 -0.004 | -116 -0.004 | -246 -0.004 | -451 -0.004
-21 -0.004 | -29 -0.004 | -60 -0.004 | -116 -0.004 | -252 -0.004 | -464 -0.004
those seem more reliable but what's going on with that probe?
Those do look more reasonable.
Unknown what is happening but this sounds more like a hardware issue. You can try posting in the forums: https://forums.adafruit.com/
what readings do you get if you execute the script on a channel with nothing connected? Thanks for your work and the replies. :-)
In that case I do seem to get odd results similar to yours:
pi@pizerow:~ $ python3 ads_test.py
3119 0.590 | 4740 0.589 | 4516 0.285 | 8786 0.274 | 62 0.001 | 45 0.001
3111 0.597 | 4706 0.586 | 4566 0.284 | 8779 0.275 | 42 0.001 | 122 0.000
3164 0.584 | 4726 0.592 | 4528 0.282 | 8802 0.275 | 42 0.001 | 44 0.000
3103 0.591 | 4735 0.587 | 4529 0.285 | 8776 0.275 | 62 0.000 | 84 0.001
3160 0.589 | 4694 0.591 | 4560 0.282 | 8801 0.275 | 43 0.001 | 124 0.001
3180 0.586 | 4703 0.593 | 4547 0.281 | 8810 0.275 | 42 0.001 | 45 0.001
3099 0.595 | 4722 0.586 | 4532 0.285 | 8777 0.275 | 62 0.000 | 44 0.001
You are right. It's a hardware problem related to impedance. Thanks for your time
I'm using Raspberry Pi 3B+ with Raspbian Stretch. Using this code:
I get following readings:
from a probe which gives a few millivolts on channel0
and these:
on channel1 without anything connected.
Those readings don't seem to me congruent because the growing gain should give growing values. Or it shouldn't? I'm a little bit confused, can anybody help? Thank you :-)