-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
DC meter from Peacefair with RS485 #3694
Comments
I have a PZEM-014 and a PZEM-017 on order. They both use Modbus communication using the serial interface as did the PZEM-004T. The default interface is 5V. Hopefully it can be adjusted to 3V3 as I used on the PZEM-004T. Let's see. |
Add experimental support for PZEM-003,014,016,017 Energy monitoring (#3694)
Just release experimental support for PZEM-003,014,016,017. If you manage to connect the PZEM device to a esp8266 device then configure the GPIOs as below Pay attention to the correct numbers: 99 PZEM Rx and 98 PZEM Tx. Do not select 63 PZEM Rx and 62 PZEM Tx as they will service the PZEM-004T. This naming scheme may change in the future but I also may want to incorporate all PZEM devices in one driver. Time will tell. If you have connected the device try to gather some debug information using the web console (do not use a serial connection as that is being used by the PZEM unless you configure other GPIOs but that may lead to timeouts). Pls provide some output here (if any ;-)) This is experimental as I do not own a device yet but the info is from the documentation available from PeaceFair. |
@arendst you are awesome, i truly appreciate you and all you have done with Tasmota. Thanks alot. Thanks |
Hi, can I test this release? I got PZEM-016 with TTL to RS485 converter. where I can download this release? Regards. |
Hi, I install this version and try to get communication on modbus but keep getting errors. Looks my PZEM device is broken... |
I use this one MAX3485 Module TTL To RS485 Module MCU Development Accessories But as I post earlyer my PZEM is broken. @arendst, is it normal that tasmota gets errors from this TTL2RS485 even if there is nothing connected to 485 terminal? |
As noted here (#2694 (comment)) I'm not sure if your module will function correctly. I don't know what errors you receive but as I still have to tune the comms between Tasmota and the PZEMs I guess it's picking up noise that Tasmota currently does not process. |
Hi! I ordered a Pzem-016 too. I would like to connect the ESP directly to the serial TTL lines on-board. Have someone tried it? |
6.2.1.16 20181015 * Add TasmotaModbus library for very basic modbus wrapper for TasmotaSerial * Change xsns_17_senseair.ino to use TasmotaModbus library * Fix xnrg_05_pzem2.ino for PZEM-014/016 support using TasmotaModbus library (#3694)
Hi! I finally got it working without the RS485 interface! Here are the modifications that I made:
Here is the final assembly adding a ESP8266 board inside the case: I use the hardware serial with the latest release and it works like a charm. Thanks @arendst for your amazing work 👍 |
Hi, Closing issue as now it is implemented in Tasmota. Thanks all for sharing their work and ideas. |
6.2.1.17 20181017 * Enable updated non-blocking PubSubClient as default MQTT client * Update TasmotaModbus and TasmotaSerial libraries for support of serial 8N2 communication * Add support for Pzem-003/017 DC Energy monitoring module (#3694) * Change support for Pzem-014/016 AC Energy monitoring module (#3694)
Important PZEM module configuration change as of version 6.2.1.17: To distinguish between the PZEM-014/016 (AC) and PZEM-003/017 (DC) I had to split the drivers and redesign the pin configuration for all supported PZEM modules. For PZEM-004T use PZEM0XX Tx and PZEM004 Rx |
I just got my converter in and tried it with the PZEM-016 I have, and it seems to work great! (Using 98 & 61) I do have a feature request though: Would it be possible to talk to more than one? Since I have a split phase power system, I need 2 modules to monitor total power consumption, and these are modbus devices so their meant to have many devices on one bus. The PZEM-016 manual says the node address is selectable in register 0x0002, and is selectable from 1-127, so there should be no technical limitation to having multiple PZEM devices on one bus. As to setting the device node address within tasmota, if it's not the simplest thing to do, or not desirable for tasmota to modify the devices' node address, could it be selectable to either read a single device at the default address, or to select how many devices are on the bus and choose which address they are at, to allow for more advanced multi-node configurations? |
It's not only a matter of connecting but also of representation either thru GUI or JSON. Currently only ONE energy monitoring module is supported. |
I understand that displaying the data would be difficult, and I don't have a good solution to that; but having to configure it over the command interface and just reporting the data over MQTT would be plenty satisfactory. |
How can I reset kWh couter to 0? |
Search wiki for command |
@arendst, thanks I was trying to do it over serial bridge using "SerialSend5 01421180" Is it possble to comunicate with PZEM 016 like that? |
Hello @vicfergar. Thanks for the nice instructions and pictures. I will recive my PZEM 016 in a few days and will do the same any chance you could add some more pictures of the soldered resistors? From the picture I can only see one solder on the board but your illustration shows two. |
Hi @hteggi! I'm glad that this work helps you. You are right, 2 resistors are needed both with the same value of 2K ohms. Because of the distance between the pads, I used one through hole and another SMD. That last one is visible in the second picture, you can see an small SMD resistor labeled with 202 between the pads of the TX optocoupler. Hope it works for you too! |
If someone's having similar question, a 3-month testing tells me that it's ok to feed the data directly from ESP, without pulldowns or anything else in between, and it's reporting data to my Home Assistant server nicely. Also, I didn't put a resister between the TX of PZEM017 and ESP's RX. |
Thank you all for this great ideas and work! I am currently prepring to monitor my boat´s batteries with this solution in the winterstock, while some systems stay up and online there. This is possible because of energy harvesting by solar panels and wind generator. But this includes the neccessarity to count not only one way. The batteries are charged over the day, while in the night the consumption typically is higher. So far I understand, that the PZEM 017 can only measure one way. That´s why I am thinking to take simply two, connect them to the same shunt, but one other way round connected. Since the PZEMs did not arrive so far, I cannot test it, but generally it should work. The only thing is - I don´t want to use an ESP for each. Is there a way to enable the Tasmota software of one ESP to ask up to 4 different PZEMs over different modbus adresses? The calculations about the energy balance sheet and taking Peukert factor into account would be calculated externally in the RasPI. Target is a complete battery monitoring of service and starter batteries and the ability to manage the systems on the boat in dependency of the availability of energy. |
PZEM 017 measures the current in two directions, when there is a charge and the discharge, it counts everything with a + sign. Therefore, it will not be clear how much has been discharged, how much has been charged. Therefore, using two pieces will be useless. |
You can use INA 219, it measures in two directions with positive and negative readings. |
Thank you for this information. Now I will be aware, that this is possible. But from where you got this information? |
You can have up to 3 PZEM max per tasmota. |
As for the PZEM 017, I also thought to put 2 pcs. in two directions, but it did not work out since they measure the negative current as positive. And I connected INA219 to a shunt of 100A and I measure the voltage 60V through a resistor divider 1/3, 20V comes to INA219, and in fact 60 and I adjust it with the formula. |
I understand, that my original plan might not work, like expected. barbudor, can you enlighten me, how to connect up to 3? I only understand to configure two GPIOs as serial interface for modbus PZEM communication. As far as I have seen, it seems that the modbus address for PZEM is hardcoded to 1 in the source code of tasmota. How to arrange, that tasmota is asking other adresses over the same bus? |
Searching a bit and you would have found Up to know Tasmota has been designed for monitoring a single point of power. 3 is the maximum number of phases that you will encounter in real life. |
Ok. Thank you for your fast answer. That tasmota is currently designed for one connection to a PZEM corresponds to my still very little understanding of current solution. I just wandered, if someone has ideas, how to use modbus as a real bus with tasmota and just ask several of this PZEM devices then only one. I found a first hook in the source code, where tasmota communicates with exact this one PZEM adress and I might be able to extend this. But since I not really understand the whole tasmota architecture yet, I am afraid, I need some help. |
You asked about 3 PZEM, I told you:
To monitor batteries / DC, look at INA219/226 but be careful about ground management |
@Oleg-Sob |
OK pzem017 is for dc |
Ok. Seams that the feature is already existing up to 3 PZEMs. I can still only guess, bcause I can not try, due to missing PZEMS. From the information what I think to understand now, there is the When there are adress 1 and 2 or 1, 2 and 3 the tasmota automatically reads them all and represents them in the homescreen like seen above.(?) That seams to be partially described in change log to 6.6.0.12 20190910 for me. Thank you all, so activly helping here! |
Pzem 017 does not show negative currents, I use ina 226. |
Hey guys, Maybe not right place but i hope someone can help me with an answer or point me to the right topic... i am using a PZEM 17, an arduino mega and a MAX 485 to read it out. since i am using it to measure the voltage of solarpanels my measuring voltage drops below 7 volts at night. I saw a hack for the PZEM 04 to change it so you can use an external power supply so it keeps measuring in the night. Does anyone know if there is a hack for the PZEM 017 to or a way to work around the problem that my PZEM 017 starts measuring in the morning? When i try to recreate this exact problem with lab bench power supply (turn the voltage to 0 wait a couple minutes and then turn it up to 7 volts) the problem does not exist but with the solar panels it just doesnt start measuring in the morning. Thanks in advance! |
In the documentation it says that if the voltage drops below 7v it can be powered through the usb port but taking into account not to do it from a pc because it could be damaged, I would use a smartphone charger. |
I encountered the same situation. Have you solved it yet? help me. Thanks |
I have 3 pieces of PZEM 17 working on one ESP 8266. In order for them to work, first set different addresses through the PZEM003-Master application, 1, 2, 3 |
Can you help me share more specifically? Thanks. |
You can do it from tasmota |
On esp8266 there is only (tx + rx). How do I get (tx+rx)1 + (tx+rx)2 + (tx+rx)3. Every time I disconnect a pzem 017, I plug it into one pin (tx+rx) of the esp8266? and it automatically recognizes as below.pzem017-1 type "Module Address 1" to(tx+rx) to disconnect. then pzem017-2 type "Module Address 2" to(tx+rx). Similar to pzem 017-3. Thank you very much. Have a good day. |
PZEM use RS485 which is a bus. You should never use the command ModuleAddress with more than 1 module connected otherwise you will change the address of all connected modules |
I'd like to ask about PZEM-016 and Tasmota. |
Nope, unless you shutdown Tasmota before the (planned) power outage occurs. |
Having just read about the support for PZEM004T Energy Monitor from Peacefair. I'm just wondering if it will be possible to add support for PZEM-003 and PZEM-017 DC meter with RS485 from same manufacturer (Peacefair). I have use cases where Sonoff 4CH Pro, Sonoff SV & Shelly 1 will be used with PZEM-017 DC meter for DC (Solar) power metering and switching?
The PZEM-003 and PZEM-017 DC meter uses RS485 to communicate.
@arendst i can donate the PZEM-003 or PZEM-017 DC meter from Peacefair if you don't already have but think its possible to support it.
The text was updated successfully, but these errors were encountered: