We’re big subscribers to the maker culture here at Cocoon HQ and it’ll come as no surprise that a device like the Raspberry Pi has found its way into a number of early Cocoon prototypes. It’s feature-rich and cost-effective, but most importantly, it has a fantastically knowledgeable support community.
One of the more interesting developments of late is the introduction of a number of high quality audio attachments for the Pi, great news for Pi geeks and audiophiles alike.
As John’s previous post explained, we’re very interested in the acquisition and processing of audio signals amongst other input, so the Pi seemed a natural platform for rapid development of our sensor systems.
For the Cocoon to apply its digital smarts to our very analogue world we needed the help of an Analogue to Digital converter (ADC) to help record and interpret interesting events such as doors/windows opening or people moving around. The ADC’s job is pretty simple – it takes the waves of incoming sound and produces a number of sample readings; with enough samples you can recreate the original soundwave.
Browsing one of our favourite electronic stores Sparkfun, I found a high-performance ADC board perfect to experiment with. A study of the datasheet and ten minutes of wiring later and we’re ready to roll – awesome; watch out Bang and Olufsen!
As with most things computer, hardware is only half the battle – we needed software to talk to our shiny new audio kit. Thankfully the majority of the hard work has already been done by the clever people over at the Pi community so it didn’t take long to create a compatible Linux kernel driver.
Finally I hit record, do my best roadie impression, and we have sound – success!
….Until – an email received back from John with the initial testing results. Arrgh! We’re getting the audio signal repeatedly dropping out in 10 millisecond intervals. Inconceivable!
Time to get my best debugging hat on. Connecting my trusty openbench logic sniffer to the audio data bus soon traces the problem back to a synchronisation problem between the Pi and the ADC, the digital equivalent of two left feet.
So a little hardware and software rejig later to run the ADC in “master” mode and we have the ADC and the Pi talking nicely. This solves the audio problems and we’re ready to feed our high definition audio into Cocoon’s signal processing brain.
So the next time something goes bump in the night – Cocoon will be there to keep its ears (and eyes) out for your safety.