ESP8266 based power meter – motivation

Having a energy saving mindset, i’m always striving to save a dime and do my contribution in order to avoid waste. That said, it’s crucial to know where we’re spending energy. Goal here is to do a project log of a ESP8266 based power/energy meter.

All started when i found out about emonCMS and i wanted to give it a go on a budget. So, i hooked up my 1st gen Raspberry Pi Model B (it’s a war machine – pics will be self explanatory) to a ATTiny85 to do the ADC stuff. Power consumption is sensed via a 30A clamp freely available in the usual chinese suppliers that will output a sine wave up to 1V depending on the load. So, it was just a matter to offset my wave (since ADC won’t love negative signals and 1V sine wave will mean 1V around 0V, or, -1V to 1V).

This was the goal:

Pretty graphs from EmonCMS project
Pretty graphs from EmonCMS project

Construction was easy: perfboard, a capacitor, resistor divider network, ATTiny85 and pin header. Looks like this (ignore the red wires – those are for a SPI LCD).

This is probably revision 0.00001

ATTiny85 will read input voltage with the DC offset, calculate the power, and send it to the Pi via serial interface. Since i’m powering the ATTiny via 3V3 from the Raspberry Pi, there’s no need to worry about level shifting.

This worked for a while and i began learning about Kicad – you should too. So, i designed my first purple board:

Out with the old, bring the new! Ignore V1.0. It’s V0.1…

Worked first try, and the Pi looks a lot sharper.

My beloved Model B 1st gen with the pretty purple board from OSHPark

But i wanted more, for less. Having a full featured Linux machine listening to a serial connection and having it sent via HTTP POST request is overkill. So, why not use the ubiquitous ESP8266 for the job?

On my first board revision i want to stick to the basics: having the ATTiny do the heavy lifting, and the ESP8266 doing the data submission. Looks like this:

It’s a proof of concept, again. So, to keep the board cheap i didn’t included mounting holes. There are two programming headers (one for the ATTiny, one for the ESP8266) and the board is powered via micro-USB. There’s also a programming pushbutton for enabling programming mode on the ESP8266. Power is converted via AMS1117 3V3 (or similar) in a SOT-223 package – it’s what i’ve laying around.

In the future i want to skip the ATTiny completely and move all the logic to the ESP8266. For that i need to use a dedicated ADC – since it will have some learning curve, i’d leave that for later – it’ll probably interface via I2C to keep it simple.

To be continued.

Leave a Reply

Your email address will not be published. Required fields are marked *