Acoustic Drone Detection On The Cheap With ESP32

We don’t usually speculate on the true identity of the hackers behind these projects, but when [TN666]’s accoustic drone-detector crossed our desk with the name “Batear”, we couldn’t help but wonder– is that you, Bruce? On the other hand, with a BOM consisting entirely of one ESP32-S3 and an ICS-43434 I2S microphone, this isn’t exactly going to require the Wayne fortune to pull off. Indeed, [TN666] estimates a project cost of only 15 USD, which really democratizes drone detection.

It’s not a tuba–  Imperial Japanese aircraft detector being demonstrated in 1932. Image Public Domain via rarehistoricalphotos.com

The key is what you might call ‘retrovation’– innovation by looking backwards. Most drone detection schema are looking to the ways we search for larger aircraft, and use RADAR. Before RADAR there were acoustic detectors, like the famous Japanese “war tubas” that went viral many years ago. RADAR modules aren’t cheap, but MEMS microphones are– and drones, especially quad-copters, aren’t exactly quiet. [TN666] thus made the choice to use acoustic detection in order to democratize drone detection.

Of course that’s not much good if the ESP32 is phoning home to some Azure or AWS server to get the acoustic data processed by some giant machine learning model.  That would be the easy thing to do with an ESP32, but if you’re under drone attack or surveillance it’s not likely you want to rely on the cloud. There are always privacy concerns with using other people’s hardware, too. [TN666] again reached backwards to a more traditional algorithmic approach– specifically Goertzel filters to detect the acoustic frequencies used by drones. For analyzing specific frequency buckets, the Goertzel algorithm is as light as they come– which means everything can run local on the ESP32. They call that “edge computing” these days, but we just call it common sense.

The downside is that, since we’re just listening at specific frequencies, environmental noise can be an issue. Calibration for a given environment is suggested, as is a foam sock on the microphone to avoid false positives due to wind noise. It occurs to us the sort physical amplifier used in those ‘war tubas’ would both shelter the microphone from wind, as well as increase range and directionality.

[TN] does intend to explore machine learning models for this hardware as well; he seems to think that an ESP32-NN or small TensorFlow Lite model might outdo the Goertzel algorithm. He might be onto something, but we’re cheering for Goertzel on that one, simply on the basis that it’s a more elegant solution, one we’ve dived into before. It even works on the ATtiny85, which isn’t something you can say about even the lightest TensorFlow model.

Thanks to [TN] for the tip. Playboy billionaire or not, you can send your projects into the tips line to see them some bat-time on this bat-channel.

DSP Spreadsheet: The Goertzel Algorithm Is Fourier’s Simpler Cousin

You probably have at least a nodding familiarity with the Fourier transform, a mathematical process for transforming a time-domain signal into a frequency domain signal. In particular, for computers, we don’t really have a nice equation so we use the discrete version of the transform which takes a series of measurements at regular intervals. If you need to understand the entire frequency spectrum of a signal or you want to filter portions of the signal, this is definitely the tool for the job. However, sometimes it is more than you need.

For example, consider tuning a guitar string. You only need to know if one frequency is present or if it isn’t. If you are decoding TouchTones, you only need to know if two of eight frequencies are present. You don’t care about anything else.

A Fourier transform can do either of those jobs. But if you go that route you are going to do a lot of math to compute things you don’t care about just so you can pick out the one or two pieces you do care about. That’s the idea behind the Goertzel. It is essentially a fast Fourier transform algorithm stripped down to compute just one frequency band of interest.  The math is much easier and you can usually implement it faster and smaller than a full transform, even on small CPUs.

Continue reading “DSP Spreadsheet: The Goertzel Algorithm Is Fourier’s Simpler Cousin”

Making A Spectrum Analyzer The Wrong Way On An ATtiny85

Everyone’s a critic, but it’s hard to argue with success. And that’s exactly what [agp.cooper] has with his ATtiny85-based spectrum analyzer devices.

The “normal” way to build a spectrum analyzer is to collect a bunch of samples and run a Fast Fourier Transform (FFT) on them all in one shot. As the name implies, the FFT is fast, and the result is the frequency components of the sampled data. [agp.cooper]’s “wrong” way to do it takes the Goertzel algorithm, which is used for detecting the intensity of a particular frequency, and scanning across the frequency range of interest. It’s a lot slower than a single FFT but, importantly for the ATtiny85 that he implements this on, it’s less demanding of the RAM.

Continue reading “Making A Spectrum Analyzer The Wrong Way On An ATtiny85”

Detecting DTMF Tones From Scratch

If you’ve ever wondered about the best way to detect dial and DTMF tones from a phone line, [Debraj] is your man.

[Debraj] built a DTMF detector using the Goertzel algorithm. Normally, when we think about detecting tones, we pull FFT out of our bag of tricks. The Goertzel algorithm isn’t as computationally complex as FFT and can be implemented on even the smallest microcontrollers.

For the build, the first thing to solder is a nice audio transformer and some protection diodes. The ring tone from a phone line goes from +35 V to -35 V – a bit more than a microcontroller could handle. A PIC18F4520 dev board was used as the brain of the system with all the code is available on [Debraj]’s site.

Although implementations of the Goertzel algorithm are a little uncommon, [Debraj] has seen a few interesting projects using this technique. [Debraj]’s build could easily be modified into a guitar tuner with a few changes in the code, for example.

This project was built as the command and control for a home automation system and from the video after the break, we can’t wait for [Debraj] to get annoyed at the phrase, “To turn on the kitchen lights, please press 1…”

Continue reading “Detecting DTMF Tones From Scratch”