Raspberry Pi Classroom infrastructure – Raspi-LTSP

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.


A simple installation guide can be found on the projects github page here

A full 34 page userguide detailing all steps and troubleshooting help can be found Raspi-LTSP-userguide-small

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 http://plugins.bukkit.org/

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 dl.bukkit.org .

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 https://mojang.com/. 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 server.properties file is the main config file for the server. Details of it and its settings can be found at http://www.minecraftwiki.net/wiki/Server.properties

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 http://www.minecraftwiki.net/wiki/Commands

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 http://hugin.sourceforge.net/

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

Lego Pibot Ultrasonic wall avoider

I have been working on getting the cheap ultrasonic sensor working for the past week and have got it working with my Lego Pibot.

It sends out an ultrasonic blip every 0.1 seconds and measures the time it takes for it to get a bouce back.

I followed a very helpful guide at raspberry spy which I got a lot of the ideas from.


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 http://vontaene.de/raspbian-updates/ . 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 https://raw.github.com/mxcl/homebrew/go)"

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 garagedeveloper.wordpress.com

Lego Pibot revision 0.2


I have been working away at my Lego Pibot recently and now have something to show for it.

I rebuilt the entire thing making it more efficient in turning, it uses a towering design and is more modular. It has 4 levels with batteries, pi, breadboard and camera.

It also has support for an additional attachment on the front, so far I have used that to attach a lift-able pen on the front to draw over paper (turtle style). Finally I have added space for a breadboard and also added the extra motor for rotating the webcam.

All the electronics are the same as the first Lego Pibot with the exception of the additional motor and the breadboard for prototyping. i have also added a cheap ultrasonic sensor off eBay to it but am having issues with it right now.

What isn’t shown in the video is the wiimote support I have added. I have written an additional script for controlling the robot with Bluetooth using a wiimote.

When it is finished I will post the source code, as normal, it is in python.

Also new is the addition of scratch controlling. The robot can be really easily controlled by scratch GPIO making it really simple to write control programs.


As normal, if you have any questions on this, post a comment below or on the video.



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



Lego Pill Dispenser

Our summary documentation can be found below


A big feature of our pill dispenser is the price, we have designed it to be as cheap as possible and a one off payment, no subscription required!
What you will need

  • A Raspberry Pi = see below
  • A motor controller = £4.75 http://goo.gl/0wBZt
  • Some jumper cables = 10p
  • A breadboard = £1
  • A wifi network
  • Some lego
  • 2 Lego motors = £15
  • Power cable = £2
  • Motor batteries = £3
  • Some other cables = 10p

We offer 2 versions to keep the price down. Wifi only or Ethernet only.
This is all to do with the raspberry pi.
If the user needs wifi we use a model A raspberry pi with an added £10 wifi adapter = £28
If the user only needs Ethernet we use a model B raspberry pi only. = £27

Total price = £53 including Raspberry Pi one off payment (no profit) and £26 excluding Raspberry Pi

Next grab a copy of the PHP site behind it all from https://github.com/dalriadaRobotics/Pill

