Displayotron3000 Pi Radio

IMPORTANT UPDATE JULY 2015: The BBC has changed the way it streams network radio – see here for details. And Fip has moved to http://audio.scdn.arkena.com/11016/fip-midfi128.mp3

In the summertime I built a Raspberry Pi radio that I could control via a web interface from my phone, and got to musing about some kind of Arduino-type shield that could snap on to a Pi to turn it into a little internet radio with a display, a few buttons and a speaker.

Well, blimey charlie, imagine my surprise when I discovered something pretty darn similar already exists! The good people at Pimoroni make and sell the splendidly-named Displayotron 3000 (not sure if it is related to Andre). This sits snugly on a Pi’s pins and gives you a 3-line LCD display with 3 strips of variable RGB backlights, a 4 way mini joystick with centre-press and a strip of eye-wateringly bright (but dimmable) white LEDs for use as a bar graph. It even has its own radio module, and I’ve been testing it out.

In short, I love it. It does everything my imaginary radio gizmo did, apart from having a built-in speaker (how about it, guys?). It goes perfectly with Pimoroni’s Pibow Coupe case (pictured) – this is a half-height case that leaves GPIO pins and other gubbins accessible.

It took a bit of tweaking to get it working. I started with a fresh install of Raspbian, updated my Pi with
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

I then installed the files from https://github.com/pimoroni/dot3k:
sudo apt-get install python-dev python-pip python-smbus
sudo pip install dot3k
git clone https://github.com/pimoroni/dot3k

I couldn’t get it to work, and then discovered that I had a bit more work to do: namely enabling spi and i2c. Details on how to do that are here and here.

I then installed psutil, another requirement:
sudo apt-get install python-psutil

My previous Raspberry Pi radios have all used mpd/mpc to play radio streams, but this one uses VLC, and I’m impressed. I installed VLC and added some stations to the config file*, and bingo! a cool little internet radio with a colourful screen and a well-designed menu allowing you to browse stations, view CPU load and temperature, change the volume and a very cool clock with an optional binary display and time-sensitive dimmer.

It’s a great piece of work – Pimoroni and @gadgetoid should be very, very proud.

My wishlist for tweaks:
- an alarm clock
- display time and station name at the same time
- ‘now-playing’ track info, as per my web-based radio
- weather info
- a record function
- a built-in speaker!

Time to retire my PiRadio made with an Arduino-driven LCD display and buttons.

* the radio bit of my config file now looks like this (starting with the world’s greatest radio station, fip. Mais oui.)

[Radio Stations]
fip32 = fip bas debit,http://mp3.live.tv-radio.com/fip/all/fip-32k.mp3
fip128 = fip haut debit,http://mp3.live.tv-radio.com/fip/all/fiphautdebit.mp3
radio1 = BBC Radio 1,http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio1_p?s=1365376033&e=1365390433&h=a0fef58c2149248d6bff1f7b7b438931
radio2 = BBC Radio 2,http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio2_p?s=1365376067&e=1365390467&h=d43dc8ae0f888809462a6cb7c389b46b
radio3 = BBC Radio 3,http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio3_p?s=1365376123&e=1365390523&h=d53cf2a92272f3289b314a2251d23bc8
radio4 = BBC Radio 4,http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio4_p?s=1365376126&e=1365390526&h=ed9a0642b30c422b07fbcd8683c52335
radio4x = BBC Radio 4Extra,http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_he_radio4extra_p
radio5 = BBC 5Live,http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_5live_p?s=1365376271&e=1365390671&h=e0d82133f35ae74d41d5eab6b9c150a6
6music = BBC 6Music,http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_6music_p?s=1365376386&e=1365390786&h=de40a9915206c4402c73e3766dc3fec0
einws = BBC WS News, http://bbcwssc.ic.llnwd.net/stream/bbcwssc_mp1_ws-einws
nwpr = NWPR,http://69.166.45.47:8000
meat = MEATransMISSION,http://46.28.49.164:7184/
monocle = Monocle M24,http://radio.monocle.com/live
resonance = ResonanceFM,http://radio.canstream.co.uk:8004/live.mp3
purple = Purple Radio,http://uk1-pn.webcast-server.net:8184/
rte1 = RTE Radio 1,http://icecast2.rte.ie/radio1
share = Share Radio,http://tx.sharp-stream.com/icecast.php?i=shareradiorpmobilehigh.mp3

