Stephen C Phillips (old posts, page 1)

European public holiday leaderboard


European public holiday leaderboard

I work in a lot of European projects. This means that we often have weekly teleconferences across several countries which are often scuppered by a partner or partners being on holiday because of a national holiday. In the UK, all our public holidays are put on Mondays (with some Fridays) so that you don’t get the country shutting down in the middle of the week. In other countries the public holidays (e.g. saints’ days) just land on the same date every year with two results:

  1. Sometimes they land on a weekend so most people don’t actually get a holiday.
  2. When they land on a Tuesday or a Thursday lots of people take off the Monday or Friday as well to make a really long weekend and you lose almost half a week.

Read more…

A UPnP renderer for the Raspberry Pi


A UPnP renderer for the Raspberry Pi

I want to use a Raspberry Pi to play music through the micro Hi-Fi system in my kitchen/dining room. Up to now I have had a San Francisco Android phone velcroed to the kitchen wall running the Subsonic client and accessing the FLAC files on my media server via the excellent Subsonic server software (which transcodes them on the fly to MP3). This has been a good solution for a couple of years now but one problem is that the headphone output of the San Francisco is not very powerful so we have to turn the (small) amp up to max to get a decent volume and sometimes you want it higher.

Read more…

Using on{X} to control the Where Clock


Using on{X} to Control the Where Clock

I want to be able to send GET requests to the web server on my Raspberry Pi from my phone so that I can have the hand of the Where Clock turn to point at where I am or what I’m doing.

Of course, I can fire up a web browser on my phone and type in the URL of the Pi’s web server but that’s a little inconvenient: it needs to be automatic, driven by my location or other events. That’s where an interesting project from Microsoft comes in: on{X}. You go to that site and sign in with Facebook, download an app to your Android phone and again associate it with Facebook and then, on the web site, you can write little scripts using JavaScript which get sent to your phone and run there.

Read more…

A simple Python webserver


A simple Python webserver

Now I can control the stepper-motor from Python I need to be able to tell the Raspberry Pi to move the motor from my phone so that, for instance, when I get to work it can tell the motor to move the indicator hand to point to “Work”.

To do this, the easiest way seem to me to be using a web server on the Pi. I want to make it so that if you GET the URL http://<raspberry.server>:8080/move?a=90 then it will move the hand to 90 degrees. This normally requires a web server and a CGI script but it seemed overkill to install Apache or even something lighter-weight such as lighttpd or nginx for such a simple task so I’ve written my own: much more interesting!

Read more…

A Python class to move the stepper motor


A Python class to move the stepper motor

To properly control the stepper motor from the Raspberry Pi we need a class to represent it. This is one of the most direct ways of understanding object oriented programming (OOP): from the class you make an “object” and the object represents and controls an object in the real world (the stepper motor).

The class lets us remember (and control) all the information we need:

  • the pins the motor is connected on;
  • the speed of the motor;
  • the angle the motor is currently pointing to.

Read more…

Wiring done right


Wiring Done Right

With the new jumper leads from eBay I wired it all up again. For the power, the motor controller board has 4 pins and I don’t know why. Two of them are bridged by a jumper and by the other two there is a “-” and a “+” and “5-12V” underneath. I wired the 5V pin of the Pi (P2) to the one labelled “+” and the ground pin of the Pi (P1) to the “-“. Seems to work, but I don’t know if I just got lucky or whether it doesn’t matter which way round you put them.

For the controller lines I wired P18, P22, P24 and P26 to IN1, IN2, IN3 and IN4 respectively. That done, I turned it on and tried some software.

Read more…

The start of something


The Start of Something

I’ve been thinking about having a blog for a long time as a place to put information that other people might find useful. Finally I’ve got one (it is very easy to set up thanks to my host, Webfaction). I suppose I finally thought I had something interesting enough to share.

Read more…