ESP8266 As A Networked MP3 Decoder

Support libraries, good application notes, and worked examples from a manufacturer can really help speed us on our way in making cool stuff with new parts. Espressif Systems has been doing a good job with their ESP8266 product (of course, it doesn’t hurt that the thing makes a sub-$5 IOT device a reality). Only recently, though, have they started publishing completed, complex application examples. This demo, a networked MP3 webradio player, just popped up in Github, written by the man better known to us as Sprite_tm. We can’t wait to see more.

The MP3 decoder itself is a port of the MAD MP3 library, adapted for smaller amounts of SRAM and ported to the ESP8266. With a couple external parts, you can make an internet-connected device that you can point to any Icecast MP3 stream, for instance, and it’ll decode and play the resulting audio.

What external parts, you ask? First is something to do the digital-to-analog conversion. The application, as written, is build for an ES9023 DAC, but basically anything that speaks I2S should be workable with only a little bit of datasheet-poking and head-scratching. Of course, you could get rid of the nice-sounding DAC chip and output 5-bit PWM directly from the ESP8266, but aside from being a nice quick demo, it’s going to sound like crap.

The other suggested external IC is an SPI RAM chip to allow for buffering of the incoming MP3 file. WiFi — and TCP networks in general — being what they are, you’re going to want to buffer the MP3 files to prevent glitching. As with the dedicated DAC, you could get away without it (and there are defines in the “playerconfig.h” file to do so) but you’ll probably regret it.

In sum, an ESP8266 chip, a cheap I2S DAC, and some external RAM and you’ve got a webradio player. OK, maybe we’d also add an amplifier chip, power supply, and a speaker. Hmmm…. and a display? Or leave it all configurable over WiFi? Point is, it’s a great worked code example, and a neat DIY device to show your friends.

The downsides? So far, only the mono version of the libMAD decoder / synth has been ported over to ESP8266. The github link is begging for a pull request, the unported code is just sitting there, and we think that someone should take up the task.

Other Resources

In our search for other code examples for the ESP8266, we stumbled on three repositories that appear to be official Espressif repositories on Github: espressif, EspressifSystems, and EspressifApp (for mobile apps that connect to the ESP8266). The official “Low Power Voltage Measurement” example looks like a great place to start, and it uses the current version of the SDK and toolchain.

There’s also an active forum, with their own community Github repository, with a few “Hello World” examples and a nice walkthrough of the toolchain.

And of course, we’ve reported on a few in the past. This application keeps track of battery levels, for instance. If you’ve got the time, have a look at all the posts tagged ESP8266 here on Hackaday.

You couldn’t possibly want more resources for getting started with your ESP8266 project. Oh wait, you want Arduino IDE support?

Thanks [Sprite_tm] for the tip.

Tube radio husk gets a web radio transplant

[Dominic Buchstaller] found this German Greatz tube radio at a flea market. It only cost him about €35 and was in a bit more rough condition than the finished product you see above. He also found that a portion of the original circuitry was missing, making it completely non-function. He cleaned up the case to improve the wife-acceptance-factor, and outfitted it with hardware to make it a web radio.

Adding modern speakers was pretty easy as he was already replacing the original cloth bezel which has several holes and tears in it. A set of elements from some Logitech computer speakers served as the organ donors for this step in the process. As he was trying to keep a stock look he came up with a really neat hack to use the original knobs. The station select happens to have a large metal wheel on the inside which is about a centimeter wide. [Dominic] used the optical sensor from a mouse to monitor the turning of the dial by aiming the sensor at this wheel. Internet connectivity was provided by a wireless router he had on hand. This way he can stream music or play from an SD card he also used in the retrofit.

Putting the BBC in Seattle

radio

Among great British traditions, there’s tea, knowing how to lose an empire, tea, Parliament, big ben, tea, incalculable wit, Parliament, big ben, tea, and BBC radio. While Britons in foreign lands may not be able receive BBC radio over the airwaves, there is the remarkable BBC iPlayer that allows online streaming of all those awesome BBC radio stations. Unfortunately, moving away from the Prime Meridian means the BBC radio schedule deviates from the schedule ordained by divine right. In Seattle, for example, a Friday evening comedy would be broadcast in the middle of the afternoon. Basically, it’s like listening to  Prairie Home Companion on Saturday morning. It just feels wrong.

[Adam] came up with a clever solution to this problem. Yes, it’s really just a Raspberry Pi-powered web radio, but there’s a twist to this build: everything from BBC radio is buffered and time shifted. A program that airs at noon in London will now play on [Adam]’s radio at noon in Seattle.

The hardware portion of the build is an exceedingly British radio which [Adam] deftly modified to include an auxiliary input. The software portion of the build uses ffmpeg, mplayer, and a PHP script to stream the iPlayer audio to a file, wait 8 hours (or whatever the offset from GMT is), and start playing the audio.

In the end, the time shifted BBC radio works perfectly, and even caught the attention of a few people at BBC Radio 4. [Adam] was interviewed about his project, and was even able to listen to his interview several hours later.

Turning a tiny router into a webradio

tplink

While the hacking zeitgeist is focused nearly entirely on all those new ARM dev boards that include the Raspberry Pi, some people out there are still doing it old school by modifying existing electronics to suit their needs. [Peter] picked up one of those very inexpensive TP-Link 703n wireless routers we’ve seen before and modified it into a standalone web radio, complete with volume and tuner knobs.

The TP-Link 703n is a wireless router smaller than a credit card available from the usual Chinese resellers for about $20. Able to run OpenWRT, this very inexpensive piece of hardware can be transformed into a device comparable to the Raspberry Pi; a complete Linux system with a few GPIO pins.

[Peter] took his 703n router and added an ATtiny85 connected to two pots and the internal UART. This, along with a script to read the values from the pots, tells the router what station to tune into and what volume to play it. The audio is handled by a USB soundcard with an internal speaker, making [Peter]’s build one of the smallest purpose-built Internet radios we’ve seen.

You can see [Peter]’s radio in action after the break.

Continue reading “Turning a tiny router into a webradio”