Make a Web-Radio for Less Than $15

6,766

46

5

Introduction: Make a Web-Radio for Less Than $15

So, I decided to do a project I've been postponing for a while:
A homemade, fully functional web radio, complete with amplifier and speaker, for under 15€!.

You can change between predefined streaming radio stations with the push of a button and you can control volume by rotating a nice potentiometer..

Step 1: Bill of Materials

  • ESP-WROOM32 based microcontroller board. There are actually at least two variants of interest with this microcontroller chip (see picture) - I used a WEMOS LOLIN32, which does not have an onboard button, because I wanted to use my own. If, however, you want to avoid as much soldering as possible, you can go for the other variant, which comes with a button and pins already soldered in place.
  • Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A. This minute board features a miraculous chip from Maxim Electronics which is both a DAC (Digital to Analog Converter) and a 3W Class D Amplifier! You feed it digital signal from your μcontroller and drive the speakers directly, no other circuits needed.
  • Speaker 4Ω/8Ω. I used a SHARP RSP-ZA249WJZZ L, 8 Ω, 10 W, a leftover Sharp TVs part, which I bought from an online surplus store.
  • Hollow bushing 5.5/2.1 mm
  • Linear Potentiometer 120Ω. This will not completely silence the radio when turned all the way down, but you get a very usable range of speaker volume using it.
  • Miniature Button (if you follow blindly this guide, make sure that the button you use is normally in off position, and on when pressed). You may also have to modify the source code to improve the button's behaviour (see software step). Skip this, if you have a microcontroller with a button onboard.
  • Fine wire (in various colors)
  • Heat-shrink tubing
  • Power-supply 5V with 5.5/2.1 output plug
  • Case . If you manage to find a speaker of similar surface dimensions to the one I used (11cm x 4cm), then you can print a case based on the stl file I provided. Otherwise, you can improvise: A cardboard, for example, would do the job perfectly!

You can go even cheaper, by

  • scavenging a speaker from discarded electronics (I did this in my first try and then looked for something better).
  • skipping the dedicated power-supply and the 5.5/2.1bushing, and just using the microcontroller's microUSB port and a phone charger. Be sure to connect 5V/GND of the microcontroller with the Amplifier breakout and also use a powerful enough phone charger.
  • skipping the dedicated button and using the onboard one.

This way, you can drop your costs to less than $10!

Step 2: Soldering the Electronics Together

You need some basic soldering skills to complete this step

Connect the power

Solder two wires on each of the 5.5/2.1 supply bushing's terminals. If you have different colors, it's not a bad idea to use red or brown for positive (5V) and black or green for negative (GND). This way, you always know which cable is voltage/positive and which is ground/negative.

Solder the other end of the cables to the ESP32 and the MAX98357A boards (see schematic).

Connect the ESP32 to the MAX98357A

as follows:

ESP pin ----------------- I2S signal
GPIO25/DAC1 --------- LRCK
GPIO26/DAC2 --------- BCLK
GPIO22 ------------------ DATA
Source: https://github.com/MrBuddyCasino/ESP32_MP3_Decode...

Miniature button

Connect the miniature button with the GPIO0 pin and GND. This is used to change between radio stations.

Speaker & Potentiometer

Connect the speaker output of MAX98357A in series with the speaker and the potentiometer.

Wrap up

After finishing, wrap everything up in heat-shrink tubing. Depending or how you plan to package your radio, you may even want to mask the back surface of the speaker with some masking tape, to avoid random electrical contacts.

Step 3: Software (--> Firmware)

The software for the web radio is already available here:
https://github.com/MrBuddyCasino/ESP32_MP3_Decoder

All you have to do is:

  1. Set-up the cryptic environment for ESP development called ESP-IDF.
    The setup process varies slightly, depending on your operating system. You can find elaborate instructions here:

    https://docs.espressif.com/projects/esp-idf/en/lat...
    It's not really user-friendly, but don't let that scare you!

  2. Download or (git clone) the source code from the address above.
  3. Configure the access to your WLAN:
    make menuconfig and enter your wifi credentials.
  4. modify the Web Radios list to your preferences:
    The playlist can be found at

    ESP32_MP3_Decoder/main/playlist.pls

  5. If you have connected your own button (as opposed to using a board variant with a built-in button), you may want to replace the file web_radio.c in ESP32_MP3_Decoder/components/web_radio/ with the one provided here. I have made some modifications to prevent multiple button press events from garbling up the web radio. At least this is what happened in my case with the unmodified code.
  6. upload the whole thing to your ESP32 μcontroller:
    make and then (if build shows no errors)
    make flash. In my case, make flash did not work, but when you run make, this suggests a command (something like python ~/esp/esp-idf/components/esptool_py/esptool/esptool.py bla bla), which should work in most cases.

Step 4: Finishing

Put everything in the case, taking care that no conductive surfaces touch each other. For this purpose, you can use heat-shrink tubing, PVC isolating tape or even a glue pistol. A glue pistol is also needed to fix everything in position. Do this after you have tested everything and know everything is working as expected!


That was it, enjoy!

Audio Challenge 2020

Participated in the
Audio Challenge 2020

Be the First to Share

    Recommendations

    • Toys & Games Contest

      Toys & Games Contest
    • Arduino Contest

      Arduino Contest
    • Box Challenge

      Box Challenge

    5 Comments

    0
    erboy
    erboy

    11 months ago on Step 3

    Hello,
    thanks for sharing this project. Is it possible to measure current consumption?
    I'm wondering if it could be powered by batteries. Thank you

    0
    techprolet
    techprolet

    Reply 11 months ago

    Hi, this is tricky.... Each multimeter I tested gave me different results :-)
    In any case: Since posting, I have configured MAX98357A for only 3dB gain instead of the default 9dB gain (see spec sheet in my answer to Heisenberg85).
    In this configuration and with the multimeter I trust the most, current consumption would range between 80-100mA. So I guess, yes, you could power it with batteries - especially with a pair of 18650s you would get many hours of music!

    0
    erboy
    erboy

    Reply 10 months ago

    Thanks for the comprehensive answer. I needed that. I will definitely start making this radio myself as soon as I get the components :)

    0
    Heisenberg85
    Heisenberg85

    11 months ago on Step 4

    Hi,

    what a nice project, i've voted that for the contest. I'm wondering if its possible to get that in stereo mode. I want to build that, but instead of a speaker i will use an audio jack bushing. I want to use this as an easy internetradio adapter for my old and not IoT speakers. Would be nice to get your thought about this.

    0
    techprolet
    techprolet

    Reply 11 months ago

    Hi, thank you for the nice comment and the vote!
    Stereo mode: Yes, it' possible. - you'll have to connect two MAX98357A in parallel and configure the one to decode the left channel and the other to decode the right channel. Have a look at the spec sheet here: https://datasheets.maximintegrated.com/en/ds/MAX98...
    So yes, you can use it to drive a pair of speakers, as long as they're 4Ω-8Ω and they're not active speakers. The catch here is, this being a Class D amplifier, you can't feed the output into another amplification stage (hence, no active speakers should be used).