Sunday, 6 December 2015

PRTG as a Pachube/Cosm/Xively replacement?

Developer/Maker friendly long term data storage can be hard to come across but I think I have found a pretty neat solution.

PRTG is a network monitoring tool produced by Paessler. It also allows ticket management and all sorts of very clever stuff that's totally over the top for a home user, but it does give you access to a really cool dashboard creating tool (see above), a load of built in sensors, the ability to add custom sensor it's totally free for up to 100 sensors. Before I jump ahead lets give your a brief overview of the terminology used in PRTG.

What is a channel

A channel is basically a single data point. Each channel can have a value (a decimal normally), but it can also be a lookup with text as shown below.
For each channel you can specify various options, but the most useful are Units (specifies the units for the thing you are measuring)
You can also specify limits that cause the channel to switch state automatically (in this example a value above 90 will cause the sensor to be in error state).
Finally you can do get some pretty nice graphs for each channel (this shows my energy usage for the last 2 days)

What is a sensor

A sensor is basically a collection of channels (up to 50 is recommended). It has an overall status of Ok, Warning or Error depending on the child channels. PRTG does a really nice job of summarizing the status of all your sensors.

The sensor screen acts a bit like a dashabord for all the channels the sensor contains.

What is a device

A device can have a collection of sensors that normally relate to the devices IP (but they don't have to). The device is clever in that it will automatically pause any sensors on it if some of the lighter weight sensors report an error condition (if for example it stops replying to ping)
The device can also show a nice summary of the status of it's sensors

Device Groups

You can also group devices together like "Windows Machines" etc. Again the status of all the sensors below get grouped up.


You can out of the box configure PRTG to e-mail you (or push a notification to you) when a channel goes into a specific state.


This is perhaps my favourite feature! This lets you create really cool dashboards showing the status, and values of all the items above. Here for example is the map of my network

Mobile App

Paessler have created amazingly complete applications for iOS, Android and even Windows Phone. The apps are very fully featured and make use of the native platforms (for example you can add sensors as widgets on android). As a mobile developer I'm really happy to see this!

Ok, what sort of things can you monitor

Out of the box there are over 200 sensors. I have mainly used the following:-
  • Ping Pretty obvious, but lets you know if something has gone down quickly.
  • HTTP Gives you average load times for a web page (used to monitor your internet connection)
  • Windows Sensors You can monitor a lot on a windows machine (CPU & memory usage, disk free space, uptime, pagefile usage, network traffic, RDP availability, is a service running), I use most of these!
  • Network Flow If your router/switches support this (dd-wrt does!) then you can get a lot of information about the traffic flowing through your network. Really handy for IoT devices when you have no idea what they are doing!

What has any of this go to do with makers

Nothing, because I haven't mentioned the best sensor types yet! PRTG also supports several custom sensors allowing you to monitor just about anything you want:
  • EXE/Script You can write a console application that can output xml
  • Python Script Same as above, but in python
  • HTML XML/REST value This can poll a web api and do things like count the number of times an element appears. I use this to monitor how many people are streaming from my plex server
  • HTTP Push Data Here you can push data to the server whenever an event happens that you would like to track (HOW COOL IS THAT!)
Obviously the above scripts could be used to interface with things like an Arduino really easily! The Paessler blog has listed some cool project makes have done using PRTG - here is a project that counts how much mail you have received during the year, one that monitors fuel prices in Germany (and uses a nice dashboard to present the data). A hospital in South Australia is even using it to monitor blood bank levels and send alerts when they run low! Paessler have a great list showing some of the interesting things that are monitored using PRTG here.

It's also really easy to configure PRTG to have custom notifications too. There are notifications for Twitter, The terrorist favourite Telegram and a load of others, but it's really easy to add your own!

So you basically have your own hosted version of Pachube/Cosm/Xively or whatever it's called now, plus it has ifttt type functionality (in-fact using the ifttt maker channel you could easily make the two work together nicely!)

In the future I'm going to blog a bit about some custom sensors I've made, and a sensor host I'm working on to make it really easy to use the HTML XML/Rest sensor!

Ok, how much is it then

Ok, it's not cheap if you are going to be monitoring a lot of things, but it's totally free for the first 100 sensors! And each sensor can have up to 50 channels, so you could monitor up to 5,000 channels for free.
It used to be a lot less (10 sensors), but Paessler recently changed this in the hope that hobbyists/home network enthusiasts/geeks will love using this at home, and then tell the sys admins at work that they need to be using this in the office. I can easily see how that would work, because this is first and foremost an excellent network monitoring tool, it just so happens to also be an excellent *insert your project here* monitoring tool too :-)

Wednesday, 10 April 2013

Hacking a PacMan Lamp

I recently got given a PacMan Lamp (which can be bought from Firebox) from microsoft because I published a windows store app (called Space Race for those who are interested - its a phonics game for young children learning English!)

The lamp comes with a little remote that lets you select any colour. I just had to figure out how to control this thing with an arduino!

I took the remote to bits, but quickly realized I was going to have to solder a wire per button at least, and this would hardly scale - so I decided the next best option would be to simulate the IR the remote produces.

Lady Ada has a brilliant guide I used to read the IR signals via the arduino. To do this you will need a IR Detector, which I found to hand

Well, I say to hand... No kids toys were (permanently) broken you will be happy to hear

