The CurrentCost panels output real time data in XML format every 6 seconds through a TTL serial connection presented as an 8P8C connector on the bottom, and I used to have a WRT54GL wireless access point connected to that, which sent the data to the server. The WRT54GL was retired some time ago, so I wanted another way of recording the power usage data. The ESP8266 seemed like a good choice to provide a bridge to my wifi network and I've chosen to use an ESP-12F board. I could build a small enough device on stripboard to sit in the cavity under the base of the panel and connect to the CurrentCost's TTL serial output.
The 8P8C connector also includes regulated and unregulated power connections, but the 3v PSU is only rated for 80mA which is nowhere near enough to power the ESP8266. I didn't want to have a second PSU, so opted to use a single USB power supply to power everything. I've used an LM1117T LDO regulator to drop the supply voltage down to 3.3v, and connected this to both the ESP8266 and the unregulated supply rail of the CurrentCost. There's a schottky diode between the regulator and the CurrentCost - this isn't strictly necessary, but will protect against someone plugging the CurrentCost PSU in at the same time as the wifi bridge.
GPIO0 and GPIO2 are pulled up by 10KΩ resistors, GPIO15 is pulled down by a 10KΩ resistor - you can probably get away with omitting the resistors and connecting these directly to Vcc / 0v respectively, although using a resistor to pull up GPIO0 allows the ESP8266 to be programmed in circuit by temporarily pulling it down to 0v.
CH_PD and reset are pulled up all the time by tieing them to the Vcc rail.
The connections to the CurrentCost's 8P8C connector are:
- Pin 1 - Vcc / unregulated power
- Pin 4 - Ground / 0v
- Pin 8 - TTL serial data
|Component-side view on the left, flipped for a track-side view on the right|
The power connector is a surface mount mini-USB socket - obviously that's incompatible with stripboard, so I have just tacked on a couple of wires to connect it to the circuit and soldered its mounting lugs down to the track-side. I find it useful to hot-glue the wires onto the board for mechanical support to avoid breaking off the socket's pins.
The code, schematic and layout are available from my Subversion repository. The circuit works for both the CurrentCost EnviR (also known as the CC128) and the first generation CurrentCost, although the baud rate needs to be changed in the code - the EnviR uses a rate of 57600bps whilst the first generation panel uses 2400bps. I believe there are also second generation panels around that look similar to the first generation ones but run at 9600bps.