mandulaj / PZEM-004T-v30

Arduino library for the Updated PZEM-004T v3.0 Power and Energy meter
MIT License
256 stars 108 forks source link

always getting error reading message with default example #23

Closed mcfly4711 closed 3 years ago

mcfly4711 commented 4 years ago

Hi I am using an Arduino Uno and tried to connect the PZEM-004-v30 RX -->D11 and TX --> D12. when I compiled and uploaded the default example I gets always the following message in the serial monitor. Error reading voltage Error reading current Error reading power Error reading energy Error reading frequency Error reading power factor

code which i have used:

include

/* Use software serial for the PZEM

void setup() { Serial.begin(115200); }

void loop() { float voltage = pzem.voltage(); if( !isnan(voltage) ){ Serial.print("Voltage: "); Serial.print(voltage); Serial.println("V"); } else { Serial.println("Error reading voltage"); }

float current = pzem.current();
if( !isnan(current) ){
    Serial.print("Current: "); Serial.print(current); Serial.println("A");
} else {
    Serial.println("Error reading current");
}

float power = pzem.power();
if( !isnan(power) ){
    Serial.print("Power: "); Serial.print(power); Serial.println("W");
} else {
    Serial.println("Error reading power");
}

float energy = pzem.energy();
if( !isnan(energy) ){
    Serial.print("Energy: "); Serial.print(energy,3); Serial.println("kWh");
} else {
    Serial.println("Error reading energy");
}

float frequency = pzem.frequency();
if( !isnan(frequency) ){
    Serial.print("Frequency: "); Serial.print(frequency, 1); Serial.println("Hz");
} else {
    Serial.println("Error reading frequency");
}

float pf = pzem.pf();
if( !isnan(pf) ){
    Serial.print("PF: "); Serial.println(pf);
} else {
    Serial.println("Error reading power factor");
}

Serial.println();
delay(2000);

}

any Idea what I am doing wrong?

mandulaj commented 4 years ago

Hey, did you make sure to connect the module to the AC? It is actually not powered by the 5V you give it from the Arduino. It uses the AC to power itself. The 5V only power the opto-couplers which isolate your Arduino form the mains....

mcfly4711 commented 4 years ago

Thx for your email.Yes Ac 230V is connected but not CT.It seams for me that there is no signal pn RX port. No Led flashing like on TX.Am 21.04.2020 14:15 schrieb Jakub Mandula notifications@github.com: Hey, did you make sure to connect the module to the AC? It is actually not powered by the 5V you give it from the Arduino. It uses the AC to power itself. The 5V only power the opto-couplers which isolate your Arduino form the mains....

—You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub, or unsubscribe.

mandulaj commented 4 years ago

Hmm. that is strange. The CT not connected should not be causing any issues (you will just read 0 current).

Could you try this, swap the RX and TX wires. Maybe you have them the other way around

mcfly4711 commented 4 years ago

I will test in the evening:-)Am 21.04.2020 15:44 schrieb Jakub Mandula notifications@github.com: Hmm. that is strange. The CT not connected should not be causing any issues (you will just read 0 current). Could you try this, swap the RX and TX wires. Maybe you have them the other way around

—You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub, or unsubscribe.

mcfly4711 commented 4 years ago

No changes. I checked connection snd changed TX and RX.  But it was wired correctly.Am 21.04.2020 15:49 schrieb ralf.kallfass@my-webspace.de:I will test in the evening:-)Am 21.04.2020 15:44 schrieb Jakub Mandula notifications@github.com: Hmm. that is strange. The CT not connected should not be causing any issues (you will just read 0 current). Could you try this, swap the RX and TX wires. Maybe you have them the other way around

—You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub, or unsubscribe.

ilomon10 commented 3 years ago

Any update?

mcfly4711 commented 3 years ago

Flapping connection :-( thx for your support

Jzstay commented 7 months ago

did you resolve it?

Jemeeeeer commented 3 months ago

im having the exact same problem. any update on how you resolved the issue?

Jemeeeeer commented 3 months ago

Flapping connection :-( thx for your support

what was the issue?

mcfly4711 commented 3 months ago

No I could not fix it -------- Ursprüngliche Nachricht --------Von: Jemeeeeer @.> Datum: 02.04.24 06:02 (GMT+01:00) An: mandulaj/PZEM-004T-v30 @.> Cc: mcfly4711 @.>, State change @.> Betreff: Re: [mandulaj/PZEM-004T-v30] always getting error reading message with default example (#23)

Flapping connection :-( thx for your support

what was the issue?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: @.***>