It will need to be running off an apache webserver with PHP currently (recommend XAMPP which can be found here http://goo.gl/fXpWW)

Onto the raspberry pi

sudo apt-get git

git git clone git://github.com/dalriadaRobotics/Pill.git

Back to the webserver

Now we have the web server and the pi set up it is time to configure them.

They are already configured out of the box with everything except the dispenser IP address.

To get this, type ifconfig on the raspberry pi and find the series of 4 numbers with a . in betweeen each number. E.g.

Next, open up the website (using a browser go to localhost) and log in with



Now select a patient with the dropdown menu at the top and double click the dispenser IP address. This will let you change the IP address of the dispenser to your dispenser’s IP address.

The uploaded software is in demo mode so it works in minutes and does not show the normal time selector for selecting different times of day to be dispensed.

A useful diagram from http://pdwhomeautomation.blogspot.co.uk explaining connections for our motor controller used

Now hook up all the wiring using the above diagram and you are ready to go.

Raspberry UART – No screen or network needed! WOOT!

My USB to UART bridge adapter arrived today all the way from China. I have been wanting one of these ever since turning up to a raspberry jam to discover they didnt have any more screens left and their network was overloaded meaning i had no way to control my Pi.


So after some research I disovered the raspberry pi supported a serial connection (UART) to control the console. I ordered this device which took 1-2 weeks to arrive (£1.65 so can’t complain…)

I wired it up with

  • +5v to pin 2 (optional see below)
  • GND to pin 6
  • RXD to pin 8
  • TXD to pin 10

I then grabbed the driver for it (windows does not auto find a driver) from Silicon Labs

After installing the driver, I opened up device manager, drilled down to Ports (COM & LPT) and found the COM port it was on (COM4 for me).

Now we have all the info we needed, I opened putty up, clicked serial circle tickbox and entered my COM port. Finally I entered the correct speed for the Pi (115200), clicked open and hit enter and I had a login prompt!

Much cheaper than a screen or a router and perfect for Raspberry Jams!

As normal, any questions? Leave them below

Lego PiBot

 Outdated. Check out updated version revision 0.2! http://pi.gbaman.info/?p=97

Lego Pibot

I would like to start off by saying, I didn’t come up with all this myself, I have followed a few guides over the internet to make this and added a bit of my own stuff to it. The guide I used the most was


You will need

  • A Raspberry Pi + SD card
  • A Motor controller

Motor controller

  • A Wifi dongle

USB wifi reciever

  • A battery for the Pi

Old Iphone battery

  • A 9v battery
  • 2 motors
  • Female to female jumper cables
  • Male to male jumper cables
  • Android phone – rooted


  • Webcam
  • Mobile tablet/Laptop for viewing video feed
  • Mifi portable wifi transmitter

First you will need some sort of base robot to be building this all on, I will only cover the electronics and the software, not how to build your robot.

So here’s my base robot

Lego PiBot Lid

Lego PiBot no lid

It looks a little ugly, but was built to a deadline so I don’t really mind, it works.

So after you have got everything on shopping list, its time to start building!

My lego robot base is built from an old lego RCX box set so I decided to try and use some of the old 9v lego motors.

Lego 9v motor

These motors required gearing to provide enough torque to move the robot forward so if using these motors, keep that in mind. I did come across another problem with these motors, they don’t easily connect to normal wires…

So I cut one of their cables and soldered it to 2 jumper cables and bam!

My custom lego cable

So now we have our motors, we need to hook our motor controller up to the raspberry pi. For this, I recommend you check out the diagram from Paul Geek Dads blog as it is the one I used.

This is Paul Geek Dads blog’s work, all rights to it belong to him


For my setup I found that a 9v battery would run out very quickly so I got x2 triple AA battery holders to produce that required 9v


So now we have our Raspberry Pi hooked up to our motor controller and our motor controller powered by a 9v battery or some AAs.

Check out the below pictures for pictures on where everything goes

Electronics Electronics Electronics

Note the Pi ground and the black end of the batteries cable both go into GND

Note the Pi ground and the black end of the batteries cable both go into GND

Now time for the software behind it all. I am using Rasbian. At the time of writing, 2012-12-16-wheezy-raspbian. Rasbian comes with WiringPi which is needed for our scripts, if you don’t have it, try sudo apt-get wiringpi

For this section, that is all you need (for attaching a webcam, you will need a little more software but we will get onto that later)

Hook your pi up to a screen and with your wifi dongle plugged in, type startx and open the wifi config on the desktop. Connect to your home wifi. Now that this is done, it should automatically connect to the wifi even without a screen plugged in (seeing as the PiBot does not have a screen….Yet).

The Raspberry Pi

Next, on a windows computer, grab putty


Or if on Mac OS or Linux, open terminal and type

ssh pi@IP address

E.g.        ssh [email protected]

Now we are connected, you will need to grab this python script and upload it onto the pi

Use sudo apt-get git

and git clone git://github.com/gbaman/Lego-PiBot.git

To grab the script for the pi. Now you have the scripts, it’s time to move on to the phone.

The Phone

You will need a rooted android phone which can run sl4a http://code.google.com/p/android-scripting/

To grab it just scan the qr codes on the pages below.

SL4A – http://code.google.com/p/android-scripting/

Python interpreter  – http://code.google.com/p/android-scripting/downloads/detail?name=PythonForAndroid_r4.apk&can=2&q=&sort=downloadcount

This great piece of software allows you to install interpreters on your android rooted device (e.g. python interpreter).

Next find a way to get the script onto your phone (different for all phones).

Now you need to set the IP address of your Pi in the scripts. In the android script it is on line 12, UDP_IP =

And on the Pi script it is on line 25, UDP_IP =

Now all you have to do is tap the script and click the command-line button and run the Pi script (sudo python pi_script.py) to run it and move your phone around and your robot should move!


Live video! (Optional)

Wouldn’t it be even cooler if you could see what your robot sees as you drive it around? We you can!

I recommend following this guide below, it is very good and explains exactly how to do it.


After following the guide, open up the web page on a smartphone, maybe a tablet or a laptop etc and you can now watch your robot take over the world!


If it does not work there is a few things that could have gone wrong.

First test if your Pi is able to turn control the motors. Inside the Pi folder that you grabbed off github, there is a testing_motor1.py and testing_motor2.py. Try running these and see if the motors come on. If not, check the light is on on the motor controller, if not, check back to the pictures for wiring or maybe your board is broken?

If those scripts work then your phone isn’t able to talk to the Pi… Make sure the IP address is right (use ifconfig on the pi) and maybe try rebooting your Pi and phone just in case.

If it still isn’t working, leave a comment below and I may be able to help out.


Any question? Leave them below and I will try to answer them the best I can.