User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

(Yet another) Vintage Pi-Radio

Sun Jun 19, 2016 6:26 pm

First off, I should say this is not a new idea. I'm aware that this has been done before (viewtopic.php?f=38&t=68167). This is just a summary of my own project.

The Background

This project came about because my current audio set-up in my kitchen which, while sounding great, did not score well on the wife acceptance front.

The Brief

To be acceptable, I needed a solution that:
  • Looked good (WAF tick)
  • Easy to use (WAF tick)
  • Satisfied all my music needs (radio, squeezeplayer etc.)
Seemed like a perfect project for a Pi.

The Idea

My plan was to get an vintage(-looking) Roberts radio, gut it and put in a Pi.

I got this off eBay:
Image

Hopefully that would satisfy the first part of the brief!

To be easy to use I figured a nice LCD plus a couple of rotary encoder dials should be sufficient.

For my music needs:
  • It needs to sound good
  • I need it to run squeezelite (for my multi-room audio sync set-up)
  • Loud (the Roberts only had 1 speaker, there's definitely space for 2!)
  • To be honest, that's enough for me!
The Parts

I bought the following:
  • Roberts Radio
  • 20x4 LCD display
  • 2x rotary encoders + oversized knobs (no giggling at the back!)
  • MAX98306 amplifier
  • 2x 4ohm 5W speakers
The Software

I figured it wasn't worth doing the hardware build unless I could get the software working first.

Using Raspbian Jessie as a base, I installed:
  • Squeezelite
  • Shairport-Sync (let people use this as an Airplay device)
  • Bluetooth audio streaming capability (to use radio as a bluetooth speaker)
  • MPD/MPC for internet radio playing
With all of that installed and working I then started on writing my interface.

I'd never used rotary encoders before but I found some useful code in the forum already (using Joan's pigpio module) which worked on the first attempt. Very satisfying.

