I wanted to ask, if someone is experiencing the same odd behavior about the ADC sampling speeds of the Expander PI HAT or equivalent when using the python libs?
I am totally aware about the overhead that python has, but with the adcspeed demo of the AB lib I achieve ~25ksps, what is enough for my project. Even if the sampling speed would vary +-5ksps would be still a reasonable performance for my system, but it needs to be min <= 20ksps. But when I capture less than ~4000 samples, it decreases alot.
Enclose a summary about my testing.
Doese someone have some tips how to stabilize the sampling performacne? Maybe importing the C lib via wrapper to Python?
I used the method from the official python lib.
def speed_ab_lib(self, samples):
counter = 1
totalsamples = int(samples)
readarray = np.zeros(totalsamples)
starttime = datetime.datetime.now()
while counter < totalsamples:
# read the voltage from channel 1 and display on the screen
readarray[counter] = self._inputDriverSpeed.get_sample_raw()
counter = counter + 1
endtime = datetime.datetime.now()
totalseconds = (endtime - starttime).total_seconds()
samplespersecond = totalsamples / totalseconds
return samplespersecond
Thanks for your help + grettings!