Introduction: Esp8266-12 Blynk Wireless Electric Power Meter

this project is to measure the electricity consumption in my Home and show on my smartphone or tablet.

It is very cheap and simple to make.

This second project perfectly complements with:

ESP8266-12 standalone blynk control outlets wireless 433 mhz

the next step will be to combine the two projects and create an automated home

Step 1: Materials

ESP8266-12

Attiny85

LDR

10 k resistor

power regulator 3,3v

Step 2: Connections

ESP8266-12

VCC +3,3v

CH_PD +3,3v

GND ground

gpio5 ground

gpio2 ---- pin 5 (Attiny85)

------------------------------------------------------------------------------------------------

Attiny85

pin 1 nc

pin 3 ---- sensor LDR

pin 4 ground

pin 5 ------ gpio2 (ESP8266-12)

pin 8 +3,3v

Step 3: LDR Sensor

  • connect the sensor LDR as in the diagram
  • attach the sensor with hot glue or adhesive tape in front of the LEDs of the electricity meter
  • if the electricity meter is lit from the sun or lights, you can shield using a black cardboard
  • adjust the sensitivity of the sensor in the sketch, so as to detect only the impulse of the LED of the electricity meter. ( step 5)

Step 4: Configure Blynk

http://www.blynk.cc/

store app

Blynk Apple Store

Blynk Google Play store


configure blynk

create new project ( use hardware model esp8266 )

generate AUTH TOKEN

send E-mail TOKEN ( copy TOKEN in the esp8266 sketch)

in the app Blynk use Value Display widget or Gauge widget

Step 5: Sketch

Library
Blynk library

SimpleTimer library

------------------------------------------------------------------

to programming the ESP8266-12, I use ide arduino 1.6.5 and CP2102 3.3V USB To UART Serial Interface Module Adaptor ( do not connect the power of the CP2102 to esp8266-12).

to programming Attiny85 I use ide 1.6.5 and Arduino uno (Arduino as ISP).

--------------------------------------------------------------------

the electric meter emits 1 led pulse for every watt that measure

ATtiny85 detects the Led pulse using a sensor LDR

send to interrupt input of gpio2 ESP8266-12

sketch calculates the elapsed time between two pulses and calculates the power consumption, and displays it on the app Blynk.

----------------------------------------------------------------------------

attiny85 sketch

adjust the sensitivity of LDR sensor ( I use low sensibility and protect from light with the black cardboard)

if (FotoR <=200) // LDR sensor, change sensibility

---------------------------------------------------------------------------

ESP8266 sketch

change the sketch in the following lines with your data

char auth[] = "xxxxxxxxxx"; //insert here your token generated by Blynk

Blynk.begin(auth, "ssid", "password!"); //insert here your SSID and password


esp8266-12 gpio pin

the interrupt pin is the same as the gpio pin

if you want to change the pin, not use gpio16 or pin ADC, because it is not an interrupt

all gpio pin are interrupt (excluded gpio16 and ADC)

Step 6: Thanks

Thanks by catoplepa

Comments

author
breagan22 (author)2015-10-10

This is an outstanding Instructable! I love practical apps. You could simplify by just using the ESP-8266. It can happily read that LDR via the ADC pin. The Attiny85 is fun though. Good job!

author
kimthostrup (author)breagan222016-08-20

Hi breagan22,

Can you please elaborate on how to only use the ESP-8266 ?

Thanks in advance.

@catoplepa, awesome Instructable :)

author
catoplepa (author)2015-10-10

Thank you bragan22 for the comment

esp8266 can read the ADC pin but is not an interrupt and the sketch is based on the function interrupt.

ADC pin I reserve for the temperature sensor, will be the next project that I will publish in a few days