Very simple Raspberry Pi Radio

Discussion about my Wifi Radio project at http://mightyohm.com/wifiradio/ or my WL-520gU talk at NOTACON.
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Very simple Raspberry Pi Radio

Post by Schwabinger »

RaspRadio is working perfectly fine ... I use it daily.

But as it is only controlled with a remote, something is still missing: I want the good old "Radio Feeling" back where you have to use a dial to tune or to change the volume.

So I got myself a second Rasperry Pi and bought a cheap MCP3008 8 channel ADC.
Now by using a potentiometer I can tune through my playlist with about 20 Radio stations.

The way you connect the MCP3008 to the Pi is described here:

http://www.raspberrypi-spy.co.uk/2013/1 ... n-mcp3008/

More info will follow.

Schwabinger
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Very simple Raspberry Pi Radio

Post by Schwabinger »

Have a look at the working prototype of my new RaspRadio:

http://www.flickr.com/photos/rigasw/set ... 612312533/

It is operated with two pots and two push-buttons only. Both pots as well as the buttons are controlled by a MPC3008 ADC.

You tune the stations by turning the pot. Works very fast and feels like a real radio!

I am experimenting with battery / solar power: With 4 AA Eneloops you can run the radio for about 4:30.

Soon I will test the setup with a Pi version A which is supposed to use less than 50% of energy compared to model B.

The solar panel (which could actually house the Pi as well) is from:

http://cgi.cottonpickers.plus.com/~cott ... c9070d4d37

Schwabinger
andycrofts
Posts: 1
Joined: Sat Jan 04, 2014 10:37 am

Re: Very simple Raspberry Pi Radio

Post by andycrofts »

Hmmm.. the idea of annoucing the numbers (each '5' is a dash, each '1' is a dot...)
How about Morse code? If you only want numbers, it'll take 10 minutes to learn:
1: .-----
2: ..---
3: ...--
4: ....-
5: .....
6: -....
7: --...
8: ---..
9: ----.
0: -----
Doddle!
So, 29 becomes: ..--- ----.
Dog-easy to write a bit of code for the Pi in Python!
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Very simple Raspberry Pi Radio

Post by Schwabinger »

Cool idea! On the other side, it want to keep it as simple as possible. RaspRadio should be easy to use for everybody.

As demonstrated here

http://lifehacker.com/5994036/add-a-res ... spberry-pi
I added a reset button to my new radio.

So with pushing a button you can

- reset the radio when running
- starting the radio if it has been shut down previously.

Here are some new pics:

http://www.flickr.com/photos/rigasw/117 ... otostream/
http://www.flickr.com/photos/rigasw/117 ... otostream/

Cheers

Schwabinger
lfzguud
Posts: 1
Joined: Tue Feb 04, 2014 4:05 pm

Re: Very simple Raspberry Pi Radio

Post by lfzguud »

Gentlemen! Thank you so much for this conversation! I'm planning to gut this old RCA Victor radio (Little Nipper) into a RasPi internet radio.
http://www.flickr.com/photos/wpjma/12311496713/
Following your lead, it will repurpose the two buttons on the front for both tuning and volume. There will also be an infrared option and an LED screen on the back. Just ordered the RasPi and a few other parts - looking forward to build this! Again, thank you for the inspiration and for posting your progress!
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Very simple Raspberry Pi Radio

Post by Schwabinger »

RaspRadio Classic has two new features:

Headphone-Jack: When you plugin a headphone, the speaker will turn silent.
Switch for the battery powered amp: I often let the radio running, using the switch I stop the sound and prevent battery drain ...

From outside:
http://www.flickr.com/photos/rigasw/123 ... 612312533/

From inside:
http://www.flickr.com/photos/rigasw/123 ... 612312533/

The only thing I still would like to have is a new Sacher cake box ... to built it up again from scratch ... Might be the reason for a trip to Vienna.

Schwabinger
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Very simple Raspberry Pi Radio

Post by Schwabinger »

RaspRadio can talk to you now:


Making use of the text2speech link that is offered by google, a female voice now reads the number and the name of the station that is just playing.

Example:

If I just listen to the station "Radio swiss Jazz", and if I am not positive that this is really that station , pressing a button mutes the radio for an moment and then the voice says:

"Station 13 ..... Radio Swiss Jazz"

And then the radio starts playing again.

Depending on the name of the station either an english or german speaking voice is talking.

The text2Speech mechanism is described here:
http://blog.oscarliang.net/raspberry-pi ... like-siri/

My coding looks like that:

Code: Select all

#!/bin/bash
echo off

# Pause radio

mpc pause


# Read station number
POSITION=$(mpc -f %position%| head -1)


# Extract station name (TEXT) and language flag (e or d) from
# textfile "spokenlist".

TEXT=$(head -$POSITION /home/pi/scripts/spokenlist | tail -1 | cut -d "#" -f 2)
LANG=$(head -$POSITION /home/pi/scripts/spokenlist | tail -1 | cut -d "#" -f 3)


# according to the language flag the english or german text2speech
# modul is called.
# the voice says: "Station: 3 ... BBC World Service"

if [ $LANG == e ]; then
/home/pi/scripts/t2s_en.sh station $POSITION
/home/pi/scripts/t2s_en.sh $TEXT
fi
if [ $LANG == d ]; then
/home/pi/scripts/t2s_de.sh station $POSITION
/home/pi/scripts/t2s_de.sh $TEXT
fi

# start playing again

mpc play
That solution is certainly more convenient than the blinking led that I used to indicate the number of the current station.
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Very simple Raspberry Pi Radio

Post by Schwabinger »

I experimented a little with a rotary encoder - it was surprisingly easy.

Using a rotary encoder you can have a playlist of unlimited length: Turning the know in one direction plays the next station, turning the knob in the other direction plays the previous station.

The library that I used is desribed here:

http://guy.carpenter.id.au/gaugette/201 ... pberry-pi/

And my very simple test code is here (I only had to add the mpc calls ):

Code: Select all

import gaugette.rotary_encoder
import subprocess
import gaugette.switch
A_PIN = 7
B_PIN = 9
subprocess.call(['mpc', 'play' ])
encoder = gaugette.rotary_encoder.RotaryEncoder.Worker(A_PIN, B_PIN)
encoder.start()
while True:
    delta = encoder.get_delta()
    if delta==1:
      subprocess.call(['mpc', 'next' ])
      subprocess.call(['mpc', 'play' ])
    if delta==-1:
      subprocess.call(['mpc', 'prev' ])
      subprocess.call(['mpc', 'play' ])


~
Now I can browse through a playlist with about 400 radio stations ... which I extracted from here:
http://www.listenlive.eu/

Cheers,

Schwabinger
Post Reply