Suigor:
I noticed something. When i add a delay between the readouts they are different, but they seem to be wrong then:
adc0 = ads.readADC_SingleEnded(0);
delay(100);
adc1 = ads.readADC_SingleEnded(1);
Could there be a problem with the I2C Communication?
I have a feeling that this might be your answer. The Adafruit_ADS1x15 library uses a hard coded delay() between requesting a conversion and reading the answer back. For the ADS1015 that is a 1ms delay, and for the ADS1115 it is a 8ms delay. If my sums are right, then the conversion at the default sample rate on the 1015 takes 0.625ms to complete, and on the 1115 it takes 7.81ms - presumably the I2C overhead and whatnot gets added to these. So that's a bit less overhead on the 1115 available.
If the conversion is read before it completes then you end up getting the previous value, not the requested one. Which might explain the identical readings.
Try editing your library Adafruit_ADS1015.h and increase ADS1115_CONVERSIONDELAY to 9ms (or a bit more if necessary to be sure).
Make sure that the library recompiles after the change - maybe quit the IDE and restart it.
If the results then differ, we can then look into why you think they are not correct.
Suigor:
The potentiometer of the joystick are connected each to ground and 3.3v, the middle pins from the potentiometer to a0 and a1 of the ADS11115.
The joystick does work when connected to analog inputs of the ESP32 directly, but the inputs of the ESP32 are not linear.
Not correct, since that ADS1115 has several full-scale voltages, and none of them is 3.3volt.
The ADS1115 is not designed for ratiometric sensors, like pots.
Zero-point will drift if you use this A/D.
I think the best you can do is power the pots from a 2.048volt voltage reference, and use a PGA gain of 2.
ESP A/Ds have the same problem. Made for absolute (voltage) sensors, not for ratiometric sensors.
There should however not be a problem with linearity, assuming you use the right attenuation setting.
Leo..
arduarn:
Try editing your library Adafruit_ADS1015.h and increase ADS1115_CONVERSIONDELAY to 9ms (or a bit more if necessary to be sure).
Make sure that the library recompiles after the change - maybe quit the IDE and restart it.
Thank you. I set it to 10 ms and now it works fine!
arduarn:
I have a feeling that this might be your answer. The Adafruit_ADS1x15 library uses a hard coded delay() between requesting a conversion and reading the answer back. For the ADS1015 that is a 1ms delay, and for the ADS1115 it is a 8ms delay. If my sums are right, then the conversion at the default sample rate on the 1015 takes 0.625ms to complete, and on the 1115 it takes 7.81ms - presumably the I2C overhead and whatnot gets added to these. So that's a bit less overhead on the 1115 available.
If the conversion is read before it completes then you end up getting the previous value, not the requested one. Which might explain the identical readings.
Try editing your library Adafruit_ADS1015.h and increase ADS1115_CONVERSIONDELAY to 9ms (or a bit more if necessary to be sure).
Make sure that the library recompiles after the change - maybe quit the IDE and restart it.
If the results then differ, we can then look into why you think they are not correct.
arduarn:
If the conversion is read before it completes then you end up getting the previous value, not the requested one. Which might explain the identical readings.
Try editing your library Adafruit_ADS1015.h and increase ADS1115_CONVERSIONDELAY to 9ms (or a bit more if necessary to be sure).
Make sure that the library recompiles after the change - maybe quit the IDE and restart it.
If the results then differ, we can then look into why you think they are not correct.
I cannot just read this, and don't say even "Thank you!" I struggled for a day or so trying to figure out why the ADS1115 was giving me the same reading for every input pin, just like Suigor posted. Anyway, after changing the conversion dalay to 9 for the ADS1015(12 bit), bingo! All 4 inputs work the way I expected: each input providing a different reading. Once again, thank you, arduarn!
NOTE: I notice that if I feed 1.5V to any input pin, I get a little higher than that, for example feeding 3.2V, I get 3.4+ volts, well this is not good, this will trow off the results. I solved this by multiplying the result by a factor of 0.936.
I am interfacing this ADC with the MKR1000, the MKR1000's analog inputs drift too much as we know, this ADC provides a very stable input, basically it does not drift at all.
I am reading three analog sensors for my Personal Weather Station: the vane or wind direction, the UV index sensor, and the solar radiation sensor.