Yes, you have to wire these pull-up resistors from SDA and SCL (=SCH?) to 3.3V. The different devices (e.g. many ADS1115s) on the two I2C wires cannot produce a short-circuit, even if they try to send data simultaneously, because every device just connects the wire to ground if it tries to output a 0, and does not connect, if it tries to output a 1.
So if many devices respond simultaneously, all bits which are connected to 0 by any device become 0 in the end. Without short-circuit.
The pull-up resisitors make sure that there appears a logical 1 if no device connects the wire to ground.
But even if it is not an electrical problem of short-circut anymore, we don't want different devices to respond simultaneously on the same SDA/SCL lines because their data become mingled up in the way described above.
Therefore there exist I2C addresses. Every device has to have a unique address and it should know of this address.
In the ADS1115 datasheet
www.ti.com/lit/ds/symlink/ads1115.pdf on page 34 you see how to tell any of the four ADS1115s which address to have (The pull-up resistors are also shown in the schematics). This happens by connecting the ADDR pin of the ADS1115 to either GND, VDD (3.3 V), SCL or SDA. After that your ADS1115s have addresses 0b1001000 (=72 =0x48), 0b1001001 (=73 =0x49), 0b1001010 (=74 =0x4A), and 0b1001011 (=75 =0x4B).
Now you can test if the four devices respond - each one separately - to your request to show up.
This is done by scanning the IIC bus:
Code: Select all
i2c2 = I2C(2, freq=100000) # or I2C(2, scl=B10, sda=B9, freq=100000)
i2clist = i2c2.scan()
for z in i2clist:
print('Found Contoller on I2C-Bus 2 at: {:s}'.format(hex(z)))
You should see four lines printed with the controller address shown in hex.
If you have come so far, you can instantiate four adc objects like this:
Code: Select all
adc0 = ADS1115(i2c2, 0x48, 1) # Gain = 1, 32768 ^⁼ 4.096 v
adc1 = ADS1115(i2c2, 0x49, 1) # Gain = 1, 32768 ^⁼ 4.096 v
adc2 = ADS1115(i2c2, 0x4A, 1) # Gain = 1, 32768 ^⁼ 4.096 v
adc3 = ADS1115(i2c2, 0x4B, 1) # Gain = 1, 32768 ^⁼ 4.096 v
Now you should be able to read all 4 channels of each of the four adcs like:
Code: Select all
while True:
print('adc0 A0: {:7.6f}V \n'.format(adc0.raw_to_v(adc0.read(0, 0))))
print('adc0 A1: {:7.6f}V \n'.format(adc0.raw_to_v(adc0.read(0, 1))))
print('adc0 A2: {:7.6f}V \n'.format(adc0.raw_to_v(adc0.read(0, 2))))
print('adc0 A3: {:7.6f}V \n'.format(adc0.raw_to_v(adc0.read(0, 3))))
- - - more lines to come here - - -
print('adc3 A3: {:7.6f}V \n'.format(adc3.raw_to_v(adc3.read(0, 3))))
Cheers