After hooking it all up to the Arduino I was able to pull out the timings of the "On" periods vs the "Off" periods. As advised you ignore the first off, and then look at the time periods for on vs off. It became pretty apparent that most times were around 530 µs, or 1620 µs, and the on periods were always the short time.

Once I had profiled several of the buttons I turned the "Off" periods into binary with the short period representing 0s, and the long periods representing 1s (as shown by column J in the screenshot above.

With enough codes it became fairly obvious that the first 16 bits where always "0000000011110", and the final 3 bits were always "111". After scratching my head for a bit I realised that the first 5 bits, and the last 5 bits where the only things that changed (the middle bits where always "000", and once I had pulled the bits that changed out it was really obvious that they were just the inverse of each other

Now all I had to do was write an arduino script that would take 5 bits, and translate it into the code, and then correctly send it to the IR pins. Heavily borrowing from the sample code Lady Ada provided I was pretty easily able to implement the algorithm. Feel free to grab the code from my GitHub repository. Once you have uploaded your code you will need to add an IR Diode to your arduino as shown in this image (ignore the stuff to the right of the image - thats for hooking up the IR Detector)

(Image from Lady Ada's site)

Now with everything loaded I needed to create a little app that would fire some commands at it. I created the following little library class that wraps everything up.

To use it simply construct the object (passing in the com port the arduino is connected to, then call do command passing in a command you want) as shown below

I'd love to hear what you use this for - I have just hooked mine up to Lync (its like skype for business). It now flashes white and blue when I get a call and when I'm not getting called it's coloured the same as my lync presence. I'll get a video up asap.

Thursday, 22 December 2011

A BBSB Online controller clone (for £26)

I love home automation (as I'm sure any geek does!), so when I saw the BBSB online controller I knew I needed it in my life but could really justify the £90, plus I figured why not try and build one myself. I mean, how hard can it be?

First thing I needed was some programmable hardware and since I have done so many arduino based projects before, the choice was obvious. Or was it? I noticed a new arduino clone had popped onto the market called a Nanode. Acting much like an arduino but at an incredible £22 from SK Pang (a similar arduino is over £44!). Now I actually ended up getting the upgraded model (Nanode RF) which includes the following extra features:-

  • A Hope RF RFM12B (supplied with 868MHz module) transceiver for 2 way communications with other boards.
  • A microSD card for general datalogging storage, storing applications and webpages. microSD card not supplied.
  • A realtime clock IC with alarm function which also holds a unique ID. not supplied.
  • An 8 pin socket (under the H logo) to allow you to add non volatile RAM for program download. Supplied with 23K256 256kb SRAM and DIL socket.

This allows me to use it to talk to other devices, but more on that in a later blog post!

To simulate the bye bye standbye online controller I needed to know 2 things. 1 how does it talk to the sockets, and 2 how does it receive commands from app such as the brilliant remote for Bye Bye Standbye.

Well thankfully both problems have been solved, and well documented many times before!

Arduino actually have a playground for all of the HomeEasy integration code - so that was the easy bit. The only additional thing I needed was something that could "talk" over the 433 frequency. Thankfully Farnell sell one for a smidge of £4.

Once I proved I could get this working nicely (using code sample 3 from the playground) I moved on to problem 2 - how does the BBSB controller talk to other software?

Again this was (unusually) well published by bye bye standanby (hats off to you for that!). So all I had to do was get the nanode to "talk" UDP.

Well this was a tad harder! The Nanode does not use the same Ethernet chip as the Ardiuno Ethernet stuff - so you can't use the standard "Ethernet" Library. Arduino recently released a new version of their IDE (V1) this means a lot of the code samples online have changed so it's a tiny bit harder to get good samples, but with some great help from the nanode community (get involved on irc) I was able to pull apart the tftp sample and just handle the udp packets I needed.

So without further ado here is my code hosted on github (my first open source code!)

And here is the final solution:-


BBSB also provide a really handy application to test to see if everything works fine - you can grab that from the forums

Future changes

Well the Nanode RF already includes a transmitter so it's a bit daft not to be using it - unfortunately it's the wrong frequency - but you can easily by a compatible 433 transiever from farnell.

Tuesday, 1 November 2011

Announcing WHS Drobo Status!

I have always loved Microsoft's Windows Home Server and sing its praises whenever possible; however with the most recent version Microsoft decided to remove what I always thought was one of the best features - the drive extender!

Drobo as a product is a perfect fit for this gap. The product allows you to add multiple hard drives and collates the space, making it easy for a home user to expand their storage space on demand.

I always wanted a Drobo so when I saw a competition running on the Home Server Show's website to win one I knew I had to enter!

The competition required the development of an add-in for Windows Home Server (something I have always wanted to do but couldn't quite think of anything to build!) So, having put sleep aside for a few days I'm very pleased to announce the public beta of my WHS Drobo plugin!

The plugin allows you to at-a-glance view how much space you have available, and the status of the drives as shown below:-

The screenshot below shows the drive information if for example you remove a disk:-

You can find the beta here: WHSDroboStatus.wssx. Simply install the add-in as normal from any WHS client computer.

Please note you must have the Drobo dashboard software installed on your Windows Home Server for the plugin to work (you probably have it installed already! If not you can find the right version from the drobo website).

Any request for new features/feedback can be added here:

Please also leave a comment to let me know how you get on with it!