It’s working…It’s working!


Things have been a bit quiet on here of late. There is a simple reason for that. I’ve been playing about with trying to get my own website up and running.

As you can see I have finally succeeded. Well, kind of. What you are now looking at is my own hosted website. Admittedly it is a WordPress thing but it is sitting on my own home network on my own hardware. I’m pretty chuffed.

As some of you may know I’ve been mucking about on my Raspberry Pi as a kind of learning tool. Getting to grips with some of the basics… I wrote an earlier post about my first program, and how I can get online radio to play through the Pi in the kitchen…

This project made me realise that I could create something that actually did a job (admittedly something that others have done better and before me)…So what next…

It was suggested that instead of using the Dropbox tools I should write my own web version and then I could play the radio without the delay (the old script checked for a file every 30 seconds or so) or the occasional hiccup.

So… with my limited knowledge of scripting and python I cobbled a couple of scripts together to do what I wanted and embarked on an adventure with webservers…

With my trusty iPad next to me and the laptop connected to the Pi, I dived into the install process for a webserver application Apache2. This was simple and straightforward and I’m happy to say, everything *just worked*. I was greeted in almost no time at all by the “It worked!” page thrown up as expected. Next up was to dive into my router and sort out port forwarding and get signed up for a redirect service…

Here’s the science bit…

Each device connected to the internet has an address. This identifies it on the internet of millions of devices. Now usually your local internet provider changes this (for security) so your home very rarely has the same address for more than a few days at a time. Now, this can be an issue when you are trying to connect to a specific device… imagine trying to write to someone who keeps changing address and not telling you (or anyone) where they have moved to!

There are services that can update your address every time it changes, so I signed up for one of these and followed the instructions to set my router up. Eventually, after losing the will to live several times, I suddenly had an epiphany… and everything was up and running.

I could access my (very basic) website on the internet (and others could as well).


Now to link up the scripts and get them to run. This involved an evening of pizza and my tech guru, @Philcooper, swearing at the laptop. Lots. To no avail. The scripts would run when you were on the laptop connected to the Pi, but security restrictions meant that they would not run over the internet.

Lots of things were tried. Lots of things failed.




More success!

This meant that I could get the scripts to play and stop the various internet radio stations without relying on Dropbox… and had piqued my interest for what else I could do remotely…

In a fit of what can only be described as enthusiasm for my rediscovered geekiness, I dived onto the internet and ordered a couple of Radio Frequency gadgets for the Pi.

The following Sunday was spent in front of the Pi, with a soldering iron, a little circuit board, some jumper cables and these little bad boys…



Which meant that I could learn the codes being sent by the remote control for some of the electrical sockets in the house (these) …and… once I had worked out the (rather more complex than I anticipated) process I had sockets that I could control remotely from the Pi.

Suitably chuffed with my own ability I next dived back into the scripting and can now control those sockets remotely – wherever I am in the world.

Home automation… Phase 1 – Complete.

Next time… adventures in making the website look like something from 2015 and not 1997…