Category Archives: Uncategorized

Raspberry Pi Classroom infrastructure – Raspi-LTSP

For installing and getting started, check out the new project site including all the documentation –

Raspberry Pis are great for schools, they act as a sandbox for teaching kids Linux, electronics (using GPIO pins) and programming using awesome applications like Minecraft Pi or Sonic Pi.

The Raspberry Pi recommended operating system, Raspbian, has been designed to be run standalone and come packaged with just about all you need to get started. Just download the image and stick it on an SD card, simple right?

The problem…

Simple until you decide to go all in and get a classroom set of Raspberry Pis. Now you have got 20-30 Raspberry Pis, but also 20-30 SD cards to maintain! How do you deal with it if you have more than 20-30 students? Few options.

  1. Give them each an SD card. This can have a few issues though if all the students in your school will be using them.. 100, 200, 300 SD cards to maintain!?!?!
  2. Have multiple user accounts on each Raspberry Pi, but make sure none will ever be needed at the same time.
  3. Just use builtin Pi user on a set of 30 SD cards, pupils save their work to their pendrive. This brings the problem of having to plug a pendrive in at end of every lesson, if you want to save stuff in the class, you also need a (powered) USB hub.

All of the above options are a bit rubbish, there is no single perfect answer.

One big issue though with all of the above is, what if an SD card or pendrive fails?……..

What if? If using any of the above options, it is gone… All that students work is gone, lost forever! This makes none of those options suitable for use with important coursework (GCSE or A-level CS)

At the Raspberry Jamboree last year, this point was brought up. The suggestion was the “magic pendrive”. The Raspberry Pis were configured to dump all the students work onto a special pendrive when it was plugged into the computer. This sounds simple and like a good solution, but when it needs to be done at the end of every lesson, it starts to get a little less viable.

This is what led me to start looking into a better way.

 The better way

At the time I watched the Jamboree panel, I had been playing around with LTSP (Linux Terminal Server Project).

It is a project that brings together a number of base packages from the Debian/Ubuntu software repositories plus a pile of custom scripts, to create a system that allows full Linux clients to boot off a network, aka not using the machines own hard drive. It supports 2 main types of clients

    1. Thin clients – These are clients that are basically dumb terminals into the server, no processing is done on these clients, all processing is done on the server. For Raspberry Pis this would for example let you run non Raspberry Pi software, or operating systems (like Ubuntu) but does not have access to Raspberry Pis GPIO or camera port, it also requires a powerful server for a classroom. A client for the Raspberry Pi already exists, called BerryTerminal
    2. Fat (/thick) clients – These are clients that just really use the server as a hard drive. All the processing is done on the Raspberry Pis, you have full access to the GPIO pins and camera port, but are stuck with the usual Raspbian OS. It also does not need a powerful server.

At the time when I was looking into this, there was no instructions for using LTSP with Raspbian fat clients or Raspberry Pis in general as fat clients.

After plaguing some developers in the LTSP IRC channel, we eventually figured out how to get LTSP to build clients for the Raspberry Pi. Then started the long laborious process of properly building Raspberry Pi Raspbian OSs.

How hard could building Raspbian be?

In short, quite…

The Raspberry Pi foundation make a lot of changes to a default Debian build… They do this through a tool called spindle by Alex Bradbury. The main issue for me with Spindle is it contains a lot of unneeded stuff for my system, seeing as LTSP does a large chunk of the build. I also didn’t want all the changes they made, mainly because some broke LTSP so had to be careful what a picked.

By the 25th February, 2014 (just in time for the Raspberry Jamboree) I had got a rough basic clone of Raspbian working, this wasn’t enough though, as the system had to be easy and complete as many tasks a teacher would need as possibly, with a press of a button.

Raspi-LTSP back on 25th of June, not many features...
Raspi-LTSP back on 25th of June, not many features…

So then new features like full Epoptes integration, Picontrol integration, NBD compression, student work collection system, auto installing software and a few others were added.

This brings us to the stage we are at now, a stable (ish) usable system designed to be easy to use for teachers.

Raspi-LTSP now full with features and options allowing teachers to really easily customise their Raspbian install
Raspi-LTSP now full with features and options allowing teachers to really easily customise their Raspbian install!

Yeah, but how does it work?

It actually isn’t too complicated.

Few prerequisites though.

  • Raspberry Pi is connected to the server via a switch or network hub
  • A router handling IP addresses (DHCP) is on the network or you set one up on the serverThe
  • Raspberry Pi has the boot files on its SD card, these are autogenerated when the server installs Raspi-LTSP and are tied to the servers IP address.
  • Raspi-LTSP is installed on the server and the server is turned on.

As long as all those are met, then the below sequence of events should occur

  1. When powered on, the Raspberry Pi loads the kernel, initrd, cmdline.txt file and config.txt file
  2. Kernel reads the config options and loads the initrd.
  3. An initrd (also known as an initramfs) is a simple, very small Linux filesystem used to chainload other filesystems, in our case a filesystem over the network
  4. The LTSP scripts in the initrd grab an IP address and try and contact the server
  5. If successful, it mounts the Raspbian filesystem off the server, as COW (Copy on Write)
  6. Copy on Write is a special setup that is similar to read only, but the OS is able to change the files. When it reboots though, these changes are lost.
  7. Once mounted, it runs some more LTSP scripts to finish setting up the client. These include setting up NBD swap. This is compressed swap in case the Raspberry Pi runs out of RAM.
  8. Finally LDM (LTSP Display Manager) loads up, allowing the user to log in

    The login screen for Raspi-LTSP powered by LDM
    The login screen for Raspi-LTSP powered by LDM
  9. Once the user logs in, their home folder is then mounted. Their home folder is stored at /home/user on the server.

So why should I use this?

A few reasons

  1. Centralised operating system – The operating system for the Raspberry Pis is stored on the server, centrally. This means if you want to make a change to it, say update a package or a configuration file, simple, just modify it on the server.
  2. Centralised users – The user accounts are stored on the server, not the Raspberry Pis. This means any student can sit down at any Raspberry Pi in the classroom, log on and get access to all their files.
  3. Centralised files – The pupils home folder of all their work is stored centrally. This means only a single folder (/home) has to be backed up, and all the students work is instantly backed up.
  4. Work collection – Raspi-LTSP contains a simple but effective system for collecting work from students, they just place it in a folder in their home folder called handin. Then the teacher selects an option in Raspi-LTSP and it goes and collects the work from every student, placing it in a single folder for the teacher to mark.

I want to see videos of it in action!

Well lucky for you, Ben Smith (@ManchesterBudo), a computer science teacher based near Blackpool has been trialing the system for a number of months now and has created some videos of it in action.

I am sold! How do I get started?

As mentioned above, a few prerequisites.

  • You need a network switch. It must have at least a single gigabit port (10/100/1000mbit), also sometimes called a stacking port. It is fine if the rest of 100mbit (10/100mbit). These can be picked up off ebay for less than £20, example1
    A single gigabit port is essential as the server must plug into it.
  • You need a classroom set of model B Raspberry Pis.
  • You need enough Ethernet CAT5 Ethernet cables to reach from your switch to Raspberry Pis
  • An old router or a DHCP server installed on the server machine to manage IP addresses on the network
  • A server machine – this can be an old desktop machine, it does not need to have large amounts of processing power, should have at least 2gb of RAM and at least 70gb of hard drive space. You will be formatting this machine. Finally, it must also have a gigabit Ethernet port.

The setup process is very simple, but requires internet to build Raspbian. Once it is finished, it won’t need an internet connection, unless you want to update or install new software.

For installing and getting started, check out the new project site including all the documentation –

If you have any issues with the project, feel free to leave a comment below, post an issue on the github page or drop me a tweet @gbaman1

Minecraft coding in the classroom – 1st draft

Today’s post sways a little off the normal Raspberry Pi stuff, there is a link though!


One of the awesomest pieces of software the Raspberry Pi has for teaching in Minecraft Pi edition Link . If you don’t have it on your Raspberry Pi, why not?! It is great as kids can easily program modifications to the game in python allowing them to place blocks, move players and do all kinds of cool stuff. There is a problem for it though in education, not every school has a classroom of Raspberry Pis…

Fret not though, a Bukkit developer has gone and made a Bukkit plugin to emulate the API but for the normal version of minecraft.

We will start though from the start. What is minecraft?

Minecraft is a sandbox! It is a game played by millions of people across the world. It is very popular with teenagers especially. The game has a massive community behind it and is easily modifiable with the use of Java.

Modifying the game though brings with it a number of problems including modifications not playing nice with each other. To make it easier to mod the game and to help mods play nice together, a number of community projects emerged making their own APIs. The 2 most popular of these are Bukkit and Minecraft Forge. Both are not run by Mojang (Minecraft developers) and are maintained as opensource projects through donations.

