Installing Raspcontrol

I subscribe to a lot of Blogs for the Raspberry Pi.
The newest post that I came across was Jacob Clark’s Raspcontrol.

He’s developed a web-based control panel for headless Pis, so you can see what Pi is doing remotely without going anywhere near a sh terminal or VNC!


  1. First of all, you will need to be running your Pi off of a decent sized SD card. I’d recommend 8GB+, but you can probably get away with 4GB. You’re going to be turning your Pi into a web server, so you need to install a few packages.
  2. I use WiFi, but as long as your Pi is connected to your network, these instructions should work.
  3. Turn your Pi on, connect a terminal to it (I use Putty) or plug a keyboard in.
  4. Login as the pi user.
  5. Go to the GitHub repository for Raspcontrol
  6. First of all (following the installation instructions at GitHub) install Apache 2 and PHP-5:
    1. sudo apt-get install apache2
    2. sudo apt-get install php5
    3. These take a while and are quite large, hence the recommendation for a decent size SD card.
  7. cd /var/www
  8. sudo mkdir raspcontrol
  9. cd raspcontrol
  10. wget
  11. This will download the .zip file containing the Raspcontrol code. It will be called ‘master’, so you need to give it the proper extension.
  12. mv master
  13. unzip
  14. This will give you a folder starting with Bioshox…
  15. You must add the Apache user “www-data” into your sudoers file, which means they can run Superuser Commands. To do this from the shell type ‘sudo visudo’ scroll to the bottom of the file and on the last line add:
    1. www-data ALL=(ALL) NOPASSWD: ALL
  16. Okay, we now need to remove the file:
    1. rm
  17. And move everything from the Bioshox folder into the current /var/www/raspcontrol folder.
  18. (This is a pain, really, but never mind)

Let’s go a-webbing

  1. On your laptop, with a browser, go to http://<the ip address of your Pi>/raspcontrol
  2. You _should_ get the Raspcontrol login screen:
  1. Now go to http://<ip>/raspcontrol/setup.php
  2. You now get a very bare HTML form asking for a password. This is the password you will use on the login screen you saw a minute ago. So, enter a decent password and click the button. This will return you to the login screen.
  3. Login using username “admin” and your password.
  4. You should now see the dashboard!

Install complete!

New update
As I was writing this, I noticed a new update for Raspcontrol
So, first I did:

  • cd /var/www
  • mv raspcontrol raspcontrol_0.1
Then, I got the new sources from github:
  • wget
  • mv master
  • unzip
  • mv Bioshox…. raspcontrol
This means your raspcontrol folder and URL now contains the new code and dashboard. Use the same username/password as you did the first time.
Nice GUI update, and some new bits and pieces! Good job, Jacob.

The Raspberry PiPod – version 1 – finished!

I’m calling an end to Phase 1 of the PiPod project. I have a working device and all the project aims have been completed.
There is a second Phase, but I need to get a couple of parts before I start doing that.

The original post showing the components of the PiPod can be found here.

Some photographs of my “PiPod”

So, this is it, the PiPod. As you can see, it’s a self-contained unit built around a small Really Useful Box. On top, you can see the 3.5″ car rear view monitor. This is held in place with friction from four screws and bolts. It was pretty secure in there, but I added some joined cable ties to reinforce the ‘holder’.
You can see the wires for the screen, including the power inlet (the red thing). You can also see the Belkin WiFi dongle connected using a small USB extension lead so it can be attached to the box.

This is a view of the side of the PiPod showing that I’m using the composite video output to connect to the screen. The white socket is a spare input for the screen, which I’m not using. You can see on the right a Velcro loop that I use to hold the power cable so it doesn’t drop off the table when disconnected. You can also start to see how the Pi is held in place inside the box… Cable ties again.
I hand-cut (with a craft knife) two holes for the sockets that side.

This is an end-on view showing the hole I cut out for the power cable. I know, it’s all a bit rough, but it was fun!

The other end of the PiPod showing the opening for the LAN port and the USB ports. You can just make out the nano Bluetooth adapter. One of the big problems with the Pi is that if your USB device plug is a bit on the large side (or the case of the device is) then it becomes very difficult to fit two plugs in, one on top of the other. That’s why the extension cable came in handy – it was short enough not to lose too much power and meant that the USB port didn’t get damaged.

This is the underneath of the Pi – you can see the SD card and the cable ties. Messy, but it works well.

I love my little flip-up screen! I could take it out of there and mount the screen direct to the lid of the box, but I don’t want to damage the screen by prising it out. It’s nice to have the built-in screen protection anyway.

And the top comes off… I needed to make sure that I could still get the SD card in and out, but to have it inside the box (rather than sticking out, which is how most of the ‘professional cases do it. It’s a bit fiddly, but with the cable tie going diagonally across, it’s still accessible. I cut a few of the small bits of the outer part of the box away so that the cable ties laid in the ‘grooves’ on the corners. I am covering the HDMI port here, with the USB dongle, but made it so you could remove the dongle.

View from the other side.
And it all works! I would’ve put a video up, but forgot to bring the power cable in today.
Speaking of power, the whole thing runs off two power cables – one for the screen (12V) and one for the Pi (5V). I would at some stage like to get the whole lot running off battery, but I think that might be a lot of expense just for this project, which does everything I wanted it to anyway!

In terms of power, the WiFi dongle is slightly underpowered, but my experiments with a powered USB hub were hit-and-miss and I didn’t want to buy another one. It connects to my home and work WiFi nicely anyway.

The last part of recording this project will be a video showing boot-up, X-desktop operations and using the Rii keyboard/touchpad. That’ll be tomorrow!

Raspberry Pi emulation

Taking a quick break from my PiPod project, which is essentially done, bar photos and videos of it actually working!

I’ve decided that having a “virtual Pi” would be handy so that I can mess about with the OS without worrying too much! Plus, it means I don’t have to carry my Pi around with me all the time if I just want to try some Python etc out.

Important note:
For Windows users, it seems that the recommended solution for emulating the Pi is to use qEmu on Windows. Take a look at this Sourceforge project: Raspberry Pi Emulation in Windows.

Virtual Box

Just so you know what you’re installing on your main computer… VirtualBox is a wonderful, free, virtual computer creator and viewer. There are a variety of platforms it works on. I’m actually using a version I already have on my Windows 7, 64-bit machine.

Emulating the Pi

I’m referencing this guide from the Southend Linux User Group to a certain extent. I know, random, but that’s what Google came up with!
I should say before we begin that I’ve tried both the ‘Lenny’ and ‘Sarge’ Debian installs available from and neither of them worked (Lenny stopped at “Select and install software”, Sarge gave a rather horrid “Kernel panic”) hence I now use the official Debian site download instead!
  1. Download VirtualBox for your platform.
  2. Download a net install ISO image from itself.I’ve chosen the i386 small CD in the top-left area. 191MB to download…
  3. Create a new machine on VirtualBox, take the defaults, choose to create a new disk for it.
  4. Start the machine up.
    1. You get the first-time start-up dialogue.
    2. Choose to boot from the ISO image you downloaded.
    3. Choose your language/country etc. Let it run for a bit.
    4. Now, this installer looks very similar to the one that stopped on the Select and Install Software dialog, so hopefully it’ll work better than that one!
    5. Take the defaults all the way through, no need to be picky unless you want to. Set the root password, create a new account, set that password…
    6. Use the guided partitioning mode at the top.
    7. Choose to put all the files on one partition and write the changes to the disks.
  5. Off it goes, partitioning away, installing the ‘base system’. This is where it starts extracting the downloaded packages and going off to download and install the rest of the OS.
  6. This is going to take a while, I can tell!
  7. Now we’re onto ‘Select and Install Software’… Holding my breath…Ooooh. It’s gone to 12% and still running… This could be good. Yep, “Retrieving file” counter still running… Goooood.
  8. Choose the options you like. I just left it as a ‘GUI’ and the recommended/default options.
  9. Some time later…
    Yes, I think I will install the GRUB boot loader. If only because I saw that the absence of this affected installation attempt number 2.
  10. Yay! Installation is complete. I’ll believe it when I see it 😉
  11. Now it’s running clean-up… Oh, I hope it moves on from 65% soon, otherwise… Ah. There we go.
  12. Rebooting automatically.
  13. Hmmm. Get the boot choice again… does that mean it’s going to start the install again? God, I hope not!
  14. I have a black screen… some kind of progress swirly…. Ah! Desktop!
  15. Go ahead and login. Don’t use root, use the ‘other’ account you created.
  16. Love the retro rocket-and-planet motif. Taking a while for anything to happen… Probably just a first-login thing.
  17. Hmmm. Okay… That’s a crappy GUI… no start bar or icon dock or anything… I can soon install something new of course. Oh, I see… there’s a menu bar at the top. Kind of merges into the VirtualBox menu. Some kind of message about Guest Additions came up but I missed it.
  18. Right, let’s see what we’ve got and if we can carry on with the emulation stuff…

Terminal Time

  1. From the Applications->Accessories menu, start up a terminal.
  2. You should get a shell prompt with your ‘other’ username attached to it.
  3. Right, install the qEmu stuff.
    1. su root (use the password you specified during install)I’m doing this because I can’t sudo… because I’m not in that group of users, which is unhelpful.
    2. apt-get update(i.e. update the package database).
    3. apt-get install qemu
      (Go and get and install the qemu package)
    4. Now, qemu is installed. That page I am referencing as a guide (the Southend one) makes it a lot more complicated than it needs to be!
  4. Now, you need to cd ~<other username> to go into the home folder of your ‘other’ user. We need to create a folder to mess around in and store kernels and disk images.
  5. mkdir pi_emu
  6. cd pi_emu
  7. wget
  8. This will get the qEmu kernel, which makes everything run. I hope.
  9. You now need to get the current Linux image for the Pi that is recommended by the RPi foundation. The one I am using is the first release of Raspbian Wheezy. But, always check for the latest one at their downloads page. Get the URL of the release and do:
  10. wget <url>
  11. This is NOT a small file – it’s about 440M, so go and get a cup of coffee.
This takes around 10 minutes to install at work, and we’re on a T1 connection. The reason it’s so slow is probably because of where the file is coming from rather than the connection itself.
And we’re back…
  1. Unzip the file your downloaded (you will have to change this filename to whatever is now in your folder.
    1. To get a list of files, the Linux command is ‘ls’.
    2. unzip
      (to unzip it)
    3. This takes a while as well as it needs to expand the 440M file to a roughly 2GB file. Gawd bless file compression.
    4. Now, if you are logged in as root (and I was, so you should be!), you will need to make sure that the files in that folder are ‘owned’ by your other user, which will shall call ‘otheruser’. If you don’t do this, the .img file (and therefore the Virtual Raspberry Pi) will be ‘readonly’ when you run it using your otheruser account.
      1. chown otheruser *
      2. chown otheruser *.*
      3. exit
    5. You should now be back at a prompt that looks like
  2. Now, going to use a modified version of the command from the Southend site to start it up. Here goes:
    1. qemu-system-arm -kernel kernel-qemu -cpu arm1136-r2 -M versatilepb -no-reboot -append “root=/dev/sda2 panic=1” -hda 2012-07-15-wheezy-raspbian.img
    2. The last argument there is the .img file that you decompressed just now.
    3. Apparently, you can give it more memory by adding the “-m 512” argument to the end, but I just want it started up for now.
    4. I’m getting a few ‘readonly file system errors’, so it’s possible I might have to change permissions on the .img file before it works, but let’s just see…
    5. Not bad so far. Oooh! The usual Raspberry Pi first start-up screen! Yay!
    6. Choose the ‘update raspi-config’ option at the bottom just so you are up-to-date.
    7. Now re-run that utility:
      sudo raspi-config
    8. Choose the SSH server option and enable it. This will let you open a remote terminal to the Pi if you need to. Choose OK afterwards. Then choose ‘Finish’.
    9. Now we do ‘startx’
It’s interesting… the desktop comes up (although it’s blue, rather than raspberry-coloured… Odd). It’s a problem others have come up against.

For Windows users, it seems that the recommended solution is now: Raspberry Pi Emulation in Windows.

Never mind, it was an interesting practical experiment, which sort-of works apart from the colour issue. Non-Windows users may find these instructions still useful, so I will publish this post anyway!

Bluetooth on the Pi

Here we enter the murky world known colloquially, by me, as “Oh, Bluetooth, why do you mock me?”
This has been the biggest pain in the butt to get working, but hey, no-one ever said that the RPi was going to be easy.

Nice logo, isn’t it. Took me all of 30 seconds to search for it on Google images.

Installing the Bluetooth stack

Let’s remember, folks, Bluez is the official bluetooth stack for Linux! So it should work on everything, yes? Yeah, right. Here we go with the steps…

  1. Start the Pi, login as root.
  2. apt-get install bluetooth bluez-utils blueman
  3. From left to right, that’s:
    1. The stack. (A very large thing indeed)
    2. Command line utils. (A very useful thing indeed)
    3. X-windows interface. (A very slow thing indeed).
  4. Go and make yourself a coffee. This takes ages, especially over wi-fi. In fact, you could probably go and cook dinner.

Scanning and connecting

Onto the good bit. Getting your bluetooth device connected. In my case, I have a Rii bluetooth keyboard/touchpad.

My one came with a nano USB bluetooth dongle. In other words, it’s very small. Which is good.

  1. Okay, so you have the stack installed.
  2. Turn your Rii on and put it in discoverable mode.
  3. On your Pi, type “hcitool scan” to see if you can find your device.
  4. You should get a list of devices back in your area. The Rii comes up as “Macro Keyboard”. A stunning name, to be sure.
  5. Make a careful note of the string of numbers, colons and letters.
  6. Do the following to create a connection script:
    1. cd ~
    2. mkdir bin
    3. cd bin
    4. Create a file called and open it in your editor. Add the following lines. Put the string of numbers, colons and letters that you noted down before instead of XX:XX etc.
      #!/bin/sh/usr/bin/bluez-test-device trusted XX:XX:XX:XX:XX:XX yes/usr/bin/bluez-test-input connect XX:XX:XX:XX:XX:XX
    5. Save the file and exit from the editor.
  7. chmod +x
  8. (This makes the file executable so you can do the next bit).
  9. Open /etc/rc.local in the editor. Add the following command before the exit command at the end of the file.
    1. sudo -u root /root/bin/
  10. This should run your connection script before the login prompt comes up.
  11. Before you do a reboot, make sure your bluetooth device is still in discoverable mode.
  12. Reboot and see if your device connects!
  13. Well… it doesn’t.
  14. You need to go into X windows (startx) and use the blueman-manager applet to pair up the device, trust it and connect to the input service.
  15. Once you’ve done that, and reboot, and it should connect this time.
If you find those last few steps unfollowable, comment on this post and I’ll try and flesh it out a bit.

Setting up VNC server on the Pi

Install VNC and Auto Start

Here’s how to install VNC and get it working with the Pi across a network

First of all, make sure you expand the SD card – you don’t want to run out of space!

  1. apt-get install tightvncserver
  2. Yes, you want it to install, so accept the space it tells you it’s going to use!
  3. It’ll go through the usual install procedure and eventually put you back at the shell prompt.
  4. Type:
    1. tightvncserver :1
    2. (This will create a few files it needs to run)
    3. Set a password when it asks. Don’t bother with a view password unless you really want one – it’s just a pain.
  5. Edit the /etc/rc.local file and add the following before the ‘exit’ command at the bottom.
    1. sudo -u root /usr/bin/vncserver :1 -geometry 1024×768 -depth 16 -pixelformat rgb565 -fp /usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/
  6. Save the file, back to the prompt you go.
  7. This will mean that your VNC server starts up before you need to login on port 1 and a screen size of 1024×768.
  8. Reboot. Watch that magic happen. Dude. S’up.

The reason you do sudo is that it needs to know who to run the server as – remember, you’re not logged in before the login prompt comes up!

Now, you should be able to reboot and connect to the VNC server from your laptop, for instance.
You’ll need to download the Tight VNC viewer to do this.

Adventures in WiFi

Using wicd-curses

I know of no better way than getting WiFi to connect automatically than using the wonderful wicd-curses package. So, here’s how to do it:

  1. Plug your wifi dongle in. I cannot impress on you enough how important this is 😉
  2. If you’ve not done it already, login as root and install wicd-curses:
    1. apt-get install wicd-curses
  3. Run it. Just type
    1. wicd-curses
  4. You’re given the wicd interface. You probably haven’t got anything showing yet, so do Shift-R to refresh the network scan.
  5. Use the arrow keys to highlight your router and press –>
  6. Go down and hit space when you reach the Automatic connection checkbox.
  7. Then, go down to the password field and put your wifi router password in.
  8. Hit F10 to save the settings and you’ll go back to the first screen.
  9. Highlight your router if it’s not already and hit shift-C to connect.
  10. Hopefully, this will connect you. If not, check your password!
  11. Do shift-Q to come out of wicd.
  12. Type ifconfig -a and you should see your wlan0 connected to your router and your ip address displayed.
The beauty of doing it like this rather than via the command line is that wicd runs as a daemon when your Pi starts up and will automatically connect to the network without you doing anything else.
NB: You may have to wait a minute or so for it to connect.