CurrentCost EnviR I/O board mod (/w ESP8266)

Making the CurrentCost EnviR energy monitor display talk IP without extra things hanging off it, with a simple mod'd I/O board

Similar projects worth following
A project to build a drop-in replacement I/O board for the CurrentCost EnviR power monitor base unit, which allows it to be connected it to a 802.11 g/b/n network and sends power reading data in CC128 format XML somewhere (via HTTP or MQTT or .. something!)

I've had a CurrentCost EnviR for some time to measure my flat's electricity usage. It's got a well documented API and a readily accessible serial port that squirts out the data. Previously, I've used their PL2302 based USB to serial cable to hook it up to a RPi and log the readings somewhere that I can graph them. But I'm a bit bored of using a USB port on my Pi for this, and I've got an ESP-12 board that I need to find a use for!

And yes, I know, they do sell a thing that does this (the CurrentCost Bridge) but do I know where to buy one of these? And when I do, will I be content to merely send my data to CurrentCost? No. No I will not. I want to be personally responsible for breaking my own Heath Robinson solution, and that's what makes it fun.

So, after doing some very basic disassembly by undoing the screws in the base...

That looks simple!

Oh look! It's even got nice RJ connectors! That board has everything we need on it (power and serial lines), so I just have to design a PCB the right size to fit in the hole, with a similar power socket in the right place. I guess I could put the RJ45 in as well - but it won't really be necessary when we're done. Although, it might be nice, just for the stealth value :D

(hmm, that DC jack is soldered on a bit wonkey...)

So my board will need to hold a ESP-12 module, and maybe a little bit of power regulator (the power regulator in the EnviR probably won't be spec'd to supply the ESP-12 as well as the rest of the unit - which apparently has quite a high peak current). There's loads of space on the back of the board, and the position of the RJ interconnects isn't fixed, so tonnes of wiggle room.

Should be pretty straightforward, right? Ha haaaa....

  • 1 × CurrentCost EnviR
  • 1 × ESP-12E Module

  • First revision of PCB

    Chris Roberts03/30/2016 at 18:11 0 comments

    I'm putting off destroying my existing CurrentCost IO board for a while (by soldering bodge wires to it whilst I test my ESP code). Therefore, I decided to do the first round of schematic capture.

    It's a pretty simple board. I've mostly replicated the existing wiring but broken the TTL serial lines and put the ESP8266 in between. I've found that you can have "sort of" two UARTs on the ESP8266 by using the Serial.swap function which lets you mux the uart tx and rx pins between two sets of physical pins. Really it's only the RX pins that I care about (as far as I know, the CC doesn't do any receiving at all), which I want to be able to swap between the CC and the external terminal for bootstrapping and, indeed, reflashing. In this case, the external connector is going to be getting the default pins so that I can reflash it from the outside world without too much bother.

    And there's an LED on it. Because, LEDs, dood.

    Apparently you have to hold GPIO15 low. Hopefully that's not going to cause issues with the serial line from the CurrentCost driving that as well :-/ (there probably will be issues with that...)

    I've stuck a "pin header" in that lets me put it into re-programming mode. Probably won't populate that, just hold something pressure-fit style whilst it boots to get into the right mode.

    I tried to use those lovely RJ1x connectors I found before, but as it happens they're really quite fat and take up far too much room. So pin headers it is.

    Here's the first attempt at a layout:

    It looks like everything should fit - just. There's a fair bit of tolerance in the casing for moving things around ... so it looks fairly achievable.

    (ignore the pointless groundplane to the right.... )

    Now I know I'm not completely wasting my time, the next task will be butchering the existing board and hooking up some dev boards and see if I can put together some code that will work - at least as a proof of concept.

  • Shove up, connectors

    Chris Roberts10/26/2015 at 14:12 0 comments

    After a long time of this not being an active project (I got a fun bit of commercial work that absorbed my time, and taught me lots about PRJC's Teensy 3.1! But for another project...) I was reminded of this by being given a "skull" by jlbrian7.

    As it happens, I've recently ordered a bunch of ESP8266 dev kit (a nodeMcu board, and a couple of bare ESP-12E's), and had a hankering for more PCB design, so finishing this project seems like a natural choice.

    One of the things which I picked up on earlier was the fact that the RJ11's in the middle couldn't be the same through hole components used on the original board, as the pads would get in the way of the ESP module sitting flat against the board. Fortunately, with a bit of parametric searching on Farnell, I've found some Molex RJ11 connectors that have both surface mount contacts AND mounting points, so they won't poke through to the other side of the board and interfere with the module.

    RJ11, flat against one side of the board

    Flat as a pancake

    And they're not hideously expensive either at £0.775 on the UK Farnell site at the moment (Order code 1471565). The body of the connector is 18mm long, which, with the contacts, might make it a bit of a squeeze. But it should fit. True, I won't get the same mechanical strength I would with through-hole mounting posts, but these are for internal connections that will only be mated once or twice (I hope!) and won't have any oafish users (like me) plugging heavy cables in from the outside and pushing them about on a frequent basis.

    The RJ45 and DC jack, on the other hand, are the vertical type, and I won't bother with surface mount as it'll simply take up more board space than it needs to (the contacts will have to point away from the connector, rather than straight down through the board). Also I'd like to retain the mechanical strength afforded by fixing them through the board, as this connector will be accessible from the big scary outside world, where there are ogres with TTL to USB cables and DC wallwarts who want to break my connectors.

  • Analysing Existing Functionality

    Chris Roberts01/29/2015 at 16:56 0 comments

    There's not a great deal to the existing I/O board. We can deduce from various documented pinouts for the RJ45 connector what the two RJ10 connectors do. And obviously we know what the DC jack does.

    Cor blimey, those two power lines are awfully close! Not sure I'd trust a cheap high volume fab house with that sort of spacing (especially if they're the ones who soldered the DC socket on wonky...). Pins 3 and 4 of CON2 (middle left) are a bit mysterious - but I highly suspect they're RTS/CTS. We don't really need them - they may just be there for factory programming or debugging or testing or something. If you check out the main board, it doesn't look like they go anywhere...(photo purloined from Jack Kelly here). I guess the track might be on the other side, but I don't fancy dismantling my display if I don't need to!

    Anyway, we can extract a schematic

    Groundbreaking stuff, right?

    The challenge will be finding a way to fit the ESP-12 onto the new board without it interfering with the required connectors. The internal RJ10 connections can be moved around a bit (possibly even off the board entirely with a breakout if needed, although that would require another board so I'd rather avoid that), and we might be able to get surface mount versions of these connectors to make a hole free space (although the retaining posts might be problematic).

    Ideally, I want my board to be a drop in replacement - so I want to avoid changing the connectors if I can. Whilst it may be easier to change those RJ10's for pin headers, that makes it more difficult to install on a unmodded unit.

  • Power Considerations

    Chris Roberts01/29/2015 at 01:08 0 comments

    Adding an extra thing to the device means we have to make sure there's enough power available to run it.

    The power hungry ESP8266 can draw up to 220mA or so in 802.11b mode, CCK 1Mbps at max power. In my instance, since the EnviR is about 5cm away from my AP, we could certainly reduce the power by using a less power hungry mode. But since these ESP8266 chips seem to have an amazing range it would seem a shame not to be able to use it !

    The power coming from the plugtop supply that comes with the EnviR is 3V unregulated rated to 80mA, and on the EnviR's main board we can see a little PSU section with a SOT-23 regulator (what's that, HFEK? looks like a linear regulator, probably a LDO 3.3V of some sort?) and a couple of decoupling caps for good measure (photo purloined from Jack Kelly's teardown here).

    The PIC18F86J90 (see a photo of it here, from Jack Kelly (not me)) which runs the main board can run on anything from 2.0V to 3.6V, and the ESP8266 can run between 1.275V and 3.6V. So whatever voltage that regulator is outputting should be fine for the ESP.

    If I replace the plugtop PSU with something a bit beefier that can deliver, say, 300mA, (like this one from Rapid, perhaps - 3.3v 1.5a Mini Plugtop Sw Mode Psu ) then the question then is whether that PSU section on the main board can provide enough current or not. Chances are the regulator is capable of at least a couple hundred mAs, but we'll have to test it. If it can't provide enough current , we'll have to add our own regulator circuit on the I/O board - something I'd like to avoid if at all possible.

    Further measurement and poking is required.

View all 4 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates