xoseperez / espurna

Home automation firmware for ESP8266-based devices
http://tinkerman.cat
GNU General Public License v3.0
2.99k stars 636 forks source link

Error reading data from PZEM004T @ HwSerial (error: 3) #1840

Closed klotzma closed 5 years ago

klotzma commented 5 years ago

Hello,

I flashed the espurna firmware on a wemos d1 mini pro, everything according to instructions in the Sensor.h changed so:

ifndef PZEM004T_SUPPORT

define PZEM004T_SUPPORT 0

endif

ifndef PZEM004T_USE_SOFT

define PZEM004T_USE_SOFT 0 // Software serial is not working atm, use hardware serial

endif

ifndef PZEM004T_RX_PIN

define PZEM004T_RX_PIN 13 // Software serial RX GPIO (if PZEM004T_USE_SOFT == 1)

endif

ifndef PZEM004T_TX_PIN

define PZEM004T_TX_PIN 15 // Software serial TX GPIO (if PZEM004T_USE_SOFT == 1)

endif

ifndef PZEM004T_HW_PORT

define PZEM004T_HW_PORT Serial // Hardware serial port (if PZEM004T_USE_SOFT == 0)

endif

ifndef PZEM004T_ADDRESSES

define PZEM004T_ADDRESSES "1.1.1.1 2.2.2.2 3.3.3.3" // Device(s) address(es), separated by space, "192.168.1.1 192.168.1.2 192.168.1.3"

endif

ifndef PZEM004T_READ_INTERVAL

define PZEM004T_READ_INTERVAL 1500 // Read interval between same device

endif

ifndef PZEM004T_MAX_DEVICES

define PZEM004T_MAX_DEVICES 3

endif

I have now according to instructions soldered the BAT diodes and resistance to circuit diagram, because I later want to have 3 PZEM004T in a bus. TX from Wemos to RX PZEM004t, RX from Wemos to TX PZEM and ground to ground.

Now this error comes and I can not assign a pzem004t address.

[039629] [WEBSOCKET] Requested action: dbgcmd [040319] [SENSOR] PZEM004T [040323] Device 0/1.1.1.1 [040325] Device 1/2.2.2.2 [040329] Device 2/3.3.3.3 [040331] +OK [045859] [SENSOR] Error reading data from PZEM004T @ HwSerial (error: 3)

Can someone help me ?

mcspr commented 5 years ago

Closing per https://gitter.im/tinkerman-cat/espurna?at=5d4c8a56c87a0963e737b876 The board in question is PZEM004T V3.0, which is not supported by the library used here: https://github.com/olehs/PZEM004T

However, there is working example of how to talk to the new board: https://github.com/mandulaj/PZEM-004T-v30 https://innovatorsguru.com/pzem-004t-v3/ https://innovatorsguru.com/wp-content/uploads/2019/06/PZEM-004T-V3.0-Datasheet-User-Manual.pdf Since I am not familiar with modbus thing used there, it is unclear how to use this with multiple PZEMs

And https://github.com/xoseperez/espurna/wiki/Sensor-PZEM004T would need a note that it is only applicable to the old V1 board