In the old days, spies eavesdropped on each other using analog radio bugs. These days, everything’s in the cloud. [Sebastian] from [Hacking Beaver] wondered if he could make a WiFi bug that was small and cheap besides. Enter the ESP8266 and some programming wizardry.
[Sebastian] is using a NodeMCU but suggests that it could be pared down to any ESP8266 board — with similar cuts made to the rest of the electronics — but has this working as a proof of concept. A PIC 18 MCU samples the audio data from a microphone at 10 kHz with an 8-bit resolution, dumping it into a 512-byte buffer. Once that fills, a GPIO pin is pulled down and the ESP8266 sends the data to a waiting TCP server over the WiFi which either records or plays the audio in real-time.
[Sebastian] has calculated that he needs at least 51.2 ms to transfer the data which this setup easily handles, but there are occasional two to three second glitches that come out of the blue. To address this and other hangups, [Sebastian] has the ESP8266 control the PIC’s reset pin so that the two are always in sync.
The main hurdle was using an SPI on the ESP8266 — every time the PIC attempted to hand off 512 bytes of data, the ESP would reset! After a number of different attempts, [Sebastian]’s solution was to bitbang the SPI, slowing down the transfer but without crashing. Result! We wonder how far he could push this with a little data compression before sending over WiFi.
The only question now is whether or not you need to start smashing any nearby speakers for fear of being listened to. Even if you manage that, there are still a few old-school methods to keep an ear out.