Faster sensor readings

For my project, I want to read analog sensor inputs at a very fast rate, at least 20kHz. What would I need to do? I read that analogRead() is too slow, but I'm not sure what else I could use. I'm currently using PuTTY to capture and save the serial outputs. Would I have to increase the baud rate as well?

Maybe.

Fast sampling ADC - Using Arduino / Project Guidance - Arduino Forum

Using the search engine costs nothing...

You forgot to mention which Arduino you have.

20 kHz analog input data rate is no problem, and the upper end Arduinos (not AVR-based ones like the Uno R3, Mega, etc.) have default analog input rates much higher than that.

20kHz @ 16bits/reading (assuming no bit packing) + overhead of 1 start, 1 stop bit 20,000 * 18 = 360, 000. So yeah, you'll need to bump up the baud rate.

You can get some data compression (and thus use a slower baud rate) by taking advantage of the fact that the ADC readings are 10 bits each. So you can fit 8 samples into 10 bytes instead of 16 by packing them together. That's left as an exercise for the user :wink:

I'm using the uno. So in essence I could still use analogRead but with a higher baud rate, or would I have to use ADC with a code similar to this https://www.gammon.com.au/adc