Next up, I wrote a basic menu class (for those familiar with my posts on the forum, you'll know I do everything in python) which allowed for simple actions and submenus.

After that, I figured that making this radio extensible (I think that's a word) would be good. So each function (radio, squeezeplayer etc) would be a "mode" which means I could easily drop in new "modes" in the future if I needed.

Next was the display code. The idea was very simple, just show as much info as possible (time, menu, current playing track info etc.). Each "mode" has the ability to send information to the display.

I then wrote an eveloping bit of code to pull it all together and then wrote a systemd service to start the software on boot.

The Build

I realised had one big problem to overcome if I was going to get this to work: I needed to replace the top panel on the radio with a custom one that would house my dials and LCD. Douglas6 kindly suggested that I could get a custom piece laser cut pretty cheaply.

Armed with some digital calipers and spec sheets I designed a top panel for the radio and mount for the speakers and got these cut.Image

With that done, it was time to gut the radio:
Image

(One speaker...)
Image

The skeleton:
Image

I then built my top panel and was delighted to find that all parts fitted first time.
Image
Image

I then wired up the amp to the speakers on the custom panel and put them into the case.

I mounted the Pi on the inside cover.
Image

I used a Adafruit Perma-Proto Pi HAT for the wiring.
Image

The Result

Very happy.
Image

The Code

On Github: https://github.com/elParaguayo/PiRadio

The Future

Things to do/fix:
  • Only 1 speaker works at the moment (checked the wiring more times than I care to admit and I don't see a problem) - I suspect the amp is the issue.
  • Think about a dedicated DAC - the hiss from the Pi is off-putting (but only at low volumes)
  • Tidy up code and post on Github
Last edited by elParaguayo on Sat Jun 25, 2016 1:05 pm, edited 1 time in total.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
karrika
Posts: 1072
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: (Yet another) Vintage Pi-Radio

Sun Jun 19, 2016 7:18 pm

Cannot wait for the Github code. My wife has same complaints about our kitchen music player. Too complicated to use. Something with two rotary buttons is the way to go.

But I would probably go for an analog Car TV. They are cheap and easy to connect even to PiZero.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Sun Jun 19, 2016 7:21 pm

Give me a day or two to tidy it up and then I'll upload.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
Douglas6
Posts: 4781
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: (Yet another) Vintage Pi-Radio

Sun Jun 19, 2016 7:25 pm

Nicely done. So glad everything worked out.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Sun Jun 19, 2016 7:28 pm

Couldn't have done it without your help. Greatly appreciated.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
karrika
Posts: 1072
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: (Yet another) Vintage Pi-Radio

Mon Jun 20, 2016 5:31 am

What kind of rotary encoders did you use? Do they also sense pushing the rotary button?
Did you also implement some other push buttons using the vintage radio buttons?

Actually I have a vintage radio on stage (lower right) but I drilled two big extra push buttons for controlling the lights and sound during the show. The wires from the radio (blue buttons) go directly to DiscoHAT that sits on top of a RPi3 that controls all lights and sound of the play. Using the original buttons would have been more difficult.

Image

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Mon Jun 20, 2016 6:45 am

Nothing special. Rotary encoder with push button switch.
Image

I didn't use any of the existing buttons on the radio. I thought about it but decided it was going to be far too difficult for me!
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
LetHopeItsSnowing
Posts: 357
Joined: Sat May 26, 2012 6:40 am
Location: UK
Contact: Website

Re: (Yet another) Vintage Pi-Radio

Mon Jun 20, 2016 8:09 am

I think I used exactly the same rotary encoders in my radio build (http://www.stuffaboutcode.com/2015/05/r ... build.html) - KY040?

I struggled initially with the KY040 as it doesnt use the traditional gray code - my blog post about it is here http://www.stuffaboutcode.com/2015/05/r ... coder.html
"am I getting slower, or is stuff more complicated; either way I now have to write it down - stuffaboutcode.com"

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Mon Jun 20, 2016 8:43 am

Wow - that's a very impressive project. I've obviously got lots to learn!

That was an actual photo of one of my encoders so it wasn't mounted like your ones. This probably made my coding a bit easier than yours because I could just use Joan's code from here http://abyz.co.uk/rpi/pigpio/examples.html#Python code !

I think getting a decent DAC is probably the next step for me. Unfortunately I suspect that any DAC I get will use some of the GPIO pins that I'm already using so there'll be more rewiring for me to do. Didn't plan this very well...
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Tue Jun 21, 2016 8:56 pm

OK. The sound quality issue is not the 3.5mm output from the Pi.

I'm actually getting a horrendous amount of static/hissing even when the amp is not connected to the pi. It actually seems worse through a USB audio device.

Anyone got any ideas?

EDIT: Fixed this with a new amp.
Last edited by elParaguayo on Sat Jun 25, 2016 1:07 pm, edited 1 time in total.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Sat Jun 25, 2016 1:06 pm

karrika wrote:Cannot wait for the Github code. My wife has same complaints about our kitchen music player. Too complicated to use. Something with two rotary buttons is the way to go.

But I would probably go for an analog Car TV. They are cheap and easy to connect even to PiZero.
Code is now on Github: https://github.com/elParaguayo/PiRadio

Still need to get round to the installation instructions though!
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
Douglas6
Posts: 4781
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: (Yet another) Vintage Pi-Radio

Sat Jun 25, 2016 1:21 pm

I meant to ask: did you ever resolve the Bluetooth stuttering problem?

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Sat Jun 25, 2016 1:24 pm

Yes, I think so. It went away when I turned off the wifi. It was hard to do this when writing the code as I connect via wifi the whole time.

That said, it's not working at the moment (no sound at all) so I'll need to take a look again! more likely a bug in my code.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Sat Jun 25, 2016 5:12 pm

Douglas6 wrote:I meant to ask: did you ever resolve the Bluetooth stuttering problem?
Yes, bug in my code. Bluetooth working fine!
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
Douglas6
Posts: 4781
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: (Yet another) Vintage Pi-Radio

Sat Jun 25, 2016 5:38 pm

elParaguayo wrote:Bluetooth working fine!
But not at the same time as WiFi. That's disappointing.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Sat Jun 25, 2016 5:48 pm

OK - but I thought I read somewhere that they shared a chip/controller (I've probably got the terminology wrong) so that was to be expected. Is that not right?
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
Douglas6
Posts: 4781
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: (Yet another) Vintage Pi-Radio

Sat Jun 25, 2016 5:59 pm

They do share the same chip, but I don't think anybody expected them not to work together. Reports here seem to suggest that's the case however.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Sat Jun 25, 2016 6:06 pm

Ah well, that's a shame. Fortunately for me I don't need both at the same time.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: (Yet another) Vintage Pi-Radio

Fri Sep 23, 2016 12:53 pm

Very cool project - I must do this when I get time. Can you tell us more about the custom panels?
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: (Yet another) Vintage Pi-Radio

Fri Sep 23, 2016 3:30 pm

Plenty of those encoders on eBay but they state +5v - so no issues with the pi at 3v3?
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Fri Sep 23, 2016 5:35 pm

Obviously I didn't read the small print! Seem to work fine.

I'll answer your other question later.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Sat Sep 24, 2016 7:18 am

texy wrote:Very cool project - I must do this when I get time. Can you tell us more about the custom panels?
Texy
I originally wanted to see if I could use the original panel. However I quickly realised that was beyond my skill level so I decided it would be easier to get a new one.

I measured the existing dimensions. The bit that caused me concern was the thickness as I needed to get this right for it to be a snug fit (it's held in place by wooden panels inside the radio). We'll come back to this...

Next up I worked out what components I needed, an LCD and two rotary encoders. I realised that a 20x4 LCD would just fit as it was the same height. The height of the LCD from top of the display to the circuit was another key measurement as I didn't want it to protrude above the panel.

With help from this forum and from the amazing people at Pimoroni I found a company that would do small laser cutting jobs. Looking at their list of materials I chose the 3mm thick ply.

I was very lucky: the thickness of the panel was 12mm and the thickness of the LCD display was 9mm. 3mm was perfect for this.

I used a ruler and calipers to fine tune the measurements of all my components and then used Inkscape to draw these.

Top layer: small holes for the rotary encoders' dials (plus a smaller hole for the notch that stops the whole encoder from rotating) and a hole for the LCD display. I also cut larger holes at the edge for the screws for the LCD. The LCD would be mounted to the bottom two layers and would sit flush with the top layer so they wouldn't press against the radio case. You can see these in the pictures in the first post.

Middle layer: Large square for the rotary encoder body, hole for the LCD panel, screw holes to mount the LCD.

Bottom layer: As above but needed a small cutaway for the LCD pin inputs.

Three layers gave me my 9mm thickness so that the top of the LCD was flush with the top layer.

I then added another layer of wood at each end of the panel to bring it to the 12mm thickness needed for the panel to sit snugly in the casing.


I also made a separate panel for the speakers as I replaced the old, single speaker with two better ones. Again, this was a job of measuring existing dimensions and locations of screw holes, designing the new panel in Inkscape and adding holes for the speakers. Lastly I unstuck the metal grating from the old panel and stuck it on the new one.

Best project I've ever done. I would never have dreamt of doing something like this before but the whole raspberry pi thing has been a great source of motivation to learn new things.


Texy - I hope that answers your questions but ask away if you have more.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: (Yet another) Vintage Pi-Radio

Wed Sep 28, 2016 4:48 pm

Sorry for late reply - currently away in holiday. Actually what I meant was which company did you use for the laser cutting , costs, etc.
Also can you state the actual versions of the software installed too. Did you start with raspbian lite?
Cheers
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: (Yet another) Vintage Pi-Radio

Thu Sep 29, 2016 8:36 am

Ha. Silly me.

I used a company called "Zap! Creatives" (http://www.zapcreatives.co.uk/).

I downloaded the template and edited this in Inkscape.

Customer service was really excellent and they pointed out errors in my designs before giving me final quote.

The four pieces of plywood (that you can see in the first post) cost just under £15 in total to cut and then about another £5 postage. That seemed pretty good to me because it was quite a small job.

I'll have to look at software versions later but, yes, I started with Jessie lite.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: (Yet another) Vintage Pi-Radio

Mon Oct 03, 2016 8:11 pm

Hi,
thanks for that info about the laser cutting service - it should come in handy.
With help for your instructions I have the following installed :
- Bluetooth streaming - I am currently using a dongle with a Pi 2B
- shairport-sync
- MPC + MPD (untested)

Both the bluetooth streaming and shairport streaming are working from 'outside' of your python code.
At the moment I have not installed squeezelite as I don't think it will be used.
Hardware wise I have the following wired :
- 20 x 4 LCD - it looks the exact same version as yours (luckily I have some of these from left over projects/sales).
- 1 rotary encoder, connected as the 'menu' select
- wireless dongle
- temporary analogue audio connection to powered speaker.

So when I run the main.py code the LCD springs into life, states PiRadio and the time, starting up, and the volume level. Then after a few seconds, just PiRadio and the time. If I press the encoder switch, it attempts connection to the squeezelite server, which doesn't exist of course. I can't deselect squeezelite, and turning the rotary encoder does nothing. I need to check the encoder is working correctly.......


Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Return to “Graphics, sound and multimedia”