-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Using the PZEM004T with an ESP8266 #22
Comments
|
Excellent post @vortigont |
@vortigont do you occasionally get "bad" data and even ESP resets from the Pzem? Our Pzem updates a Smartphone app and yesterday morning one of the graphs showed some strange values (see below). Voltage dropped from 240V to 120V for 40 minutes!
Maybe it's not the Pzem and the electric company had some failure, what do you think based on your experience? |
@pieman64, I have almost no problems with esp resets. yield() added to the PZEM lib does the trick. |
@vortigont yes as per my post the plots are 1 minute average values taken from 30 off readings at 2 second intervals. So with the readings of 120V it's possible the Pzem was alternating between 240V and 0V throughout each 1 minute period. However that doesn't really explain the gradually decreasing and increasing plots before and after the "120V" period. Well it could be explained if it was only dropping to 0V for a short period of the 1 minute average but strange that it get progressively more "0V" and progressively less "0V" at the end of the "120V" period. The app also plots WATTS and Energy costs with the WATTS data also being visible above the VOLTAGE in the screenshot I posted. The WATTS and Cost do not show any variation from the assumption of 240V throughout the period so suggests a reading error. So you have had all zero values for U,I,P,W. Brief power failure or bad readings? |
@pieman64 Do you have the logs what was the actual data that time, not the averaged graph? As for all zero values it was not power failure. But even if it was "Energy" counter can't return, say '10500' than '0' and than increase to '10501' again. So i think it was some error in the pzem controller itself. |
@vortigont no I don't have the 2s logs, just the 1 minute "average" logs. |
@vortigont or @olehs do you happen to know the maximum current input that the Pzem's can accept? We appear to be overloading ours when the ESP is running from a 2A supply. Edit: ignore the comment above, they were bad 2.0A clone chargers, real 2.0A chargers are fine. |
@pieman64 Hello! Could you show your program for the pzem with Blynk? I do not know how to make them work. Thank you in advance! |
@DimChik2903 it's a little off topic but yesterday I published a Blynk project for the ACS712. If you check out my ESPecoMon © repository it should give you an idea how to incorporate the Pzem into a Blynk app. |
@pieman64 I can not figure out how to write a sketch to work with the hardware serial (RX/TX pin) on ESP8266. Could you add an example? Thank you in advance! |
@DimChik2903 hopefully @olehs will not mind us providing details of our Discourse Community site which covers our development of the PeaceFair product along with other energy monitoring systems. If you are still struggling with hardware serial please feel free to post a question at https://esppromon.com/t/peacefair-pzem-004t-energy-meters/24 |
@vortigont I've tried all sorts to upload to my NodeMCU 12E but nothing seems to work, I keep getting an error. I have pasted below. Can anybody help???? E:\DOCUME E:\DOCUME E:\Documents and Settings\Cube\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/HardwareSerial.h:75: undefined reference to `PZEM004T::setAddress(IPAddress const&)' E:\DOCUME E:\DOCUME E:\DOCUME E:\DOCUME E:\DOCUME E:\DOCUME E:\Documents and Settings\Cube\My Documents\Arduino\PZEM004T-master\examples\PZEMDisplay/PZEMDisplay.ino:13: undefined reference to `PZEM004T::current(IPAddress const&)' E:\Documents and Settings\Cube\My Documents\Arduino\PZEM004T-master\examples\PZEMDisplay/PZEMDisplay.ino:15: undefined reference to `PZEM004T::power(IPAddress const&)' E:\Documents and Settings\Cube\My Documents\Arduino\PZEM004T-master\examples\PZEMDisplay/PZEMDisplay.ino:18: undefined reference to `PZEM004T::energy(IPAddress const&)' E:\Documents and Settings\Cube\My Documents\Arduino\PZEM004T-master\examples\PZEMDisplay/PZEMDisplay.ino:21: undefined reference to `PZEM004T::PZEM004T(unsigned char, unsigned char)' E:\DOCUME E:\Documents and Settings\Cube\My Documents\Arduino\PZEM004T-master\examples\PZEMDisplay/PZEMDisplay.ino:21: undefined reference to `PZEM004T::PZEM004T(unsigned char, unsigned char)' E:\DOCUME E:\Documents and Settings\Cube\My Documents\Arduino\PZEM004T-master\examples\PZEMDisplay/PZEMDisplay.ino:24: undefined reference to `PZEM004T::~PZEM004T()' E:\DOCUME E:\Documents and Settings\Cube\My Documents\Arduino\PZEM004T-master\examples\PZEMDisplay/PZEMDisplay.ino:24: undefined reference to `PZEM004T::~PZEM004T()' collect2.exe: error: ld returned 1 exit status Using library SoftwareSerial at version 1.0 in folder: E:\Documents and Settings\Cube\Local Settings\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\SoftwareSerial |
@KPeare Looks like an issue in your sketch, it would be more informative you could provide your sketch. But, pls, do not paste it here, use for e.x. https://paste.ee/ or something like this. |
Hi, and thank you for your email @vortigontUnfortunately I have not had much spare time for this project.I have moved on a little with it, that being that I have added a few files into the project library but the sketch still will not complete. The sketch I am using is the PZEM004_1 taken from the github olehs site.
I guess I don't have the right library files at the moment for the sketch to complete.
Thanks for your support.
Regards
Kevin
Sent from my Samsung Galaxy smartphone.
-------- Original message --------From: vortigont <notifications@github.com> Date: 18/04/2018 11:41 (GMT+00:00) To: olehs/PZEM004T <PZEM004T@noreply.github.com> Cc: KPeare <kpeare@aol.com>, Mention <mention@noreply.github.com> Subject: Re: [olehs/PZEM004T] Question: Using the PZEM004T with an ESP8266 (#22)
@KPeare Looks like an issue in your sketch, it would be more informative you could provide your sketch. But, pls, do not paste it here, use for e.x. https://paste.ee/ or something like this.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi all! |
@Vadzz-K actually it's the same setup. "Serial" object you are using must be created first. |
Hi, @vortigont ! |
@vortigont and others that are using the PZEM with an ESP.
Are you using a voltage divider between ESP RX and PZEM TX rather than messing around with the change to R17 on the PZEM?
Are you using hard or soft serial for the interface and which pins are you using on the ESP?
The text was updated successfully, but these errors were encountered: