Analogue input

Unlike many embedded controller boards, the Raspberry Pi does not have any analogue input. For a lot of uses this is not an issue, but as I progress with my plans to build an ultrasonic recording and processing system (a.k.a “bat detector”) I’m beginning to think that I need to add some analogue input to catch the high-frequency audio signals from the microphone.

Initially I thought that this would be relatively easy. There are several analogue input boards available for the Raspberry Pi (here, here, and here, for example) and I know that there are analogue inputs on my Gertboard, and also on the little Arduino I have somewhere.

Unfortunately, the world of Analogue-to-digital converters (ADC) seems to have a bit of a dirty secret. The ADC devices on these boards are s.l.o.w…

Brian Dorey’s “professional” ADC seems to top out at about 240 samples per second. The docs for the quick2wire board don’t say, but the datasheet for the ADC chip they use seems limited by the i2c bus in the same way. The ADC on an Arduino is somewhat better, but it still takes about 100us to read a value, giving a maximum read rate of about 10,000 samples per second. The Gertboard steps this up a bit more, claiming 72,000 samples per second.

While some of these may seem pretty speedy, they are completely unsuitable for this application. Some UK bats can ping at over 100KHz. For a reasonable recording, as Harry Nyquist pointed out years ago, we need to sample at twice the highest frequency. So a bat detector needs to sample at least 200,000 times every second.

I have tried looking around the web for ADC data sheets, but it’s really hard to find the sample time or the maximum sample rate. Some devices claim to be “high speed”, but don’t seem to say what that means. Others simply don’t mention it.

It’s quite likely that I am missing something obvious, but this bit is turning out much harder than I originally thought.


Leave a Reply

Your email address will not be published. Required fields are marked *