dalehumby / powermeter

ESP8266 + MicroPython project to record household power usage
MIT License
2 stars 0 forks source link

Power Meter for recording electricity usage at home using MicroPython on ESP8266.

Installed hardware

Assumes your power meter has a flashing LED that flashes every e.g 1/1000th of a kWh and that you can place an optotransistor over the LED to trigger a pulse on a pin on the ESP8266.

Features

Tested with

Web server Prometheus metrics

How to set up

Install USB to serial drivers on MacOS

https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all

How to install MicroPython on ESP8266 board

From https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html Downloaded latest MicroPython 1.13: esp8266-20200911-v1.13.bin pip3 install esptool

esptool.py --help

esptool.py erase_flash

esptool.py --port /dev/tty.wchusbserial1410 --baud 460800 write_flash --flash_size=detect 0 ~/Downloads/esp8266-20200911-v1.13.bin

Connect to the boards REPL using WebREPL

http://micropython.org/webrepl/#10.0.0.146:8266

Using Ampy to connect to dev board

Command line tool for upload/download of files. Installation instructions at https://github.com/scientifichackers/ampy

Use Screen to view terminal output

Where to buy

Learn More

I made a full presentation on Home Automation with MicroPython, the ESP8266 and Google Home at Google DevFest 2020. It includes my slides and YouTube presentation for building this Power Meter, as well as a short intro to MicroPython.