ADS1115 error, and seeking wiring confirmation for AC current sensing

Hey there, I’m looking for confirmation on the wiring of ADS1115 for AC current sensing.

Going off of the main write-up which states:

Last, connect the negative and positive DC voltage outputs from this board to the analog-to-digital converter’s Ground and Analog 0 Input (A0) connections, respectively.

Wiring:
AC current Sensor |-> ADC |-> R PI 4
(-)negative |-> GND |-> GND
(+) |-> A0 |-> N/A
N/A |-> VDD |-> 5V
A |-> N/A |-> N/A

Traceback:

2022-03-08 09:21:16,193 - INFO - mycodo.controllers.controller_input_8307eded - Activated in 229.0 ms
2022-03-08 09:21:16,202 - ERROR - mycodo.inputs.ads1115_circuitpython_8307eded - InputModule.get_measurement() method raised IOError: [Errno 121] Remote I/O error
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/inputs/base_input.py", line 116, in read
    self._measurements = self.get_measurement()
  File "/home/pi/Mycodo/mycodo/inputs/ads1115_circuitpython.py", line 159, in get_measurement
    channel, self.adc_gain, chan.value, chan.voltage))
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/analog_in.py", line 61, in voltage
    volts = self.value * _ADS1X15_PGA_RANGE[self._ads.gain] / 32767
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/analog_in.py", line 54, in value
    return self._ads.read(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/ads1x15.py", line 134, in read
    return self._read(pin)
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/ads1x15.py", line 175, in _read
    while not self._conversion_complete():
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/ads1x15.py", line 189, in _conversion_complete
    return self._read_register(_ADS1X15_POINTER_CONFIG) & 0x8000
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/ads1x15.py", line 215, in _read_register
    i2c.write_then_readinto(bytearray([reg]), self.buf, in_end=2)
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_bus_device/i2c_device.py", line 124, in write_then_readinto
    self.i2c.writeto_then_readfrom(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/busio.py", line 183, in writeto_then_readfrom
    return self._i2c.writeto_then_readfrom(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 87, in writeto_then_readfrom
    readin = self._i2c_bus.read_i2c_block_data(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/Adafruit_PureIO/smbus.py", line 275, in read_i2c_block_data
    ioctl(self._device.fileno(), I2C_RDWR, request)
OSError: [Errno 121] Remote I/O error
2022-03-08 09:21:21,233 - DEBUG - mycodo.inputs.ads1115_circuitpython_8307eded - Channel 0: Gain 0.6666666666666666, 0 raw, 0.0 volts
2022-03-08 09:21:21,245 - DEBUG - mycodo.inputs.ads1115_circuitpython_8307eded - Channel 1: Gain 0.6666666666666666, 0 raw, 0.0 volts

I tried various other configurations until I was able to get some feedback:

Wiring:
AC current Sensor |-> ADC |-> R PI 4
(-)negative |-> GND |-> GND
(+) |-> VDD |-> 5V
A |-> A0 |-> N/A

The above returned:

2022-03-08 09:42:03,717 - DEBUG - mycodo.inputs.ads1115_circuitpython_8307eded - Channel 0: Gain 0.6666666666666666, 106 raw, 0.01912558366649373 volts
2022-03-08 09:42:03,722 - ERROR - mycodo.inputs.ads1115_circuitpython_8307eded - InputModule.get_measurement() method raised IOError: [Errno 121] Remote I/O error
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/inputs/base_input.py", line 116, in read
    self._measurements = self.get_measurement()
  File "/home/pi/Mycodo/mycodo/inputs/ads1115_circuitpython.py", line 160, in get_measurement
    measurement_totals[channel] += chan.voltage
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/analog_in.py", line 61, in voltage
    volts = self.value * _ADS1X15_PGA_RANGE[self._ads.gain] / 32767
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/analog_in.py", line 54, in value
    return self._ads.read(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/ads1x15.py", line 134, in read
    return self._read(pin)
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/ads1x15.py", line 175, in _read
    while not self._conversion_complete():
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/ads1x15.py", line 189, in _conversion_complete
    return self._read_register(_ADS1X15_POINTER_CONFIG) & 0x8000
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_ads1x15/ads1x15.py", line 215, in _read_register
    i2c.write_then_readinto(bytearray([reg]), self.buf, in_end=2)
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_bus_device/i2c_device.py", line 124, in write_then_readinto
    self.i2c.writeto_then_readfrom(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/busio.py", line 183, in writeto_then_readfrom
    return self._i2c.writeto_then_readfrom(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 87, in writeto_then_readfrom
    readin = self._i2c_bus.read_i2c_block_data(
  File "/var/mycodo-root/env/lib/python3.9/site-packages/Adafruit_PureIO/smbus.py", line 275, in read_i2c_block_data
    ioctl(self._device.fileno(), I2C_RDWR, request)
OSError: [Errno 121] Remote I/O error
2022-03-08 09:42:08,754 - DEBUG - mycodo.inputs.ads1115_circuitpython_8307eded - Channel 0: Gain 0.6666666666666666, 129 raw, 0.023250709555345316 volts

SDA and SCL connected, and i2C detected throughout.

I’ve looked through the wiring diagram, live image, and video recordings. The 3 show different or at times ambiguous set-up.

Please let me know if I can provide more info in solving this issue.

Apparently you need to slow down the I2C clock on the R PI with some I2C sensors: I2C Clock Stretching | CircuitPython on Linux and Raspberry Pi | Adafruit Learning System

I had to slow my baudrate to 5000 AND three out of four of my A pins were toast.

I’m now able to get measurements:

2022-03-13 18:36:36,221 - DEBUG - mycodo.inputs.ads1115_circuitpython_8307eded - Channel 3: Gain 0.6666666666666666, 1584 raw, 0.2971965697195349 volts
2022-03-13 18:36:36,250 - DEBUG - mycodo.inputs.ads1115_circuitpython_8307eded - Channel 3: Gain 0.6666666666666666, 1585 raw, 0.29738407544175544 volts
2022-03-13 18:36:36,278 - DEBUG - mycodo.inputs.ads1115_circuitpython_8307eded - Channel 3: Gain 0.6666666666666666, 1587 raw, 0.2977590868861965 volts
2022-03-13 18:36:36,306 - DEBUG - mycodo.inputs.ads1115_circuitpython_8307eded - Channel 3: Gain 0.6666666666666666, 1589 raw, 0.29794659260841705 volts
2022-03-13 18:36:36,316 - DEBUG - mycodo.inputs.ads1115_circuitpython_8307eded - All measurements completed in 0.113 seconds

However, the measurements don’t respond to the switching on of new devices. The Amp reading should be going up higher, but it only increases very slightly as if nothing was connected.