I would like to find out how many samples per second this ADC im using is capable of with a raspberry pi using i2c and python SMBUS2 library, but i dont know where to start.
As far as i know this depends on: CPU speed (how fast python runs), i2c speed, ADC sampling rate.
I would like my python program to return at least 10,000 values per second from the ADC.
Since the raspberry pi is running linux and the python program is a process with not all cpu power concentrated on it, it will be hard to determine how many times the pi can retrieve data from the ADC per second consistently. Example code of how many times python can increment a counter in 1 second:
import time
import smbus
cnt = 0
condition = True
ST = time.time()
ET = 0
while condition:
if (time.time() > (ST + 1)):
condition = False
ET=time.time()
cnt += 1
#code for reading ADC potentially here: ADC_val = bus.read_byte_data(adr, Ain)
print(cnt)
print(ET-ST)
On my laptop with i5 @ 2.3 GHz it returned about 2.4 million times through the loop in 1 second.
The raspberry pi (actually im using a "vocore 2" a single board computer - similair to pi) returned 30k in 1 second.
The ADC (maxim MAX 11605 i2c version), supports i2c speed of 400kHz and 1.7MHz and is HS mode (1.7Mhz) it can do 188ksps and in FS mode (400kHz) it can do 44ksps.
So my question is, if CPU speed didnt matter, at an i2c speed of 400kHz of Pi and ADC and thus 44ksps from the datasheet, how many samples would the ADC deliver? 44ksps? Is the 400kHz relevant here?
Im grateful for any help or tips to find out more about i2c and ADC in general (and calculating sampling time), thank you