ADS1115 with BalenaFin and CM3

Hello.
My setup is:
BalenaFin
RPi CM3 lite
most recent Raspian-Fin-full.img
ADS1115

I’ve been trying to use the ADS1115 (analog to digital converter from Adafruit) with the Adafruit ADS1x15 Python library available here:

I’ve used the identical setup as above - same I/O pins and python libraries - on RPi 3B+ boards in the past without a problem. However, using the BalenaFin with the CM3 I’m getting the following error when I run the ‘simpletest.py’ example that’s included with the Adafruit ADS1x15 Python libraries:

Traceback (most recent call last):
File “simpletest.py”, line 42, in
values[i] = adc.read_adc(i, gain=GAIN)
File “build/bdist.linux-armv7l/egg/Adafruit_ADS1x15/ADS1x15.py”, line 192, in read_adc
File “build/bdist.linux-armv7l/egg/Adafruit_ADS1x15/ADS1x15.py”, line 133, in _read
File “build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py”, line 134, in readList
File “build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py”, line 216, in read_i2c_block_data
TypeError: one character string expected

Can anyone shed some light on what might be the problem? As I mentioned above, I did not have this problem before when using a RPi 3B+ motherboard. Thanks!

Hello,

  • Could you please confirm that the ADS1115 is visible on the i2c bus, with the command i2cdetect -y 1? (sudo apt-get install -y i2c-tools if you don’t have those tools).
  • Could you also confirm that there were no errors during the installation of the ADS1x15 Python library?
    Thank you

Hello Scott. Thank you for the reply.

Yes, i2cdetect shows the ADS1115 as visible under address 0x48. I can also confirm this by removing the ADS1115 board from the GPIO connections and rerunning i2cdetect, which. when done, does not list 0x48.

The installation of the ADS1115 Python library did not throw any errors. Below I’ve included the terminal output from after running —> sudo python setup.py install

running install
running bdist_egg
running egg_info
writing requirements to Adafruit_ADS1x15.egg-info/requires.txt
writing Adafruit_ADS1x15.egg-info/PKG-INFO
writing top-level names to Adafruit_ADS1x15.egg-info/top_level.txt
writing dependency_links to Adafruit_ADS1x15.egg-info/dependency_links.txt
reading manifest file ‘Adafruit_ADS1x15.egg-info/SOURCES.txt’
writing manifest file ‘Adafruit_ADS1x15.egg-info/SOURCES.txt’
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/Adafruit_ADS1x15
copying build/lib.linux-armv7l-2.7/Adafruit_ADS1x15/ADS1x15.py -> build/bdist.linux-armv7l/egg/Adafruit_ADS1x15
copying build/lib.linux-armv7l-2.7/Adafruit_ADS1x15/init.py -> build/bdist.linux-armv7l/egg/Adafruit_ADS1x15
byte-compiling build/bdist.linux-armv7l/egg/Adafruit_ADS1x15/ADS1x15.py to ADS1x15.pyc
byte-compiling build/bdist.linux-armv7l/egg/Adafruit_ADS1x15/init.py to init.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying Adafruit_ADS1x15.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying Adafruit_ADS1x15.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying Adafruit_ADS1x15.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying Adafruit_ADS1x15.egg-info/requires.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying Adafruit_ADS1x15.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents…
creating ‘dist/Adafruit_ADS1x15-1.0.2-py2.7.egg’ and adding ‘build/bdist.linux-armv7l/egg’ to it
removing ‘build/bdist.linux-armv7l/egg’ (and everything under it)
Processing Adafruit_ADS1x15-1.0.2-py2.7.egg
Removing /usr/local/lib/python2.7/dist-packages/Adafruit_ADS1x15-1.0.2-py2.7.egg
Copying Adafruit_ADS1x15-1.0.2-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adafruit-ADS1x15 1.0.2 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/Adafruit_ADS1x15-1.0.2-py2.7.egg
Processing dependencies for Adafruit-ADS1x15==1.0.2
Searching for Adafruit-GPIO==1.0.1
Best match: Adafruit-GPIO 1.0.1
Processing Adafruit_GPIO-1.0.1-py2.7.egg
Adafruit-GPIO 1.0.1 is already the active version in easy-install.pth

Using /usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-1.0.1-py2.7.egg
Searching for spidev==3.3
Best match: spidev 3.3
Adding spidev 3.3 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Searching for Adafruit-PureIO==1.0.4
Best match: Adafruit-PureIO 1.0.4
Processing Adafruit_PureIO-1.0.4-py2.7.egg
Adafruit-PureIO 1.0.4 is already the active version in easy-install.pth

Using /usr/local/lib/python2.7/dist-packages/Adafruit_PureIO-1.0.4-py2.7.egg
Finished processing dependencies for Adafruit-ADS1x15==1.0.2

Hi,
Hard to tell what might be the problem. Are you using python2 ? Have you tried the newer adafruit guide https://learn.adafruit.com/adafruit-4-channel-adc-breakouts/python-circuitpython ?