I wanted a self-contained internet radio with the following criteria:
- Reasonably compact/portable.
- Only required an external connection for power (i.e. wireless internet access).
- Simple controls for volume and mute-toggle.
The new raspberry pi 3 has built-in wifi so I went with that to avoid the extra hardware.
The main software I installed is mpd (media player daemon) and mpc (mpd controller).
For control I used a rotary encoder with momentary push-button - roate for volume control, push to toggle mute. I wrote a daemon to automatically run at boot which monitors the encoder and used the mpc API to control mpd.
Audio is output from the raspberry pi 3.5mm audio jack to a single speaker via a small amplifier module.
I prototyped with a breadboard until I got the code working and decided to make it permanent. I've been experimenting with some hobyist-level woodworking so decided to put it all in a wooden box, most of which is recycled pallet wood. I provided access to the ethernet and usb ports for alternative connectivity and the ability to play MP3s from a usb drive.
The main electronic components were sourced from Core Electronics:
- Raspberry Pi 3 CE00269
- Rotary Encoder + Extras ADA377
- Stereo 2.8W Class D Audio Amplifier - TS2012 ADA1552
- 20W 4 Ohm Full Range Speaker - XS-GTF1027 ADA1732
- Panel Mount 2.1mm DC barrel jack ADA610
- Rocker Switch - SPST (round) COM-11138
For the daemon code, I started with the work documented by Andrew Stine (http://theatticlight.net/posts/Reading-a-Rotary-Encoder-from-a-Raspberry-Pi/) which I modified for my purposes and then converted to a daemon to be run at boot. The final code I ended up with is on github (https://github.com/Clewsy/rad10d).