DAQ speed problem. csv, spi, max4466, raspberry - Raspberry Pi Forums


hi guys, i'm new using raspberry.

i'm trying design digital stethoscope using:
- 6 electret microphones (max4466)
- 8 channels , 10 bits adc (mcp3008). use 6 channels.
- spi
- raspberry pi 3b

frequencies want sample lower 1khz, connected rc filter @ each adc input.
in order draw signal read need sample 10 times faster signal reading, need sample @ 10000 khz each channel. thought shouldn't problem, seems wasn't right :(
want save samples in .csv file in order draw graph on computer later.

problem is: can't more 2000 samples/s. why?
spi configuration or because can't write on .csv file fast?

in order solve problem trying 40000 samples fast possible 1 microphone (it takes 20sec), code:

code: select all

import time import csv  # import spi library (for hardware spi) , mcp3008 library. import adafruit_gpio.spi spi import adafruit_mcp3008  # software spi configuration: clk  = 18 miso = 23 mosi = 24 cs   = 25 mcp = adafruit_mcp3008.mcp3008(clk=clk, cs=cs, miso=miso, mosi=mosi)  print('press ctrl-c quit...')  # create new .csv file contain set of randomly generated open('/home/pi/desktop/savedata/freqtest.csv', 'w') csv_file:     writer = csv.writer(csv_file)     # write header row name of each column.     writer.writerow(['ch0 '])      # main program loop.     x in range (0,40000):         # read adc channel values in list.         values = [0]*8         in range(1):         # read_adc function value of specified channel (0-7).             values[i] = mcp.read_adc(i)         # print out data , write csv file.         writer.writerow([values[0]])  
thank in advance :)

don't use python. need use c.


raspberrypi



Comments