Interfacing with ADS1115 through FT232H Limits Sampling Rate

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
AdamP42
 
Posts: 1
Joined: Sun Nov 20, 2022 11:19 pm

Interfacing with ADS1115 through FT232H Limits Sampling Rate

Post by AdamP42 »

Hello,
I am trying to use ADS1115 as a moderately high speed ADC directly from my (Windows 11) desktop through FT232H. Using this setup, when changing the sampling rate from the default to the highest possible rate (860 samples/second) the actual number of samples/second is stuck at around 32/sec. Oddly enough when testing I found that setting the ADC to 64/sec actually gives me the highest actual rate (around 45-50/sec) for some reason that is completely unknown to me.
I have tried many different things, including changing the frequency of my i2c connection, and decreasing the sleep period in pyftdi under the read function in protocol_ftdi.py. I found some references to this issue online, but nothing specific to my situation. I found one using very outdated software, and another that claims a similar issue was resolved .
Note that when I use a FeatherS3 board to connect with the ADC, I am able to roughly achieve the expected sampling rate, however with the feather board I can't run the code through python on my PC (as far as I am aware). Note that I connected the two boards directly together with a StemmaQT cable. I have put the code I am using below, and timing the for loop gives me my samples per second.
Any help is appreciated, and let me know if any other information would be helpful.
Thanks you!!

Code: Select all

import board
import busio
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
ads = ADS.ADS1115(i2c)
chan = AnalogIn(ads, ADS.P0)
ads.mode = ADS.Mode.CONTINUOUS
ads.data_rate = 860
_ = chan.value
data = []
for i in range(860):
	data.append(chan.voltage)

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Interfacing with ADS1115 through FT232H Limits Sampling Rate

Post by adafruit_support_mike »

The FT232H has to bit-bang the I2C protocol, which very probably pulls its bitrate below the standard 100kbps for an I2C bus.

You could check the exact timing with an oscilloscope or a logic analyzer, or get a rough snapshot connecting SDA and SCL to a couple of digital INPUT pins on another microcontroller. Tracking the microsecond timestamps of each rising edge on SCL will give you a rough idea of how fast the FT232H is passing data.

You might want to check out the MCP2221A, another device with USB-to-I2C capability, but it also has GPIO, a built-in ADC, and a so-so DAC:

https://www.adafruit.com/product/4471

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”