Hi all,
from a Pi4/64 with bookworm connected to a board with 4 ADS1115 on I2C bus, all are found running the I2C watch, the Python script in a venv fails to run if address 0x4a or 0x4b is called.
```
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 49 4a 4b -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --
```
Here the code when its working fine:
Here the code when it's not running / fault message:
Note: only activated adc2 additionally
Any idea what's wrong with it?
Thanks a lot for helping out.
C.
from a Pi4/64 with bookworm connected to a board with 4 ADS1115 on I2C bus, all are found running the I2C watch, the Python script in a venv fails to run if address 0x4a or 0x4b is called.
```
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 49 4a 4b -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --
```
Here the code when its working fine:
Code:
#!/usr/bin/env pythonimport boardimport busioi2c = busio.I2C(board.SCL, board.SDA)import adafruit_ads1x15.ads1115 as ADSfrom adafruit_ads1x15.analog_in import AnalogInGAIN = 16 adc0 = ADS.ADS1115(i2c, gain=GAIN, address=0x48)adc1 = ADS.ADS1115(i2c, gain=GAIN, address=0x49)#adc2 = ADS.ADS1115(i2c, gain=GAIN, address=0x4a)#ads3 = ADS.ADS1115(i2c, address=0x4b)windrichtung = AnalogIn(adc0, ADS.P3) #WindrichtungPitotpressure = AnalogIn(adc0, ADS.P2) #Pitotpressure !Achtung!! Pitotpressure ist im broker klein geschriebenDrehzahl = AnalogIn(adc0, ADS.P1) #Drehzahl !Achtung!! Drehzahl ist im Broker prmvalueBat = AnalogIn(adc0, ADS.P0) #Batterie Voltagelaststrom = AnalogIn(adc1, ADS.P0) #Load Amps DC#ladestrom = AnalogIn(adc2, ADS.P3)print("windrichtung",windrichtung.value, windrichtung.voltage, "Pitotpressure", Pitotpressure.value, Pitotpressure.voltage, "Drehzahl", Drehzahl.value, Drehzahl.voltage, "valueBat", valueBat.value, valueBat.voltage, "laststrom", laststrom.value, laststrom.voltage)[b]if it's exec the output is:[/b]>>> %Run I2C_0x48_0x49.pywindrichtung 32752 0.255875 Pitotpressure 32752 0.255875 Drehzahl 32752 0.255875 valueBat 32752 0.255875 laststrom 16944 0.12575>>>
Here the code when it's not running / fault message:
Note: only activated adc2 additionally
Code:
#!/usr/bin/env pythonimport boardimport busioi2c = busio.I2C(board.SCL, board.SDA)import adafruit_ads1x15.ads1115 as ADSfrom adafruit_ads1x15.analog_in import AnalogInGAIN = 16 adc0 = ADS.ADS1115(i2c, gain=GAIN, address=0x48)adc1 = ADS.ADS1115(i2c, gain=GAIN, address=0x49)adc2 = ADS.ADS1115(i2c, gain=GAIN, address=0x4a)#ads3 = ADS.ADS1115(i2c, address=0x4b)windrichtung = AnalogIn(adc0, ADS.P3) #WindrichtungPitotpressure = AnalogIn(adc0, ADS.P2) #Pitotpressure !Achtung!! Pitotpressure ist im broker klein geschriebenDrehzahl = AnalogIn(adc0, ADS.P1) #Drehzahl !Achtung!! Drehzahl ist im Broker prmvalueBat = AnalogIn(adc0, ADS.P0) #Batterie Voltagelaststrom = AnalogIn(adc1, ADS.P0) #Load Amps DCladestrom = AnalogIn(adc2, ADS.P3)print("windrichtung",windrichtung.value, windrichtung.voltage, "Pitotpressure", Pitotpressure.value, Pitotpressure.voltage, "Drehzahl", Drehzahl.value, Drehzahl.voltage, "valueBat", valueBat.value, valueBat.voltage, "laststrom", laststrom.value, laststrom.voltage, "ladestrom", ladestrom.value, ladestrom.voltage)Result:>>> %Run I2C_0x48_0x49.pyTraceback (most recent call last): File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/adafruit_bus_device/i2c_device.py", line 175, in __probe_for_device self.i2c.writeto(self.device_address, b"") File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/busio.py", line 215, in writeto return self._i2c.writeto(address, buffer, stop=True) File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 60, in writeto self._i2c_bus.write_bytes(address, buffer[start:end]) File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/Adafruit_PureIO/smbus.py", line 303, in write_bytes self._device.write(buf)OSError: [Errno 121] Remote I/O errorDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/adafruit_bus_device/i2c_device.py", line 181, in __probe_for_device self.i2c.readfrom_into(self.device_address, result) File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/busio.py", line 205, in readfrom_into return self._i2c.readfrom_into(address, buffer, stop=True) File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 67, in readfrom_into readin = self._i2c_bus.read_bytes(address, end - start) File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/Adafruit_PureIO/smbus.py", line 170, in read_bytes return self._device.read(number)OSError: [Errno 5] Input/output errorDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "/home/WindPi4/himbeere/sensors/I2C_0x48_0x49.py", line 30, in <module> adc2 = ADS.ADS1115(i2c, gain=GAIN, address=0x4a) File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/adafruit_ads1x15/ads1x15.py", line 153, in __init__ self.i2c_device = I2CDevice(i2c, address) File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/adafruit_bus_device/i2c_device.py", line 62, in __init__ self.__probe_for_device() File "/home/WindPi4/himbeere/venv/lib/python3.11/site-packages/adafruit_bus_device/i2c_device.py", line 184, in __probe_for_device raise ValueError("No I2C device at address: 0x%x" % self.device_address)ValueError: No I2C device at address: 0x4a>>>
Any idea what's wrong with it?
Thanks a lot for helping out.
C.
Statistics: Posted by wwt — Mon Oct 14, 2024 5:16 pm