This is going to be pretty specific to a Greek audience, as it’s all based on a Greek meme video, but I’ll try to explain. Watch the video first so you know what I’m talking about while I describe it:
Two guys are driving on a road near a remote village in Crete, and the guy on the passenger seat is excited about the prospect of speeding around the turn. At some point, he exclaims “wow, what a turn, come on Giorgi!”, and Giorgis speeds into the turn and they promptly crash and tumble, with perfect comedic timing. (They were both unharmed, by the way, and their friends made a joke video commemorating the feat).
The idea
I recently saw the video, and thought it was pretty funny, so it was kind of stuck in my head. One day, while driving, I took a turn, and thought of the guy saying the phrase he became famous for, and then thought it would be funny if my car could, autonomously, encourage me in a similar way whenever I took a big turn. I realized that it would be fairly easy to detect turns, using an accelerometer, and I had a board that can play MP3 files off a MicroSD card, so I figured I’d cobble them all together and see if it worked.
I didn’t want to play the audio through the car’s speakers, I wanted the audio to come from somewhere inside the car, so I decided to use a speaker and bury it somewhere in my car’s insides, to pleasantly surprise any second-hand owner that might eventually buy the car, long after I’ve forgotten that this thing is in its bowels.
The build
I used an MPU-6050 accelerometer breakout board, it was really easy to connect it to an ESP8266, and with some sample code and existing libraries, I was quickly on my way to detecting turns. I used the X axis component of the accelerometer, as that’s the lateral acceleration component in the way I was planning to mount it, and wrote some code to detect whether I’m in a tight turn for longer than half a second.
If both those conditions are true, then a GPD2856A board is used to play the actual audio file. The GPD2856A is pretty convenient if you want to make an MP3 player, as it includes all the volume/play/pause/repeat/whatever controls you need for a standalone player, but pretty inconvenient if you just want to use a microcontroller to play an audio file, as the GPD2856A won’t interface with the microcontroller at all. All it does is play files in sequence (and in a loop) when it starts up, forever.
This wouldn’t do me any good, as I just want to play one file once, so I hooked it up to an N-MOSFET so I can turn it on and off with the ESP8266. When I want to play the file, I tell the MOSFET to turn on the entire board, and when I want to stop, I just tell it to turn off. This works decently, but the board has some timing issues that mean that it doesn’t always start playing from the very beginning of the file, but sometimes skips half a second at the start. This means that the “wow” at the beginning is cut off, which is less than ideal.
The way I fixed that is to simply insert half a second of silence at the start of the audio file. This means that I consistently get the whole phrase, but there’s a half a second delay, which might mess with my comedic timing while driving. I’ll have to test that and see, but, if it doesn’t work, my only other alternative will be to use an ESP32 and a proper driver.
The board plays over a fairly big speaker that my friend Agis salvaged from some twenty-year-old PC speakers he had, and it’s really loud. I thought the USB current wouldn’t be enough to drive any significant volume, but it’s loud enough to startle me the first time the audio played over the speaker.
Finishing everything off
After connecting the ESP8266, the accelerometer, the MP3 player, and the speaker together, the only thing that remained was an enclosure worthy of such a legendary device. I decided to not bother with that, and instead designed a simple square case, though I did emboss the immortal words all around it. I quickly printed the enclosure out, and after some creative glueing, lamenting that I had measured wrongly and it was 1mm too short to fit everything, and printing it again, the Strofara was complete!
You can see a photo of it to the right, it looks every bit as regal in real life as it does in that photo. On the middle bottom of the right face, you will notice the USB connector that powers the device (and also gives me access to the ESP8266 if I need to reprogram it).
Tada!
Of course, what would this post be without a taste of the actual, finished product, complete with audio? Just text.
Here’s a video demonstration, by yours truly, in Greek (you don’t really need to understand anything I’m saying, it’s all random filler anyway):
Amazing, isn’t it?
Epilogue
As with mostly everything else, the code is open source, though there isn’t really much code to speak of:
https://github.com/skorokithakis/strofara
If you have any comments or feedback, please tweet or toot at me, or email me directly.