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
  • 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

It will need to be running off an apache webserver with PHP currently (recommend XAMPP which can be found here

Onto the raspberry pi

sudo apt-get git

git git clone 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 explaining connections for our motor controller used

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