I have a High Precision AD/DA board from waveshare with Raspberry Pi 3B (running on Raspbian).
However, I can write only 27 samples in 1s in my CSV file. I am using this Python code for writing to a CSV file. It seems my code is not optimized for writing at a higher sampling rate.
The only change done in the code is in the 'main.py' file(rest code is same as that from waveshare) and the edit is:
The overall code used by me is: code_used_link. Now the problem that I am facing is that reading the value from ADC.ADS1256_GetAll()
is taking time and also with this code i am not able to achieve the desired sampling rate.
while(time.time()<future):#running for 1 sec.
tic = time.perf_counter()
x.append(ADC.ADS1256_GetAll())#x is a list.
toc = time.perf_counter()
print(f"{(toc - tic)*1000000} useconds")#seeing time between each read
After the whole reading process, I write the data from the list to CSV file.
Could you let me know how can I write the data to my CSV file above 10 KPS sampling rate?