Archive

Archive for December, 2012

Raspberry Pi Internet Radio

December 22nd, 2012 subogero 2 comments

I’ve mentioned already that the Raspberry has become a rather integral part of my flat. And now I mention that I’m a great consumer of ska, reggae, soul, house, samba, sambass, funk and liquid funk.

And that’s where internet radios come into the picture. But it’s been so awkward so far. Hook up the phone to the stereo’s AUX cable? Start an entire desktop session on a laptop to play them in a browser and hook it up to the stereo’s AUX cable?

But now the Raspberry is in place, and it’s permanently connected to both the TV and the stereo. So I had to find a way to play internet radio stations from the command line. The internet did not reveal definitive answers, so I wrote a little Perl program.

It does some data-mining on www.internet-radio.com and presents an extremely simple interactive command line interface to choose genres and stations, start playback on the audio-jack or on HDMI, to play or pause, to quit or quit but continue playback in the background.

It’s very easy to use. I ssh sometimes into the Raspberry to change the station, and then it plays LiquidBass.net or something else all day long.

It’s called rpi.fm. Please find it on GitHub.

I tested it on Raspbian Wheezy. It uses omxplayer for playback. Important: the user must be in the “audio” group. The default user “pi” is, for new users edit /etc/group as root:

audio:x:29:pulse,pi,youruser

Next project: web-app for the same thing. And then the phone can be used as a remote control.

Raspberry Ping

December 10th, 2012 subogero Comments off

My long awaited Raspberry Pi has arrived about 2 weeks ago. I’ve ordered some accessories along with it, like an SD card, a HDMI cable and a power supply. What was missing though, was any kind of input device. I flashed the Raspbian image to the SD, hooked it to the TV and go.

It booted! And then waited hopelessly for me to log in.

Fortunately my flat has built-in Ethernet everywhere, so I connected the Pi, and tried to ssh into it from an Ubuntu laptop. Success! I typed “startx” and an orphaned LXDE session popped up on the TV. Rather useless without a mouse.

But then I remembered the so called X-server, which has to be the largest program that does nothing for you according to Ken Thompson. Except that it does. Unix GUI programs don’t talk to the screen/keyboard/mouse directly, but through an X-server that handles these. And my Ubuntu had one already running. And the GUI-X communication can run over a network as well. So…

foo@bar$ ssh -X pi@raspberry  # ssh into the RPi allowing X communication
pi@raspberry$ lxsession       # start an LXDE desktop session on the RPi

and what popped up was the proof for the superiority of this weird, unfriendly, minimalistic thing called Unix:

Ubuntu & Raspberry on same screen

Ubuntu & Raspberry on same screen

Ladies and gentlemen: 2 full desktop environments running on 1 screen! And that was it for the first weekend with the Pi.

For the second weekend, I bought some more accessories: Logitech K400 wireless keyboard with built-in touchpad, 1 TB USB hard-disk and a powered USB-hub. Time to build my low-power home server. Built into the hidden recesses of my desk.

Home server

Home server

Then I turned my USB printer into a network-printer installing CUPS on the Raspberry. The last adventure so far was setting up an FTP-server on said fruit. Vsftpd. VS probably means very secure, which usually stands for totally unusable. And yes, it was a bloody nightmare to set up. At the end it turned out you have to comment out nearly all lines in the bloody /etc/pam.d/vsftpd file. Oh well.

Linux desktops on a desktop

Linux desktops on a desktop

Categories: Uncategorized Tags: , , ,