Monday, 26 September 2011

Microphone work: Finding out your sample rate.

Goodness it's been a while since I updated my blog! This is mostly because I've spent the past year or so designing and building a new extension for the epuck robots. Details about that I'll leave for another time, although this blog entry is somewhat related.

I have a circuit which takes a signal from a microphone and feeds it into a PIC microcontroller. This PIC then performs Analogue-to-Digital conversion and stores the data in memory for me to mess with later.
The process of reading in the signal and storing it in memory is known as "sampling". A single piece of recorded data is called a "sample", the rate at which you record the information is called the "sample rate".

Are you following me so far?

The sample rate is super useful to know if you plan on doing anything clever with your data. For my work I need the sample rate to be as fast as possible so I have my PIC recording samples in a loop until its memory gets full. This means I don't actually know how fast this is happening, so I need to measure it.

Read on to find out how I did this, and for some handy MATLAB code!