Change i2c address of AM2315 (0x5C) to AM2315C (0x38)

Hello,

So I’m using the AM2315C sensor as the AM2315 has been discontinued.

Am I able to change the i2c address of the AM2315 input that’s pre-configured or do I need to add a custom input for my AM2315C sensor?

Mine is greyed out so not sure if and where I can change it?

AM2315 i2c address = 0x5C
and mine, AM2315C i2c address = 0x38

After some research I figured out that the new AM2315C sensor is actually the AHT20 sensor on the inside. Ref: AM2315C - Encased I2C Temperature/Humidity Sensor (Adafru... | Little Bird

So I removed the AM2315 input and added the AHTx0 Input which is correct as the i2c address shows as 0x38

But I’m still not able to get any data from it :sweat:

Below are my logs:

2022-06-16 18:40:17,867 - ERROR - mycodo.controllers.controller_input_cb8c22c4 - initialize_variables() Exception: No I2C device at address: 0x38
Traceback (most recent call last):
File “/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_bus_device/i2c_device.py”, line 174, in __probe_for_device
self.i2c.writeto(self.device_address, b"")
File “/var/mycodo-root/env/lib/python3.9/site-packages/busio.py”, line 169, in writeto
return self._i2c.writeto(address, buffer, stop=stop)
File “/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py”, line 52, in writeto
self._i2c_bus.write_bytes(address, buffer[start:end])
File “/var/mycodo-root/env/lib/python3.9/site-packages/Adafruit_PureIO/smbus.py”, line 314, in write_bytes
self._device.write(buf)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_bus_device/i2c_device.py”, line 180, in __probe_for_device
self.i2c.readfrom_into(self.device_address, result)
File “/var/mycodo-root/env/lib/python3.9/site-packages/busio.py”, line 159, in readfrom_into
return self._i2c.readfrom_into(address, buffer, stop=stop)
File “/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py”, line 59, in readfrom_into
readin = self._i2c_bus.read_bytes(address, end - start)
File “/var/mycodo-root/env/lib/python3.9/site-packages/Adafruit_PureIO/smbus.py”, line 181, in read_bytes
return self._device.read(number)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/var/mycodo-root/mycodo/controllers/base_controller.py”, line 74, in run
self.initialize_variables()
File “/var/mycodo-root/mycodo/controllers/controller_input.py”, line 317, in initialize_variables
self.measure_input = input_loaded.InputModule(self.input_dev)
File “/home/gg/Mycodo/mycodo/inputs/ahtx0_circuitpython.py”, line 56, in init
self.initialize_input()
File “/home/gg/Mycodo/mycodo/inputs/ahtx0_circuitpython.py”, line 62, in initialize_input
self.sensor = adafruit_ahtx0.AHTx0(
File “/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ahtx0.py”, line 49, in init
self.i2c_device = I2CDevice(i2c_bus, address)
File “/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_bus_device/i2c_device.py”, line 61, in init
self.__probe_for_device()
File “/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_bus_device/i2c_device.py”, line 183, in __probe_for_device
raise ValueError(“No I2C device at address: 0x%x” % self.device_address)
ValueError: No I2C device at address: 0x38
2022-06-16 18:40:17,897 - INFO - mycodo.controllers.controller_input_cb8c22c4 - Activated in 1803.4 ms
2022-06-16 18:40:17,899 - ERROR - mycodo.controllers.controller_input_cb8c22c4 - Mycodo is attempting to acquire measurement(s) from an Input that has already critically errored. Review the log lines following Input Activation to investigate why this happened.
2022-06-16 18:40:32,473 - ERROR - mycodo.controllers.controller_input_cb8c22c4 - Mycodo is attempting to acquire measurement(s) from an Input that has already critically errored. Review the log lines following Input Activation to investigate why this happened.

gg@raspberrypi:/dev i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- gg@raspberrypi:/dev i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –
gg@raspberrypi:/dev $

Does this mean there is a wiring issue?

This was resolved by rewiring the Temp sensor, guess it didn’t take the first time :slightly_smiling_face: