You are here

Raspberry Pi's, as tasty as they sound

Posted at 15:14 on Mon, 3rd June 2013 in hardware, linux.

First impressions of the raspberry pi and a PHP script to do dynamic DNS with the pi.

What’s the size of a credit card, runs on 3.5w of power, has no moving parts, runs Linux, has HDMI out and costs the same as a bad carton of beer - it’s the Raspberry Pi! Can you get anything cooler?

I must of been living under a rock for the past 12 months because I only came across it recently when a good friend and colleague Sam Hassell brought one to work.

I now have two of these little suckers, one running raspbmc as a media centre, and another running raspbian for experimental stuff.

I haven’t had a chance to do much with the second yet, but I did write this little php script to perform dynamic DNS updates to Linode’s DNS, for my home internet connection. This basically saves me $25 per year, rather than using a service like with my routers features.

If you're interested, you can grab the code over on my github account: dynamic-dns.php. It requires no 3rd party libraries or frameworks, all it uses is a few curl functions and the IP service (although you can use your own easily if you prefer).

To get the script running:

  • Install the php command line interface and curl extension: $ apt-get install php5-cli php5-curl
  • Create the initial DNS entry at linode. Set it to for now and set the TTL to the minimum, 5 minutes too.
  • Save the dynamic-dns.php script on your pi and update the variables at the top of the script. Note, you'll need to save your Linode API key (Linode Login->My Profile->Api Key) somewhere too, then set the path to this key file in your dynamic-dns.php at the top.
  • Setup a cron tab entry to have the dynamic-dns.php script run every hour (or more if you like). Basic crontab setup guide.

Hope that can help someone out there.

The raspberry pi website has lots of interesting stories of different people and organisations using their pi's for different purposes, from deep water submarines, to feeding cats. So check it out.