Code Monkey home page Code Monkey logo

pzem's Introduction

PZEM

Python Interface to PZEM AC/DC Power / Energy Monitoring Modules

Copyright(C) 2021, BrucesHobbies, All Rights Reserved

PZEM Module Overview

PZEM.py provides a Python scripting interface to the Peacefair PZEM AC and DC energy / power monitoring modules. The module measures the following:

  • voltage (V)
  • amperage (A)
  • power (W-Hr)
  • freq (Hz)
  • power factor
  • state

Figure 1: PZEM

Consult an electrician for your local electrical codes. Also refer to the documentation that comes with the PZEM module. For devices powered off alternating house current, either 120 or 240 volt, the PZEM uses a split transformer to measure current through a wire. It is snapped around the neutral wire to sense the current flow. The module also requires connection to hot and neutral to measure the voltage being provided to the device. For Direct Current devices there is the PZEM-017 module.

Figure 2: PZEM Wiring

Required Hardware

As an Amazon Associate I earn a small commission from qualifying purchases. It does not in any way change the prices on Amazon. I appreciate your support, if you purchase using the links below.

PZEM Module (about $20 USD)

For Alternating Current (AC) devices

For Direct Current (DC) devices

  • One of the following DC power PZEM-017 modules - may have different shipping times

  • 2-conductor low voltage wire as needed (RS-485 connection from PZEM module to USB dongle)

Raspberry Pi system (if you don’t already own one)

  • Raspberry Pi (any of the following)
  • Power adapter for your Raspberry Pi
  • Heatsinks (optional)
  • SD-Card

Software Installation

Step 1: Install the Raspberry Pi Operating System.

Here are the instructions to install the Raspberry Pi Operating System. Raspberry Software Install Procedure

Before continuing make sure your operating system has been updated with the latest updates.

sudo apt-get update
sudo apt-get full-upgrade
sudo reboot now

Step 2: Download PZEM software

To get a copy of the source files type in the following git command assuming you have already installed git:

git clone https://github.com/BrucesHobbies/PZEM

Download prerequisitie ModBus.

sudo pip3 install pymodbus

Verify PZEM module presence using the RPi command line (once attached by USB cable and RS-485 cable with module power on):

ls /dev/ttyUSB*    # Show USB devices
lsusb -v           # Show USB devices with details

Future Options

Please feel free to fork and contribute or provide feedback on priorities and features

Test

To perform a quick read of the PZEM module use the following command:

python3 pzem.py

Feedback

Let us know what you think of this project and any suggestions for improvements. Feel free to contribute to this open source project.

pzem's People

Contributors

bruceshobbies avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.