Super simple JSON HTTP server to read energy monitor status.
Please see open energy monitor projet and emonlib
This code has been tested with this open energy monitor shield and Arduino yun.
- Configure your Arduino yun board with NTP enabled
- Clone this repo
- Setup your project with platformio.org
platformio init --board=yun
platformio lib install 116
- Customize your settings
// Energy monitor setup
emon1.current(1, 60.606);
emon1.voltage(0, 250, 1.7);
- Build code
platformio run
- Upload firmware to Arduino yun
scp .pioenvs/yun/firmware.hex arduino.local:/tmp/
ssh arduino.local '/usr/bin/merge-sketch-with-bootloader.lua /tmp/firmware.hex && /usr/bin/kill-bridge && /usr/bin/run-avrdude /tmp/firmware.hex'
curl -i 'http://arduino.local:5555'
HTTP/1.1 200 OK
Content-type: text/json
{ "SiteName": "Home", "ModuleName": "mainPower", "Irms": 0.95, "Vrms": 239.87, "RealPower": 126.21, "ApparentPower": 228.76, "PowerFactor": 0.55, "Time": 1442234001, "ExecTime": 1860788 }