Bukkit is an stable and the standard server platform for 90% of Minecraft servers out there. It has an easy to use API and a massive collection of plugins allowing you to manage players on a server and keep order. There are also a number of specialist plugins, we will be looking later at one called RaspberryJuice. Bukkit is a server only platform, it can not modify the actual client (aka add more buttons, new blocks or new menus).

Minecraft forge, the other major platform, allows direct modification to the client. This allows you to do things like add new menus, buttons, blocks. MinecraftEDU is designed for Minecraft forge. It has a very powerful API that allows you to change most of Minecraft.

 Minecraft Pi edition

Minecraft Pi edition is a special version of minecraft developed for the Raspberry Pi which is based off another branch of minecraft, Pocket edition (designed for mobile devices). It has only the basic features of minecraft but can easily run on the Raspberry Pi.The important bit though about minecraft Pi edition is it has its own simple to use API for interacting with the world! You can tp players, break or place blocks etc in languages like python, java, javascript etc.

This API is great for the classroom and at home but it has an issue. What if you don’t have a Raspberry Pi? A lot of schools dont yet have a full classroom yet of Raspberry Pis but have a fully kitted out ICT suit with much more powerful computers than the Raspberry Pi. What about this API for normal PCs? A developer has gone and created just that! An easy to use plugin called RaspberryJuice has been released that allows players to use exactly the same API but using normal Minecraft.

Each student must be running a mini server though to use this seeing as it requires bukkit, this allows teaching simple commandline based server applications too.

By using Bukkit, you also have access to 1000s of plugins that allow you to customize the entire experience. For the plugins check out their database

Lets set up a server

First you will need a minecraft account (€19), it is likely most students will have one. MinecraftEdu offer discounts to schools and can get them as low as €10. You only need 1 set of accounts per classroom (and if they arent connecting to the same server, 1 set per school).

Next you need to set up the clients, it is a very easy process. Make sure java is installed (most machines it is), download client from Here and you are good to go.

If you are using RaspberryJuice each client also needs a mini server running in the background. The basic idea is they run their own mini preconfigured server then they just connect to localhost (aka, themselves). Using this method also allows students to connect to each others servers if they know their IP addresses.

You need to create a folder with the server stuff in it. I will be demoing this on a mac, but it will work also on windows and linux.

Make a new folder for your server and grab the latest beta build of bukkit (It is also known as craftbukkit) from .

Bukkit has 3 standard release channels, unstable (daily releases, dont use), beta (a tested build that most things should work for, these are fine) and a recommended build (these are the most stable, there are very few of these).

Minecraft is constantly being upgraded with new features, a new update comes out on average every 1.5-2 months and will be heavily publicized before its release. Best place to hear about new versions is They also do snapshots which are unstable test versions normally released once a week. These are minecraft versions, not bukkit. Minecraft follows a numbering system that increments .1 every major release and .0.1 for bug fixes, for example as of writing, the current version is 1.6.2. 1.6 is the main version number and there has been 2 bug fix updates. Remember, these are different from bukkit releases. Bukkit releases can take 1-2 weeks after a major update and 2-3 days after a bug fix update. When a new version comes out, you dont need to update, it is normally smarter not to until everything settles down.

When configuring the clients, it is important to go into edit profile and change the dropdown menu from latest version to the current version, this way the clients wont auto update. See the picture belowVersion

So, now you have bukkit (also known as craftbukkit), place it in your server folder you created and rename it to craftbukkit.jar. The result of this is below

We only have 1 file so far, the server!
We only have 1 file so far, the server!

The normal thing to do for most people is just double click it, sadly minecraft servers dont work like that, they need a script to launch them correctly. I have provided all the startup scripts here StartFiles

The .bat is for windows, .command is for mac.

Remember, the server .jar file must be called craftbukkit.jar

We are now ready to test out our server. Double click the start.something file and watch as a terminal or cmd opens with a load text.

The important bit here is at the bottom. It explains that it is generating the minecraft work which can take a few mins.
The important bit here is at the bottom. It explains that it is generating the minecraft work which can take a few mins.

You now have your very own minecraft server up and running.

!!!VERY IMPORTANT!!! Do not ever close the terminal or cmd with the x at the top! To correctly stop a server you must type stop into the terminal and hit enter. If you close it by mistake, easiest way to fix it is reboot your computer !!!VERY IMPORTANT!!!

You can connect to your minecraft server by launching minecraft, clicking multiplayer and connecting to localhost

If you can connect, you have done it all right!



To modify the experience for your students you can use plugins. These are modifications to the server developed for free by members of the community using the bukkit API. To add one, you simply download its .jar file and drop it into the plugins folder inside the server folder. Reboot your server and it will auto load on startup. Keep an eye on which version plugins were developed for, some older plugins may not work on more recent versions of bukkit. Most plugins work perfectly fine, RaspberryJuice for example was released 2 major releases back and it still works perfectly fine. Make sure to read the documentation that is on the plugin page if you are putting any other plugins.

Other stuff you need to know

You may want to edit some configuration text files, these are auto created when the server starts. The file is the main config file for the server. Details of it and its settings can be found at

Minecraft servers have a built in permission system that is rather simple, you have 2 levels.

  • Player – can build, mine and play as a normal player
  • Op – (short for operator). The Op has full power over the server, can spawn in blocks, can change to creative mode (fly and infinite blocks) and can stop the server.

To add yourself as an op open the ops.txt file and add your name on the first line. You can also add it ingame and from server console.


The server is controlled via a series of commands, a user at the console has full permission to type any command, an Op ingame can type most commands and a play can type barely any.

To type a command ingame you prefix the command with a /

For example /stop from ingame would shut down the server. At the console you only need to type in stop and hit enter and the server will shut down. Make sure to give it a min to save the map.

A full list of commands can be found at

You will need to download the minecraft pi version to grab the api folder which contains the python library, drop the api/python/minecraft folder into the base directory of your server. Then follow the normal minecraft pi guides but make sure to save your python scripts in your server base directory

Server is red World data files are grey Some of my python files are green API folder is yellow Text files to worry about are purple Stuff to ignore is orange
Server is red
World data files are grey
Some of my python files are green
API folder is yellow
Text files to worry about are purple
Stuff to ignore is orange

Each student will need a mini server for themselves, you can create the folder, zip it up and put it on a pendrive or shared network space and let them grab it, you dont need to include the folders in grey as the server will auto generate new worlds if no worlds exist.

Also keep in mind, if students know other students IP addresses, they can connect to each others server or write python scripts to do stuff to other peoples servers, it is up to you if you want to allow them to find out each others IP addresses 🙂

With a server running, connect to it with your client and you are good to go, create some python scripts!




Pi powered Panobot v1

I have just finshed work on version 1 of my Pi powered Panobot. It is a robot designed to take panoramas with the official raspberry pi camera board.

It is built out of lego and uses the same motors and motor controller as my Lego Pibot.

It runs a python script which allows me to program how wide a panorama I want and how many levels. Once the images are taken I copy them over to my laptop and stitch them together into one image using Hugin

The Pi camera is very good for its price but compared to my DSLR has a smaller dynamic range and also a smaller HFOV (Horizontal Field Of View) so to get a panorama, it requires a few more pictures. I found to allow enough overlap that 10 pictures wide was sufficient by 3 pictures tall. This totaled to 30 pictures per panorama compared to my normal 25 pictures for my DSLR. I have to stitch them on my laptop instead of the pi due to massive amount of processing power to find the control points

So, time for some pictures

The panobot on a hedge taking some pictures
The panobot on a hedge taking some pictures
A closer look inside the panobot
A closer look inside the panobot

Now for what you have been waiting for, what images does it produce?

180 Degree panorama

A full 360 degree panorama shot with the Raspberry Pi camera board
A full 360 degree panorama shot with the Raspberry Pi camera board

For the full sized panobot panorama click here as wordpress limits the upload size

A panorama taken from the same area with my DSLR (Canon 600d)
A panorama taken from the same area with my DSLR (Canon 600d)

For the full sized DSLR panorama click here as wordpress limits the upload size

280 degree panorama taken in the evening before batteries died
280 degree panorama taken in the evening before batteries died

For the full sized  panorama click here as wordpress limits the upload size

Full 360 degree panorama made up of just 30 pictures!
Full 360 degree panorama made up of just 30 pictures!

For the full sized  panorama click here as wordpress limits the upload size

For the full sized  panorama click here as wordpress limits the upload size


As you can see, there really isn’t much in it between the DSLR and the Raspberry Pi Panobot. There is two thing though to take into account though.


The Panobot takes around 2 mins to complete a full panorama

Using the DSLR I took the example panorama in under 30 seconds


Because of the larger HFOV on my 28mm lens on my DSLR, I only took 24 photos for the full panorama (In portrait mode to reduce lens distortion). 24 photos takes about 3-4 mins to stitch

The Pi camera board took 30 pictures to get a full panorama. It took 4 mins to stitch those though.

So there is definitely trade off with using a completely automated pi camera but I am still quite pleased with the results. It was a great learning experience and a great option for someone who can’t afford a larger camera, the whole system (excluding lego) runs in about £50-£60

A copy of the python code can be found here

A copy of the python code on github can be found here

Raspberry Pi camera board – Gstreamer

So, my Raspberry Pi camera board has arrived and I have started playing with it.

Raspberry Pi camera board

My first impressions were tiny, super cheap camera. Its low light capabilities are not great but I can live with that. The important bit is the quality, full 1080p at 25 frames per second (UK). That on its own is pritty awesome.

I was though only really interested in getting the pi to work remotely for my robot to replace the 3-4 fps standard def USB webcam I currently use. Currently though with the camera, there is no V4L driver so we have to make do with their provided applications then pipe it out to streaming applications. Their recommended method is slow and very laggy (netcat and mplayer with wifi provides 3-6 seconds of lag). So I had to find another option. I happened to be sitting on the #raspberrypi IRC on freenode and heard a user having success with gstreamer. So this is how to set up gstreamer to stream HD video with less than 0.5 seconds of lag.

First we need to add a repositary with gstreamer1.0


sudo nano /etc/apt/sources.list


and add to the end


deb . main


Then do an sudo apt-get update

next grab gstreamer


sudo apt-get install gstreamer1.0



On your recieving end you will also need gstreamer. Because I mainly use a mac, I decided to get it working on the mac so with help from arcanescu on IRC, we figured out how to get it working on mac os (10.8)

The simplest way is with brew, a package manager like apt-get, but for mac os. To install it run this in terminal on your mac simply run

ruby -e "$(curl -fsSL"

It will grab and install brew. Now update it with


brew update 


Now we need to grab gstreamer


 brew install gstreamer gst-libav gst-plugins-ugly gst-plugins-base gst-plugins-bad gst-plugins-good 


Once that installs you should be good to go. Enter


 raspivid -t 999999 -h 720 -w 1080 -fps 25 -hf -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse !  rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=YOUR-PI-IP-ADDRESS port=5000 


on your raspberry pi and enter on your mac


 gst-launch-1.0 -v tcpclientsrc host=YOUR-PI-IP-ADDRESS port=5000  ! gdpdepay !  rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false 


The picture quality is good but I see a number of flickers which isnt a problem for me, if it is for you, maybe try adjusting the resolution


So thanks again to arcanescu, I take no credit for this as it was him that came up with this, if you ever see him in IRC, give him a virtual pat on the back

His blog



On Wednesday the 20th of April the Dalriada school robotics team traveled to Cambridge to compete in the PA Consulting Raspberry Pi competition. Our team brought with us a prototype of our revolutionary new product, the Raspberry Pi Powered Internet Connected Pill Dispenser. This device uses a raspberry pi, connected to the internet to dispense pills at predesignated times that have been defined on a custom made website of ours.

All this for under £50!

The prototype of the pill dispenser
The prototype of the pill dispenser

When we arrived we were met by some helpful PA Consulting staff that had been assigned as our representatives for the day. We went up through a maze of halls to the event room. A massive room with banners everywhere and a lot of raspberries. We went over to our area and set up

Our whole design is a bit of a mess but we left it out of its box so people could have a look and see how it worked

We have plenty of cables. Spot the raspberry pi in there.
We have plenty of cables. Spot the raspberry pi in there.

After setting up I was immediately thrown in the deep in with an interview as no one else in the team wanted to do it. You can see a shortened version in the video above.

We then got shown around PA Consulting’s building and got to see some cool 3d printers, a machine for making kitchen roll (Way more exciting that it sounds) and a number of other activities planned for us. We then had to demo our design to a number of judges, this went ok but could have gone a lot better after a jammed the machine up by pulling out the wrong bit 🙂

After this the judges continued round the rest of the teams and members of the press and PA Consulting clients came and we presented our product to them, these seemed to go a lot better and we ended up with a number of impressed people including a lot of “My mother/father would greatly appreciate one of these”.

After a tantalizing wait, the judges announced the winners including us and we each walked away with a raspberry pi (My 4th raspberry pi) and a PIbow. The school got a golden envelope with £1000 in it (which we plan to spend on a classroom of raspberry pis) and an custom engraved Pibow case.


We had a stunning day and would especially like to thank PA Consulting for putting on this event

Check out what other bloggers have said