0

ads1115: No I2C device at address: 48
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ads1115: No I2C device at address: 48

by adeibiza on Wed Feb 17, 2021 11:28 am

Code: Select all | TOGGLE FULL SIZE
import board
import busio
import time
import sys
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn

# Setup
i2c = busio.I2C(board.SCL, board.SDA)
#ads = ADS.ADS1115(i2c)
ads = ADS.ADS1115(address=0x48, i2c=i2c)

channel = AnalogIn(ads, ADS.P0)

print(chan.value, chan.voltage)


output:
Code: Select all | TOGGLE FULL SIZE
$ python3 ph.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 172, in __probe_for_device
    self.i2c.writeto(self.device_address, b"")
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 116, in writeto
    return self._i2c.writeto(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 49, in writeto
    self._i2c_bus.write_bytes(address, buffer[start:end])
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 308, in write_bytes
    self._device.write(buf)
OSError: [Errno 6] No such device or address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 178, in __probe_for_device
    self.i2c.readfrom_into(self.device_address, result)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 106, in readfrom_into
    return self._i2c.readfrom_into(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 56, in readfrom_into
    readin = self._i2c_bus.read_bytes(address, end - start)
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 179, in read_bytes
    return self._device.read(number)
OSError: [Errno 6] No such device or address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ph.py", line 11, in <module>
    ads = ADS.ADS1115(address=0x48, i2c=i2c)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_ads1x15/ads1x15.py", line 65, in __init__
    self.i2c_device = I2CDevice(i2c, address)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 68, in __init__
    self.__probe_for_device()
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 180, in __probe_for_device
    raise ValueError("No I2C device at address: %x" % self.device_address)
ValueError: No I2C device at address: 48


yet this is the output of sudo i2cdetect -y 1:

any ideas ?

Code: Select all | TOGGLE FULL SIZE
$ 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: -- -- -- -- -- -- -- --     
Attachments
Screen Shot 2021-02-17 at 13.52.12.png
Screen Shot 2021-02-17 at 13.52.12.png (62.03 KiB) Viewed 55 times

adeibiza
 
Posts: 4
Joined: Sun Sep 16, 2018 11:41 am

Re: ads1115: No I2C device at address: 48

by adeibiza on Wed Feb 17, 2021 1:20 pm

i had added another i2c sensor on bus 3 - in /boot/config.txt for an htu21df - both that and the ads1115 were recognised but for some reason i guess that adafruit library doesn't like this

commented out the lines in config.txt and it now recognises the ads1115 fine & script doesn't barf - shame, because i would have liked to have a kept an htu21df on the same pi zero

adeibiza
 
Posts: 4
Joined: Sun Sep 16, 2018 11:41 am

Re: ads1115: No I2C device at address: 48

by mikeysklar on Thu Feb 18, 2021 1:55 pm

Does it make a difference if you use the ADS1115 selectable address options? You could use:

https://learn.adafruit.com/adafruit-4-c ... 2974117-12

Code: Select all | TOGGLE FULL SIZE
2C Addressing
The ADS11x5 chips have a base 7-bit I2C address of 0x48 (1001000) and a clever addressing scheme that allows four different addresses using just one address pin (named ADR for ADdRess). To program the address, connect the address pin as follows:
0x48 (1001000) ADR -> GND
0x49 (1001001) ADR -> VDD
0x4A (1001010) ADR -> SDA
0x4B (1001011) ADR -> SCL

mikeysklar
 
Posts: 3415
Joined: Mon Aug 01, 2016 8:10 pm

Re: ads1115: No I2C device at address: 48

by adeibiza on Fri Feb 19, 2021 7:23 am

no , its not the actual address, htu & ads are different anyway - i'm guessing something to do with the bus - maybe the ads library uses the "last" bus which in this case would be bus3 the htu was on

if i really need to put an htu on it i'll maybe switch the sda&scl jumpers on the htu and ads so the htu is on pin2&3 & ads on the bus 3 pins but i'm not holding my breath on it working ;)

adeibiza
 
Posts: 4
Joined: Sun Sep 16, 2018 11:41 am

Please be positive and constructive with your questions and comments.