Hello i am using a custom raspberry pi shield on my raspberry pi 4. Currently Im testing only 1 shield with 4 ads1115. In python im using adafruits library to read the data and it can only sample 50x a seconds on a single channel which is kinda slow from what im expecting. So how do i change the i2c address and speed? As of now i can only pull data from the first ADS, so i would also like to change to the second ads.

import board
import busio
i2c = busio.I2C(board.SCL, board.SDA)

import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn

ads = ADS.ADS1115(i2c)

chan = AnalogIn(ads, ADS.P0, ADS.P1)
chan2 = AnalogIn(ads, ADS.P2, ADS.P3)

import time
arrays = []

t_end = time.time() + 1
while time.time() < t_end:
   arrays.append((chan.value, chan.voltage))

for x in arrays:

  • You might like to read my program on how to set up 4 I2C buses:penzu.com/p/f0416d22 – tlfong01 Oct 25 '19 at 2:56
  • thank you, ill look into your link and will report back for progress – Jack Oct 25 '19 at 3:13
  • You are welcome. The AdaFruit library very likely is geared to Rpi3R for which you CANNOT set the I2C speed which stays at the ridiculously low speed of 100kHz (Even "official" spec says you can). For Rpi4B, you can change the speed and therefore increase the sampling rate. – tlfong01 Oct 25 '19 at 3:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.