With a CurrentCost energy monitor of any form, there’s a variety of ways that you can track historical data;
Option 1 involves simply looking at the stored summary on the unit itself. It’s interesting for about the first seventeen seconds, but you have no context to what you’re seeing and ultimately no ability to compare year-on-year data, say. All you can do is watch it scroll through the average KWhr of energy usage measured in the last day, the last 7 days or the last 30 days.
Option 2 is to buy a device of some sort to upload the data somewhere to do something with it. It can be achieved by buying a CurrentCost Bridge device for about 30 pounds, which is an ATmega168-based device with an ethernet port that uploads your data to “compatible” web services. John Crouchley did a nice write-up of what’s inside it and how you might modify it. I’m not a fan of the fact that it only posts data to certain web services and reckoned I could achieve the same functionality for about the same cost or less, but with more flexibility. As an aside, I had a quick look for a shop link for it whilst writing this and only found it out of stock at Amazon and Energy Monitors Direct, so its potential usage is probably moot anyway.
Option 3 is to link the data to your PC and then do something with the data from there. It may be relatively simple (once you’ve got a cable to connect the monitor to your PC), but leaving a PC whirring away all day just to monitor energy usage is bonkers in my mind.
Option 4 is a homebrew implementation of option 2 and involves cobbling together your own interface out of bits that you quite honestly didn’t happen to just have lying around in the first place, but wanted to try anyway for the sheer enjoyment of “having a go” as much as anything else and -in my case – consists of;
The overall cost of components probably ends up somewhere under the 20 quid mark doing it this way, though you could maybe save yourself a couple of quid by hard-wiring the cable that connects the Xino and the CurrentCost – I just like being able to plug and unplug things so added an RJ45 connector. A Nanode is an alternative that provides an all-in-one package,
but trying to get hold of one seems to be a pain in the arse at the moment; no distributors have any stock left, the official shop has been offline for “temporary maintenance” for at least a month now and Ken Boak (the fella behind the project) seems to have buggered off to America. UPDATE: In the time it’s taken me to turn this from a draft to an actual post, the Nanode shop has come back online, though it gives neither indication of actual stock levels nor explanation of what’s been going on.
So, how did the simple plan work out in the end?
Well, obviously I chose option 4 because it involves the most work, the most discrete components and the most potential for banging my head against a wall at every turn. The idea was to have one PSU that powers both the Xino and the CurrentCost monitor, but it turned out that the one supplied by CurrentCost is as crap as their support forum, so instead I had a rummage around in the “big box of old bits that I told my wife we’d thrown away but I’d secretly kept because it might be useful one day” and found an old BT Synergy 4500 DECT phone. There were two things I particularly remembered about this phone; it was shit at actually making or receiving phone calls (and we only really discovered this after we bought a load of them as a bundle) and although the base units looked like charging stations, they weren’t – they only powered the phone when it was in the cradle, so you had to constantly feed them fresh batteries if you chose to do something radical like picking the phone up to use it. Oh, and if you left the batteries in the phone with it “on charge”, some short-circuit or something caused the batteries to leak everywhere etching your bedside table or sideboard with a nice battery acid pattern.
Like I said, they were shit …
So, you take the phone, open up the base unit and find a little PCB that basically just lights up an LED and provides power to the pins in the cradle. The only thing that I actually want from this lot is the red power connector at top-centre, to satisfy my inherent desire for plug-in-and-out-ability.
The phone’s charger is rated as 7.5V @ 200mA which sounded bang on as my current draw with the Xino, the ethernet shield and the CurrentCost monitor all powered up is just under 180mA. If you want to know how to measure the current draw of your project, because you’ve always wondered and Google never seemed to throw up anything useful, then this might help you.
Once I’d de-soldered the connector, I then wired it up to the “0v” and “5 – 9v” pads on the front of the Xino and powered it up to check everything was working. The simplest way to check was to add an LED on a breadboard so I could run a Blinky sketch, as there’s no on-board LED on pin 13. I then added the ENC28J60 shield and loaded up the RBBB Server sketch and pointed a browser at it as the simplest way to confirm that the combination was happily working as a network node. Well, it worked fine when the setup was powered with 5V via the FTDI connector, but when I powered it from the standalone PSU the lights on the ethernet magjack just sort of flickered a bit then got gradually dimmer till they faded away to nothing, all the while failing to actually work as a network interface. Suspecting that this probably wasn’t a good sign, I checked voltages on the shield and whilst the 3.3V pad was fine, the 5V pad was only registering 3.45V. Hmm…
Discussion on the Ciseco support forum suggested that the nub of the problem was that because the 5V regulator supplied in the Xino kit is an LP2950, a current draw over its’ rated output of 100mA was causing it to shut down. The only answer is to go to a regulator with a higher output. Whilst I can understand the technicalities of it, what pisses me off about that is that nobody at Ciseco mentioned anything about the limitation beforehand and you might think it a little prudent to mention on your own site and shop that the Xino Basic and the ENC28J60 shield don’t work together – as supplied – if you use external power and their own voltage regulator kit.
Anyhow, I sourced an MC7805 regulator with an output current that maxes out at 1A. It’s in a bigger package, though, so I had to chop out the one I’d carefully soldered onto the Xino and then patch the new one in, taking advantage of the little prototyping area on the Xino to give me somewhere to mount it. Well, it’s not pretty, but it works. Everything fired up, connected to the network, got an IP address and the test sketch happily responded to page requests from a browser.
Checking the setup with the multimeter showed that the old phone charger was putting out 7.3V @190mA, so whilst the phone was crap, the spec. for the charger was about right.
With the basics out of the way, it was then time to wire up the RJ45 connector for linking to the CurrentCost. There’s one row of the Xino’s prototyping area that’s got 8 pins in a row, so that determined where the socket would go. It needs to hang on the underside of the board, though, as otherwise it’s too high to seat the ethernet shield.
- Pin 1 goes to the output of the 5v regulator and will provide power to the CurrentCost
- Pin 4 goes to ground
- Pin 8 goes to digital pin 9 and will receive data from the CurrentCost
The sketch to actually parse the incoming data from the CurrentCost and upload it to a Cosm feed has been running fine for a month or so whilst the dev board has been powered off the PC and everything was connected up on the breadboard with a hundred jumper wires. Rather than post it again here, just follow this and I’ll put the the most current incarnation up on GitHub and link it here. If you want to take the piss out of my coding or suggest improvements, you’re more than welcome to click the “Comment” link at the top of the page 😉
With the hardware and software now functionally stable I had a hunt around for a suitable enclosure. Contrary to some of the posters on Instructables, my supply of hand-made antique cherrywood boxes with inlaid motifs and ornamental brass hinges was somewhat depleted, so I just cut a hole in a cardboard box that was lying around and fed the cables in through there.
So, here it is then. A CurrentCost CC128 energy monitor, powered from an Arduino-alike, with energy usage and temperature data being uploaded to Cosm via an ENC28J60-based ethernet shield.
Yes, I know I’ve probably spent more on this homebrew solution than I would have spent on a CurrentCost Bridge. Heck, I’ve probably spent enough to cover the cost of buying a data cable and running my PC for a couple of years … but that’s not the point really, is it? I started out knowing essentially bugger all about this stuff and by-and-large I’ve had fun learning through failure as I’ve gone along.
… and yes, I know my desk is a right mess – it’s on the list 😉