Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Can't get a values from ADS1115
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Can't get a values from ADS1115

by tyasindu on Tue Mar 03, 2020 12:36 am

I've just picked up an ADS1115, hooked it up to my pi zero, and installed the Adafruit ADS1x15 python library, and I'm running the i2cdetect and it works fine. but when I running the simpletest.py from the examples gives an error.

Code: Select all | TOGGLE FULL SIZE
pi@raspberrypi:~/Adafruit_Python_ADS1x15/examples $ sudo python simpletest.py
Reading ADS1x15 values, press Ctrl-C to quit...
|      0 |      1 |      2 |      3 |
-------------------------------------
Traceback (most recent call last):
  File "simpletest.py", line 42, in <module>
    values[i] = adc.read_adc(i, gain=GAIN)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_ADS1x15/ADS1x15.py", line 192, in read_adc
    return self._read(channel + 0x04, gain, data_rate, ADS1x15_CONFIG_MODE_SINGLE)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_ADS1x15/ADS1x15.py", line 133, in _read
    result = self._device.readList(ADS1x15_POINTER_CONVERSION, 2)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO/I2C.py", line 134, in readList
    results = self._bus.read_i2c_block_data(self._address, register, length)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_PureIO/smbus.py", line 216, in read_i2c_block_data
    cmdstring[i] = val
TypeError: one character string expected

when I run the i2cdetect it works
Code: Select all | TOGGLE FULL SIZE
pi@raspberrypi:~/Adafruit_Python_ADS1x15/examples $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Here's a two pics I took of the circuit
Image Image
I used my multimeter to test the voltage between the VDD and GND of the ADS1115 while it's hooked up, and I am seeing 3.3V across. I used breadboard and jumper wires for wiring. the chip wasn't damaged because I check it with Arduino and it works fine. all the things I'm doing referring these articles.

https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/ads1015-slash-ads1115

I Connected the ADC to the Pi as follows:

ADS1x15 VDD to Raspberry Pi 3.3V
ADS1x15 GND to Raspberry Pi GND
ADS1x15 SCL to Raspberry Pi SCL
ADS1x15 SDA to Raspberry Pi SDA

As well as I used a potentiometer getting the analog values.

tyasindu
 
Posts: 1
Joined: Mon Mar 02, 2020 11:03 pm

Re: Can't get a values from ADS1115

by garyshank1992 on Sat Aug 22, 2020 4:40 pm

same boat, what was the resolution?

garyshank1992
 
Posts: 1
Joined: Sat Aug 22, 2020 2:11 pm

Re: Can't get a values from ADS1115

by adafruit_support_mike on Sun Aug 23, 2020 4:44 am

Try running the code with Python-3 and see if that behaves better than the Python-2.7 version.

adafruit_support_mike
 
Posts: 61439
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.