Sound as presence detection

I saw on Kickstart a device that uses sounds sound detection to improve its “people presence detection” (as well as a more conventional pir)

What’s the cheapest way to sense sound for an imp, given in this app quality or accuracy is not important

@back_ache I was going add this to my PIR based monitor when I had a lot of false positives. I was going to sample sound via mic & amp to analogue In when PIR triggers. Most of my false triggers were at night. But have manged to eliminate them so far :slight_smile:


I’ve been analyzing sound with an Imp. I can detect different fingerprints using FFT. Average energy over time, or peak values. I can sleep while checking for energy every 20ms or deep sleep for 2 minutes or more at a time allowing the battery to last forever. The problem I found is all this is difficult while the fan is running nearby. It’s hot outside and I can’t turn it off! It blocks everything else even though it doesn’t sound loud to a human sitting nearby. I have found an amplified Mic module on Ebay for $5.

Using a variable resistor I can sleep until a sound wakes on Pin high. It’s fairly sensitive if you adjust the resistor. But it’s much more sensitive while it’s running code. A whisper from 50m triggers a function.

Are you doing the FFT on the device, in Squirrel?

I’ve done a bit of audio processing in software before - one thing you could look at trying is creating a really simple filter function for ambient noise:
1 - Have the user click a button, and then listen for a couple of seconds.
2 - Grab the average value of each frequency range.
3 - When you’re analyzing sounds in the future, reduce the frequency ranges from (2) by whatever the average value from (2) was.

This is going to be a really rough audio filter for background noise, but if you’re running in Squirrel on the device you probably don’t want too much heavy processing, and it might be enough to get you what you need :slight_smile:

That’s a great suggestion! I’m sure it will work for louder sounds. Unfortunately what I’m looking for is much softer. The solution is easier. Turn off the fan when testing! Even though it’s hot…

@sbright33 can you share your FFT? and would it work for following use case? I’ve built a wee imp robot with my 5yr old and she wants it to stop when she shouts “STOP!”

Shouting “STOP!” didn’t work for Robocop either, and he was a really expensive robot.

@mlseim very good, nor does my 5yr old! :slight_smile:

so then I’m alive, when the doorbell or telephone rings??