2017-05-07, 06:22 PM
We haven't used the python library from adafruit.
If you change line 149 in file ads1115.py
config = 0x8103 + 32*self.samples[channel] + 512*self.gain[channel] + (channel+4)*4096
into
config = 0x8103 + 32*self.samples[channel] + 512*self.gain[channel] + (channel)*4096
then you are in differential mode.
Everytihng else should work the same.
At the moment we calculate the address and the channel
to simplify this we could use two arrays
ADS1115_address = [0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x4A,0x4A,0x4A,0x4A,0x4B,0x4B,0x4B,0x4B]
channel = [0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3]
Value of Input 11 (of 0-15) is on third ads1115 with the address 0x4A and the channel 3
In differential mode the channel have the follwing meaning as you already wrote
# Note you can change the differential value to the following:
# 0 = Channel 0 minus channel 1
# 1 = Channel 0 minus channel 3
# 2 = Channel 1 minus channel 3
# 3 = Channel 2 minus channel 3
everything should be fine
If you change line 149 in file ads1115.py
config = 0x8103 + 32*self.samples[channel] + 512*self.gain[channel] + (channel+4)*4096
into
config = 0x8103 + 32*self.samples[channel] + 512*self.gain[channel] + (channel)*4096
then you are in differential mode.
Everytihng else should work the same.
At the moment we calculate the address and the channel
to simplify this we could use two arrays
ADS1115_address = [0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x4A,0x4A,0x4A,0x4A,0x4B,0x4B,0x4B,0x4B]
channel = [0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3]
Value of Input 11 (of 0-15) is on third ads1115 with the address 0x4A and the channel 3
In differential mode the channel have the follwing meaning as you already wrote
# Note you can change the differential value to the following:
# 0 = Channel 0 minus channel 1
# 1 = Channel 0 minus channel 3
# 2 = Channel 1 minus channel 3
# 3 = Channel 2 minus channel 3
everything should be fine