Raspberry Pi Internet Radio

Radio, but over the Internet..

As mentioned in my Grandmother Communicator Part 2 post, her radio streaming still hadn’t been set up. However, instead of adding streaming radio to her tablet, building a dedicated radio seemed much more fun..

Man, back in the day radios really had personality. (Photo credit)

Design Criteria

Here are the constraints that I applied to this project:

  • Needs to use home theatre surround speakers that I got for free.
  • All electronics to fit inside the speaker.
  • Powered by Raspberry Pi Official Power Supply.
  • Analogue volume control and instant audio playback.
  • Modular design with minimal glued down components

Free speakers, fun

Shopping List

Mantech KZN:

  • 3.5mm Stereo Plug Right Angle – Link
  • Impedance matching transformer x 2 – Link
  • Panel Mounted RCA Socket x 2 – Link

Mitabyte:

  • Astrum Mini OTG USB Cable 0.2M – Link
  • UGREEN USB Sound Card / Astrum 8CH 3D USB Sound Card – Link

DIY Electronics:

  • PAM8403 Mini 5V Digital Amplifier Board with Switch Potentiometer – Link
  • Knob for Encoder / Potentiometer – Link
  • Micro USB Power Switch Breakout Module – Link

PiShop:

  • Raspberry Pi Zero W – Link

Items from my toolbox:

  • DuPont Jumper Wires (Female to Female)
  • Heatshrink
  • Soldering Iron
  • Pliers
  • Wire Cutters
  • DuPont Crimping Tool
  • DuPont Headers
  • Veroboard
  • Power Switch

Initial Hardware and Software Setup

Follow the steps in this guide to get moOde up and running.

Use a set of headphones connected to the DAC to verify that the audio output works:

This lets us move onto the second part:

Radio Setup

Your speakers aren’t broken, it’s a silent video

Extras: If the radio doesn’t resume correctly on reboot, you can follow this link for a technical fix. Also, to make sure that the radio waits for the internet to resume (after load shedding, if you don’t have a UPS), add see this link to add a boot delay.

Main Hardware Setup

Rewinding to the constraints above, here’s how they informed my decisions :

  • Powered by Raspberry Pi Official Power Supply:
    • All electronics would need to operate within the 15W power budget and at 5V.
  • Analogue volume control:
    • I chose a specific PAM8403-based amplifier board because it came with a switch potentiometer.
  • All electronics to fit inside speaker:
    • Removed any covers etc to make the electronics as small as possible.
  • Audio starts playing the moment device is “switched on”:
    • Since the Pi requires time to boot up, connect to the WiFi and start streaming, it would actually be powered and connected the entire time. Only the amplifier would be switched on and off with the knob.
  • Modular design with minimal glued down components:
    • As far as possible, components used DuPont headers with jumper wires connected them. This allows for easy re-configuration or re-use.

Now it becomes a little less of a guide and more of an adventure..

Step one when it comes to donated hardware, strip it down and scrub scrub scrub with my toothbrush:

While that was drying, I set up the initial wiring diagram:

Mixed Analog and Digital Circuits, fun

And then took the components and built the first prototype :

Eureka, it actually works! And it all fits into the speaker:

But there were a few problems:

  1. When I clicked the PAM8403 on, the Raspberry Pi rebooted. It was definitely doing something weird (inrush current causing voltage drop? I don’t have an oscilloscope to check).
  2. There was an annoying high frequency sound present (Oh no).

And I wanted some enhancements:

  1. With only single-channel (mono) audio output, I was only using half the capability of the sound card and amplifier. Better to somehow make it stereo.
  2. I initially designed the power adapter to be non-removal (captive) because I didn’t want someone to connect a lower power adapter. However, it looked a lot less “product-like” without one.

Solving Problem 1

I ended up bypassing the switch on the potentiometer by bridging these contacts (shown in red):

Ignore that the pot is removed, it’s the only photo I have of the underside of the PCB.

Adding a separate on-off switch now made more sense.

Solving Problem 2

Ah yes, annoying high pitched noise in a mixed analogue/digital audio circuit with a common ground. I know at least two electrical engineers are reading this and they know exactly what the issue is. Without going too deeply into the weeds, I had to break up the circuit by either using an isolated DC-DC converter or an audio isolation circuit (made using Impedance Matching Transformers).

Adding Enhancement 1 & 2

I added an optional second passive speaker, connected to the first via an RCA Cable and a Micro USB port for power.

Revised Wiring Diagram

Taking all the above into account:

After a few revisions and some spraypaint, testing time:

Transformers soldered to veroboard and mounted inside, ready for final assembly:

All closed up, back of the main speaker on the left with the passive on the right:

And what the back of the system looks like all wired up:

Snazzy

Conclusion

It plays Radio Lotus, it’s an AirPlay speaker and it resumes correctly after load shedding!

However, it’s a bad product. That was immediately evident when I showed it to my grandmother and she was a bit confused that the volume control and power switch were on the back. Her eyesight and motor control are such that controls on the front make much more sense. I wanted hidden controls for aesthetics and had entirely forgotten about the needs of the end user. It was a reminder that any smart engineering is meaningless if the end user doesn’t have an optimal experience.

The Future

With the conclusion in mind, I guess I’m building another radio.. 🙂

If you have any questions/would like to share your experience with Internet connected radios, leave a reply below. To receive an email when I publish a post, subscribe here.

(Featured image remixed from this photo)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