Audio, ADC and Raspberry Pi – oh my!

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.

Analog to digital sampling

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!

problems with the recording

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.

 

trace

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.

Sensing intruders through closed doors

We have been working with our cocoon development systems for a while. These powerful little devices are packed with a variety of sensors. One of the useful things we can do with them is to detect infrasound.

Infrasound is another term for low-frequency sound waves. Basically a note so low you can’t hear it (perhaps in the 0-20Hz range). They are useful to us because they are generated by any significantly-sized body moving in air (e.g. a human walking or a door opening) and also because of they way they move around a house.

When any wave fits through a gap it will spread out a bit, just like waves of the sea around rocks:

seawave_diffraction

How much it spreads out depends on the wavelength of the wave compared to the size of the gap. The bigger the wavelength, the more it will spread out. Very low frequency waves, such as infrasound, will spread out a lot. In effect this allows them to be transmitted around a building much more easily than the higher frequency sound we can hear.

For Cocoon, this means that we can detect things such as a door opening and human movement from another room in the same house – the waves generated travel around the house and through even the tiniest gaps beneath closed doors to our sensors.  We can process the infrasound signature in real time and use that as part of the input in our decision making process – deciding if there is something going on at home that you would like to know about.

The dreaded return – dealing with that ‘oh no…’ feeling.

It sounds like the title of a B-movie horror film and maybe it is. That moment which strikes dread into the heart of everyone… returning home from time spent away. Chilling in the sun, going to work, or returning from a night out with friends, the moment when you wonder what might meet you when you return home is something we could all really do without.

I’m writing this in the middle of a forest about an hour away from Warsaw, Poland where I’ve come to ‘switch off’, to get away from it all and despite being as close to one with nature as I’m ever likely to be I’m still within good cell reception… In the midst of a tech golden age, where even in the vast wilderness I can check Facebook, tweet, and stream music via Spotify, why can’t I check in with home and put my mind at rest? Better yet, why can’t my home check in with me?

Some time ago now over drinks the founding team of Cocoon asked the question ‘Wouldn’t it be cool if I could contact my home and find out what’s happening?’. If I’m being honest it was less of a question and more of a challenge to one and other. We wanted the home (our homes) to let us know that everything was okay and better yet only bother us if something was wrong, out of the ordinary and needed our attention. Having spent a lot of time travelling over the last few years many of us had become all too familiar with that nagging feeling which meant we’d probably left a window open or forgotten to renew our home insurance… [Seriously, sometimes people are people]. The idea that we could give everyone peace of mind and help them stay safe really was all the incentive we needed to put our heads together to make home security smart and simple.

Every problem has a solution. Nest helps make sure I’m not damaging the environment by throttling back on my heating while I’m staying late at work or catching up with friends. It’s great because I save money and I my life gets a little easier. The warm feeling of being eco-friendly is an added bonus as I’m also saving to get married and it means we can now afford a wedding cake 😉 A smarter home means a happier home life – not quite convinced? Take a moment to think about your own home…

Getting up in the middle of the night and creeping down the stairs baseball bat in hand is something we’ve probably all done (or Cricket bat if you prefer). Reacting to things that go bump in the night or that feeling of worry when you put the key in the door after time spent away is something we probably all could do without. Cocoon is designed to make your home a safer place, connected to you and smart enough to tell you everything is or isn’t okay at home – making your life easier and safer. With one smart device protecting your home you only need to check your smartphone to see that the noise that woke you up wasn’t an intruder (it could however still be a monster under the bed) so you can relax and get back to your 8 hours a night.

So what do you think – Next time you’re coming home from work or travel would you rather have a life with, rather than without Cocoon?

How to defeat a burglar alarm and my subsequent court appearance

The burglar alarm that came with my first house never recovered from the night I had to borrow a ladder to silence (destroy) the confused external siren when the controller when awry.  Neither did my relationships with the neighbours!

My troubled relationship with security systems continued at my first business (Donhost).  We won a court case against ADT after they failed to provide the contracted police notification service when our ADT alarm went off.

An alarm came with our current house too.  It’s batteries ran out years ago but my past alarm experiences and the inconvenient keypad meant we never set it anyway.  This year two burglaries on our street in one week spurred me into replacing it so I hit Google to research options.

To my amazement home security technology hadn’t changed since the 80s.  It was still the same old white boxes sold on the false premise that something useful will happen when they go off.  In reality, when they go off, the neighbours have a quick glance out the window and return annoyed to the sofa until its owner tires of setting it following the many false alarms.

A beautiful security product I’d want in my home, one I don’t have to set or have installed that would alert someone who cares when something real happens didn’t exist.   The seedling that would grow into Cocoon was born and a brainstorm in the West Riding pub with Colin and Nick set us on our way.

Oh and the answer to the “how to” in the title – you don’t need to, just go ahead and break in, nobody will take any notice of the alarm!