Increasing sampling frequency of analogRead()

Hello, i am new to arduino and elctronics and am trying to record a piezo attached to a persons throat and save the data. I will then process the data with another program to differentiate between speech and coughs.

I've read projects on building oscilloscopes andhow by reducing the prescaler of the ATMEGA328P U from 128 to 16 to get an improved sampling frequency of 77KHz. When i view this on serial port or serial monitor however it keeps freezing and being very slow.

I would like to record the data and see what sampling frequency i can actually achieve before continuing with the project.

If i buy a datalogger and save to the SD card (Overview | Adafruit Data Logger Shield | Adafruit Learning System) will this high sampling frequency be achieved or can the arduino not write the data is quickly as it can read it?

Thanks for the help.

check here - Bench_Power_Supply/adc.cpp at master · enjoyneering/Bench_Power_Supply · GitHub

but be careful - the accuracy drops with frequency

Try an external adc, search for mcp3208

Throughput is indeed a major problem - especially writing to the Serial console is slow, too slow to dump all that data there.

The Arduino is simply not suited for high speed analog data acquisition and handling. Try a more capable processor like the Teensy or ESP32.

When i view this on serial port or serial monitor

At what Baud rate?

Also the faster you clock the ADC, the lower the driving impedance needs to be - so 10k is OK
at 10kSPS, but you'd probably need 5k or lower for 20kSPS, etc.

With a low power microcontroller like the ATmega series the only way to talk to an SDcard is with the SPI
interface, which is far slower than the normal, 'native', interface that most things with SDcard
use.