Sridhar Rajagopal
Published © GPL3+

Internet-Connected Energy Monitor

In this article, I explain how I integrated Dr. Wattson Board with Raspberry Pi and AWS IoT to create an Internet-connected energy monitor.

IntermediateWork in progress2 hours3,430
Internet-Connected Energy Monitor

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Dr. Wattson Energy Monitoring Board
×1

Software apps and online services

Raspbian Stretch
AWS IoT
Amazon Web Services AWS IoT
Dr. Wattson Python Library

Story

Read more

Custom parts and enclosures

Dr. Wattson laser cut acrylic enclosure

The following is a laser cut acrylic enclosure to put Dr. Wattson board in, so the high voltage lines and output are isolated and you can safely use the digital pins with your Raspberry Pi without worrying about dealing with high voltage.

Schematics

Raspberry Pi wiring to Dr. Wattson Energy Monitoring Board

Dr. Wattson Energy Monitoring Board is based on MCP39F521 from Microchip and the communications is via I2C, and also includes 2 pins for event and ZCD notification (that are unused in this example). Connect Dr. Wattson headers to the Raspberry Pi as shown to start communicating with it. I will also include a Python library for easy communications, which I have started developing.

Code

Code snippet #24

Plain text
while(1):
    result = wattson.readMCP39F521()
    print "VoltageRMS = " + str(result['VoltageRMS'])
    print "CurrentRMS = " + str(result['CurrentRMS'])
    print "LineFrequency = " + str(result['LineFrequency'])
    print "ActivePower = " + str(result['ActivePower'])
    print "ReactivePower = " + str(result['ReactivePower'])
    print "ApparentPower = " + str(result['ApparentPower'])

Code snippet #29

Plain text
    JSONPayload = '{{"state":{{"reported":{{"voltageRMS":{0}, "currentRMS":{1}, "lineFrequency":{2}, "activePower":{3}, "reactivePower":{4}, "apparentPower":{5} }} }} }}'.format(result['VoltageRMS'], result['CurrentRMS'], result['LineFrequency'], result['ActivePower'], result['ReactivePower'], result['ApparentPower'])
    print JSONPayload
    deviceShadowHandler.shadowUpdate(JSONPayload, None, 5)
    loopCount += 1
    time.sleep(1)

Github

https://github.com/aws/aws-iot-device-sdk-python

Credits

Sridhar Rajagopal

Sridhar Rajagopal

1 project • 22 followers

Comments