Published on: 15th January 2024
With the first orders placed and fulfilled I have some hardware to work with. There is the ESP32 dev kit and an MP3 module. That’s enough to be going along with, as I can add some wiring, program the ESP32 and just plug the MP3 module into some powered loudspeakers for the time being.
As luck would have it, there’s an example program available that streams from the internet and sends the data to the MP3 module for decoding. I couldn’t just copy and paste because (a) it had some extra features I didn’t need and (b) the code didn’t work anyway. But following some bug fixing I have something simple. And ‘simple’ is the whole point!
The code contained no functions for driving a display, so I had to add those. The needs are - guess what - simple, and I can use the display for debugging as I go. For instance it shows ‘simple internet radio’ when switched on, followed by messages when it tries and hopefully succeeds in connecting to the wifi. It then shows me its IP address before loading a station and displaying its name. There’s no clever scrolling at the moment so station names have to fit in the available space.
Changing station requires some sort of interaction; it seems obvious to set up a push button. I’ve got plenty of buttons (just as well as I’d forgotten to put them on the shopping list) so wired one to a spare GPIO pin on the ESP32 and tried to add some code to capture the press. This is where it really became clear that I don’t know what I’m doing because sometimes a button press would cause the ESP32 to crash and reboot. This low-level programming is very unforgiving and I’m not working all that ‘low’ just yet! I think I’ve sorted out how to interrupt the playback without breaking everything and can move between channels. There is a delay of up to a couple of seconds before the station changes but I can live with that.
And with this simple programming completed, it’s time to add the amplifier and speakers. On to part 3!