[AN] Anup Narkhede

Programmer, Hobbyist, Jack of many trades, Master of some

Pi Shairport

| Comments

There are plenty of posts floating around to help you install and configure Airplay on a Raspberry Pi. This puppet recipe, based on shairport, simply automates the installation process for you. With just three steps, you can turn your Raspberry Pi into an Airplay speaker.


  • Raspberry Pi running raspbian wheezy
  • SSH enabled and connected to the network

Getting started

Once the Pi is booted, note down its ip address by looking at the attached device list on your router.

Step 1: Copy your public key to the Raspberry Pi to allow ssh login without a password (optional).

cat ~/.ssh/id_rsa.pub | ssh pi@<ip-address> "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

Step 2: Bootstrap raspbian wheezy by running the following script on the Pi.

curl -sSL https://raw2.github.com/railsbob/puppet-pi_shairport/master/bootstrap.sh | sudo bash

This will install all packages required to run the puppet recipe.

Step 3: Initiate a puppet run from your machine.

git clone git@github.com:railsbob/puppet-pi_shairport.git
cd puppet-pi_shairport
./puppet-run.sh <ip-address>

That’s it! The puppet run will install shairport and configure it to run on the boot. Reboot the Pi and you should see an Airplay logo on your iTunes status bar. Select ‘Shairport on raspberrypi’ and test the streaming by connecting a speaker to the 3.5mm audio port.

Mimo USB Monitor and Raspberry Pi

| Comments

Since past few weeks, I’ve been trying to put my Mimo UM-740 touchscreen monitor to a good use. Sounds old school, but yeah we are talking about pre-ipad age when I used it as a touch screen skypephone device.

Follow this tutorial to configure the monitor as a primary display for raspberry-pi. Although I have explained the steps against Nanovision Mimo UM740, they should work with any displaylink USB monitor.

My setup:

  • 7 port powered USB hub
  • RaspberryPi running raspbian wheezy
  • Mimo UM740 touchscreen monitor
  • Ubuntu 12.04 machine for kernel compilation

Step 1: Prepare SD card

  1. Setup SD card with raspbian wheezy
  2. Boot using a standard hdml monitor
  3. Using raspi-config, enable ssh server and disable the GUI mode on startup. This will enable us to work on it without a monitor.

Step 2: Compile Kernel with udlfb support

First, we need to enable Displaylink framebuffer support in the kernel. I have followed these steps to compile the kernel on Ubuntu 12.04.

2.1: Install dependencies

apt-get install git-core gcc-4.6-arm-linux-gnueabi

2.2: Symlink the cross compiler

sudo ln -s /usr/bin/arm-linux-gnueabi-gcc-4.6 /usr/bin/arm-linux-gnueabi-gcc

2.3: Checkout source code

mkdir raspberrypi
cd raspberrypi 
git clone git://github.com/raspberrypi/linux.git

2.4: Configure

cd linux
cp arch/arm/configs/bcmrpi_cutdown_defconfig .config
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- oldconfig
#optional#make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- menuconfig

Make sure that displaylink framebuffer support is enabled:

  1. Follow ‘Device Drivers’ > ‘Graphics Support’ > ‘Support for Framebuffer support’.

  2. Enable ‘Displaylink USB Framebuffer support’ by selecting ‘M’.

2.5: Compile

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -k -j3


Step 3: Replace kernel.img on SD card

Once compilation is successful, package the kernel image:

mkdir ../modules
make modules_install ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- INSTALL_MOD_PATH=../modules/
cd ../tools/mkimage/
./imagetool-uncompressed.py ../../linux/arch/arm/boot/Image

This will create kernel.img in the current directory. Mount the SD card and replace existing kernel.img with the one which we just built.

Connect the monitor through a powered USB hub and reboot the pi. If everything has gone well, you should see a green screen.


Connect to ethernet & check if monitor was detected correctly:

$ dmesg | grep DisplayLink
usb 1- Manufacturer: DisplayLink
udlfb: DisplayLink nanovision MiMo - serial #USM700-8B280858
udlfb: DisplayLink USB device /dev/fb1 attached. 800x480 resolution. Using 1504K framebuffer memory

You should see two framebuffer devices, one for the hdmi adapter (fb0) and other for the USB monitor (fb1).

$ ls /dev | grep fb

Step 4: Configure Xorg

Using ssh, create /etc/X11/xorg.conf on the pi using following configuration:

Section "Device" 
  Identifier "uga" 
  driver "fbdev" 
  Option "fbdev" "/dev/fb1" 
  Option "ShadowFB" "off"

Section "Monitor" 
  Identifier "monitor" 

Section "Screen" 
  Identifier "screen" 
  Device "uga" 
  Monitor "monitor" 

Section "ServerLayout" 
  Identifier "default" 
  Screen 0 "screen" 0 0 

Start the GUI mode using ‘startx’ and you are done!

Raspbmc and Wifi

| Comments

In this post, I share my experience with raspbmc and making it work with a wifi dongle. If you are looking to get rid of ethernet cable and keyboard, make the xbmc stand alone and control it using the web remote, this post is for you.

Bear in mind that not all wifi dongles have supported drivers for debian. As a safe bet, pick one from the list of verified wifi adpaters. I used Tenda W311U wireless adapter as it is well tested with debian and comes at a decent price.

To install the supported drivers, you’ll need to access the terminal on raspbmc. Follow these tips to switch between terminal and xbmc.

To Access terminal from xbmc

Click on Power icon, Exit. When the splash screen comes up, press escape. You will be shown a login prompt. Use login: pi, password: raspberry.

To Launch xbmc from terminal

%sudo initctl start xbmc

Install drivers

Once you are logged on to the terminal, update sources for aptitude and install drivers by following steps below:

%sudo nano /etc/apt/sources.list

add line:

deb http://ftp.uk.debian.org/debian/ squeeze main non-free

Then install the driver:

%sudo apt-get update
%sudo apt-get install firmware-ralink

Check device status:

%nmcli dev
eth0   802-3-ethernet  connected
wlan   802-11-wireless unmanaged

Scan for wifi access points:

%nmcli dev wifi list

You should see a list of available wireless access points.

Configure the wireless network interface

Once you have the device drivers installed, you need to configure the network interface.

%sudo nano /etc/network/interfaces

Add following lines:

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf

Create the wpa.conf

%sudo nano /etc/wpa.conf

Add following lines:

pairwise=CCMP TKIP

Note: Replace NETWORK_SSID and NETWORK_PASSWORD with the wifi credentials.

Disconnect ethernet and run:

sudo ifdown wlan0
sudo ifup wlan0

You should be connected. Now test the connection status (ex: ping google.com).

Enable wifi connection after reboot

If you want to set the wifi as default connection after power on, follow these steps.

%sudo nano /etc/init.d/wifi.sh

add content:

sudo ifdown wlan0
sudo ifup wlan0

Make it executable and register:

%sudo chmod +x /etc/init.d/wifi.sh
%sudo update-rc.d wifi.sh defaults 100

Every time the raspbmc boots up, it will automatically connect to the configured wireless access point.

Bye bye keyboard

Xbmc comes with a web interface, this allows us to control it without a keyboard. Just hit http://:8080/ from your ipad or laptop and start controlling. You can even use the official xbmc remotes for apple and android which are much better.

Nice, now you can have a standalone media center connected using wifi.

Raspberry Pi: Getting Started

| Comments


After a wait of over 4 weeks, I finally received my raspberry pi from RS components. This tiny motherboard comes with a great number of features for a modest price of 30£ and is already being considered as a hacker’s paradise. Getting started with Raspbian ‘Wheezy’ was simple, thanks to the quick start guide. However, I came across raspbmc, which is a minimal distribution of debian linux with xbmc pre-configured and optimized for your raspberry pi. This blog post is about my experience to get raspbmc up and running.

My setup:

  • Scandisk SD card
  • My HTC desire charger to power the board (you can even use an iPad charger)
  • HDMI to DVI-D adapter, to connect my BenQ monitor
  • Speakers
  • Ethernet cable
  • USB keyboard

Unlike Wheezy, raspbmc doesn’t come with a complete bootable OS distrubution. Instead, it provides an installer images which requires a working internet connection to download and configure the OS.

Configuring SD card with the installer is simple. Insert the SD card and run:

wget http://svn.stmlabs.com/svn/raspbmc/testing/installers/python/install.py
sudo chmod +x install.py
sudo python install.py

Proceed with the on screen instructions and select the SD card (for me it was disk1s1). Once it finishes, you’ll see a message ‘Raspbmc is now ready to finish setup on your Pi, please insert the SD card with an active internet connection.’.

Plug the SD card in the pi and power it up. It starts with downloading and installation of kernel modules & libraries, and it reboots. For some reason, the pi wouldn’t come up after the reboot. As suggested by the good eggs from internet, I replaced the bootcode.bin on the SD card with this version and then it booted properly.

Next, I was stuck at the following message:

Raspbmc Updater
Downloading a new XBMC build.. (stuck at 21%)

Turning the power off and on fixed it (Worked in the 3rd attempt).

And here’s my raspberry pi running xbmc!