This entry was posted in Raspberry Pi, Raspbian, Uncategorized and tagged , , , , , . Bookmark the permalink.

14 Responses to Displayotron3000 Pi Radio

  1. Gadgetoid says:

    Ahoy! Thanks for the awesome write-up, and comprehensive install guide too. It was a really fun product to work with and write code for- most of your wishlist features are ones I’d love too. I’d say that no built-in speaker could come even slightly close to a good set of bookshelf speakers though, which are what I use with my setup. I might steal your radio list to update the GitHub config file with something other than chiptunes :D

    Keep up the hacking!

  2. Ray Leask says:

    Hi, thanks for a great site. After my stand alone Internet Radio blew up I thought I would get a Displayotron 3000 and give it a go. It arrived yesterday and I followed your instructions. Although I can use the various Python test scripts OK I cant get the radio.py script to work. What I get is the output below. It complains about an X11 initialization failure. I am a bit puzzled by this. I thought I would fire up X Windows and start the VLC GUI beforehand but it made no difference. I just wondered if you came across the same problem?

    Thanks, Ray

    pi@picamera ~/dot3k/python/examples/advanced $ sudo python radio.py

    VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
    VLC started with PID: 3432
    Attempting to connect to VLC
    Attempting to connect to VLC
    Attempting to connect to VLC
    Attempting to connect to VLC
    Attempting to connect to VLC
    Attempting to connect to VLC
    Attempting to connect to VLC
    Attempting to connect to VLC
    [0x1c5ad00] inhibit interface error: Failed to connect to the D-Bus session daemon: /usr/bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed.

    [0x1c5ad00] main interface error: no suitable interface module
    Attempting to connect to VLC
    Attempting to connect to VLC
    [0x1c5ad00] main interface error: no suitable interface module
    [0x1c4b8f0] main libvlc error: interface “globalhotkeys,none” initialization failed
    [0x1c5ad00] [cli] lua interface: Listening on host “0.0.0.0:9393″.
    Unable to connect to VLC
    Killing VLC process with PID: 3432
    bash: line 1: 3432 Killed /usr/bin/vlc -I rc –rc-fake-tty –rc-host=0.0.0.0:9393 > /dev/null

    • blogmywiki says:

      It does look familiar – Gadgetoid thinks some of those errors are normal, which may explain why I’ve seen them… what else happens on the screen of the Displayotron? Are you on the internet ok?

  3. Gadgetoid says:

    All of the errors listed above are actually perfectly normal, what I think is happening however is that VLC is starting up a little slowly and Python is giving up trying to connect too soon.

    You should be able to fix this yourself by changing the connection attempt parameters in the radio.py plugin.

    Open plugins/radio.py in your editor of choice, and find line 184, or “or attempt in range(10):” and change this to “or attempt in range(20):” so it tries a little harder.

    Good luck!

  4. Ray Leask says:

    Thanks for your replies. I tried altering the connection attempts to 20 but it made no difference. What I have found is that if I start VLC beforehand with the vlc.sh script then radio.py can make contact with VLC. But then I get a further error concerning the joystick module. See the output below. I think I am going to cut my losses and start with another fresh install of Raspbian.

    Thanks, Ray

    pi@picamera ~/dot3k/python/examples/advanced $ sudo python radio.py
    Found VLC with PID: 5705
    Attempting to connect to VLC
    Connection successful!
    Traceback (most recent call last):
    File “radio.py”, line 73, in
    @joystick.on(joystick.BUTTON)
    File “/usr/local/lib/python2.7/dist-packages/dot3k-1.8.0-py2.7.egg/dot3k/joystick.py”, line 33, in register
    GPIO.add_event_detect(button, GPIO.FALLING, callback=handler, bouncetime=bounce)
    RuntimeError: Failed to add edge detection

  5. Ray Leask says:

    Anyone know how to add a Reboot option to the radio.py menu? Every now and then the radio refuses to work and I have to pull the power to reset the thing. The memory card eventually got the hump with this by getting corrupted.

    Thanks, Ray

  6. Tony says:

    I have now added the shutdown and restart and ipaddress plugins.

    They were already available in graph.py in the plugins folder, all that was needed was to add them to radio.py

    here is my copy of the relevant section of radio.py

    import sys
    sys.path.append(‘../../’)

    import dot3k.joystick as joystick
    import dot3k.lcd as lcd
    import dot3k.backlight as backlight
    from dot3k.menu import Menu
    from plugins.utils import Backlight, Contrast
    from plugins.volume import Volume
    from plugins.clock import Clock
    from plugins.radio import Radio
    from plugins.graph import GraphCPU, GraphTemp, IPAddress, GraphSysShutdown, GraphSysReboot
    import time

    # We want to use clock both as an option
    # and as the idle plugin
    clock = Clock(backlight)

    “”"
    Using a set of nested dictionaries you can describe
    the menu you want to display on dot3k.

    A nested dictionary describes a submenu.
    An instance of a plugin class ( derived from MenuOption ) can be used for things like settings, radio, etc
    A function name will call that function.
    “”"
    menu = Menu({
    ‘Clock’:clock,
    ‘Radio Stream’:Radio(),
    ‘Volume’:Volume(backlight),
    ‘Status’: {
    ‘CPU’:GraphCPU(backlight),
    ‘Temp’:GraphTemp(),
    ‘IP Address’:IPAddress()
    },
    ‘Settings’: {
    ‘Contrast’:Contrast(lcd),
    ‘Backlight’:Backlight(backlight),
    ‘Reboot Pi’:GraphSysReboot(),
    ‘Shutdown Pi’:GraphSysShutdown()
    }
    },
    lcd, # Draw to dot3k.lcd
    clock, # Idle with the clock plugin,
    10 # Idle after 10 seconds
    )

    you will see I have added IPAddress, GraphSysShutdown, GraphSysReboot to the ‘from plugins.graph import’ line

    then added those plugins to the menu as follows

    menu = Menu({
    ‘Clock’:clock,
    ‘Radio Stream’:Radio(),
    ‘Volume’:Volume(backlight),
    ‘Status’: {
    ‘CPU’:GraphCPU(backlight),
    ‘Temp’:GraphTemp(),
    ‘IP Address’:IPAddress()
    },
    ‘Settings’: {
    ‘Contrast’:Contrast(lcd),
    ‘Backlight’:Backlight(backlight),
    ‘Reboot Pi’:GraphSysReboot(),
    ‘Shutdown Pi’:GraphSysShutdown()
    }
    },

    Hope this helps

  7. Greg says:

    hi, great setup guide, just got my displayotron up and running. Did you manage to get station name, song info and time / weather status displayed on the screen during playback of a radio stream? I used to have that feature with my mpd/mpc radio setup on 3×16 lcd. do you think it would be possible to have that done on this tiny but powerfull display?

    Greetings from Glasgow,
    Greg

  8. Ray Leask says:

    Looking at this web site again I see that I never said thanks for providing the code for the reboot/shutdown menu items. So – thanks for doing that!

    Ray

  9. Dan Allton says:

    Hi there,

    I am running the radio on a displayotron HAT and it works brilliantly; however, I am struggling to find the config file to add stations – Help

    DAn

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>