several PZEM004T to esp or just one
Moderators: grovkillen, Stuntteam, TD-er
several PZEM004T to esp or just one
Hi!
I have read lots of forum data about PZEM004T v3.
Now I wonder about current status of hooking up numeric devices to just one esp.
As I want to monitor almost every circuit in my main distribution a single esp might be great solution.
Thanks for your thoughts.
Bart
I have read lots of forum data about PZEM004T v3.
Now I wonder about current status of hooking up numeric devices to just one esp.
As I want to monitor almost every circuit in my main distribution a single esp might be great solution.
Thanks for your thoughts.
Bart
Re: several PZEM004T to esp or just one
No advices?
Re: several PZEM004T to esp or just one
Well as far as I know is this a modbus sensor.
So in theory you can have multiple connected to the same serial bus and each should be assigned an unique modbus address.
However I don't know for sure is the ESPEasy implementation of it does address the sensor at its specific address (or the standard "broadcast" address) and also how the modbus address should be set at the PZEM004T.
And if it can be set, will it be a persistent setting (thus still set after power cycle) ?
Thus I hoped someone may have experience with actually using multiple instances of this device on ESPEasy.
In theory it should be possible, but there are quite some "ifs".
So in theory you can have multiple connected to the same serial bus and each should be assigned an unique modbus address.
However I don't know for sure is the ESPEasy implementation of it does address the sensor at its specific address (or the standard "broadcast" address) and also how the modbus address should be set at the PZEM004T.
And if it can be set, will it be a persistent setting (thus still set after power cycle) ?
Thus I hoped someone may have experience with actually using multiple instances of this device on ESPEasy.
In theory it should be possible, but there are quite some "ifs".
Re: several PZEM004T to esp or just one
@ TD-er
See picture. Seems to be answer on my earlier question.
How to find more about the ESP-built?
I am having several PZEM004t units each having own address. Can I just hook these onto one ESP? If so, which? I own lots of ESP8266 NodeMCU's V3
Thanks!!
See picture. Seems to be answer on my earlier question.
How to find more about the ESP-built?
I am having several PZEM004t units each having own address. Can I just hook these onto one ESP? If so, which? I own lots of ESP8266 NodeMCU's V3
Thanks!!
- Attachments
-
- Afbeelding van WhatsApp op 2024-08-05 om 21.08.23_9dbd8b0b.jpg (231.86 KiB) Viewed 5610 times
Re: several PZEM004T to esp or just one
If the modbus modules each have their own unique address and are using the same baudrate (and other UART settings like "8N1", which is kind of standard, just mentioning it to be complete)
Then they should be wired to the same RX/TX pins.
Then they should be wired to the same RX/TX pins.
Re: several PZEM004T to esp or just one
You should better use an ESP32 (or ESP32-S3), that has much more RAM available for processing the data, and sending it to a Controller for multiple tasks.
And if you're buying that new, get one with 16 MB Flash memory, so you can use a MAX build that has all plugins and features included.
/Ton (PayPal.me)
Re: several PZEM004T to esp or just one
Also ESP32 (any type) has more hardware serial ports, which are way more reliable compared to software serial.
Re: several PZEM004T to esp or just one
Thanks so far for your information.
I flashed the software to NODEMCU 8266 (as I have those available now ) and are having 4 units in operation. Load seems to be < 10%.
Software serial pin D6 and D7 or GPIO 12 and 13.
Can I also have 4 units in parallel while hooking op towards hardware serial e.g. RX-TX GPIO 1-3 as I understood that's a better solution.?
TIA Bart
I flashed the software to NODEMCU 8266 (as I have those available now ) and are having 4 units in operation. Load seems to be < 10%.
Software serial pin D6 and D7 or GPIO 12 and 13.
Can I also have 4 units in parallel while hooking op towards hardware serial e.g. RX-TX GPIO 1-3 as I understood that's a better solution.?
TIA Bart
Re: several PZEM004T to esp or just one
Most boards have an USB to serial chip which may affect the signalling.
On ESP8266 you can swap the pins for Serial0 to GPIO pins (not the D-notation!) 13 and 15. In ESPEasy this is called Serial0_swapped.
However GPIO-15 must be in a specific state during boot, so you must then add a PNP transistor for it, which makes it a bit more complex.
If you're using Serial0 (or Serial0_swapped) you need to turn off the ESPEasy serial console (Tools->Advanced page, used to be called "Enable Serial")
If it is working fine now, using SoftwareSerial, then I would say, just leave it like it is now.
Switching to HardwareSerial will not lower CPU load significantly, but it will be with less read/write errors.
On ESP8266 you can swap the pins for Serial0 to GPIO pins (not the D-notation!) 13 and 15. In ESPEasy this is called Serial0_swapped.
However GPIO-15 must be in a specific state during boot, so you must then add a PNP transistor for it, which makes it a bit more complex.
If you're using Serial0 (or Serial0_swapped) you need to turn off the ESPEasy serial console (Tools->Advanced page, used to be called "Enable Serial")
If it is working fine now, using SoftwareSerial, then I would say, just leave it like it is now.
Switching to HardwareSerial will not lower CPU load significantly, but it will be with less read/write errors.
Re: several PZEM004T to esp or just one
I bought some devices ESP32-S3_WROOM-1 for this application.
I tried flashing via website TD-er but got error message.
I also tried keeping pressed BOOT button, tried keeping reset button and tried keeping both buttons.
Do I need a special BIN?
Why do the devicess is foreseen with two USB connections?
I noted that while hooked up the device to an UDB port boyh red and blue LED's where burning. The one in between just flickerd a few times.
BTW, this my first ESP32 (apart from a mini) so maybe I do something wrong. I am using lots of esp8266 devices.
Bart
I tried flashing via website TD-er but got error message.
I also tried keeping pressed BOOT button, tried keeping reset button and tried keeping both buttons.
Do I need a special BIN?
Why do the devicess is foreseen with two USB connections?
I noted that while hooked up the device to an UDB port boyh red and blue LED's where burning. The one in between just flickerd a few times.
BTW, this my first ESP32 (apart from a mini) so maybe I do something wrong. I am using lots of esp8266 devices.
Bart
- Attachments
-
- esp-forum.jpg (15.25 KiB) Viewed 3240 times
Re: several PZEM004T to esp or just one
How much Flash memory is available on that unit?
And what exact build did you choose to install?
/Ton (PayPal.me)
Re: several PZEM004T to esp or just one
What browser are you using?
Chrome is for sure supposed to work.
Those boards with 2 USB ports have one connected to native USB on the ESP chip and one to an USB to serial chip.
So please also try the other USB port.
Since those boards have 2x USB-C you may also want to try to rotate the USB cable 180 degree as not all USB-C cables have all pins wired internally.
You can also try to see in the device manager (Windows) if you get an extra serial port when the module is inserted.
If not, then either the driver isn't installed or the computer cannot communicate well with the serial port.
Chrome is for sure supposed to work.
Those boards with 2 USB ports have one connected to native USB on the ESP chip and one to an USB to serial chip.
So please also try the other USB port.
Since those boards have 2x USB-C you may also want to try to rotate the USB cable 180 degree as not all USB-C cables have all pins wired internally.
You can also try to see in the device manager (Windows) if you get an extra serial port when the module is inserted.
If not, then either the driver isn't installed or the computer cannot communicate well with the serial port.
Re: several PZEM004T to esp or just one
@ Ath
How can I know? Does N8R2 makes sense?
I tried 4M Flash SPIFFS 20240822 Energy 4M [ESP8266,ESP32,ESP32-S2/S3/C3]
@TD-er
I'm using Chrome
I tried both USB connections. Also turned connector upside down
I tried to flash from https://td-er.nl/ESPEasy/ There it's clearly mentioned which port belongs to this ESP xx Espressif
All goes fine until there s message as in previous picture
How can I know? Does N8R2 makes sense?
I tried 4M Flash SPIFFS 20240822 Energy 4M [ESP8266,ESP32,ESP32-S2/S3/C3]
@TD-er
I'm using Chrome
I tried both USB connections. Also turned connector upside down
I tried to flash from https://td-er.nl/ESPEasy/ There it's clearly mentioned which port belongs to this ESP xx Espressif
All goes fine until there s message as in previous picture
Re: several PZEM004T to esp or just one
That's an 8MB Flash with 2MB PS-RAM unit.
You could try the 8MB MAX with PS-RAM option (Only available for S3) from https://td-er.nl/ESPEasy/ as some boards act a bit weird when PS-RAM is available, but not initialized properly. That MAX build includes _all_ available options and plugins
/Ton (PayPal.me)
Re: several PZEM004T to esp or just one
Just some additional info on Ton's reply.
The S3 with 16M flash is available with and without PSRAM.
However the 8 MB PSRAM is wired differently internal compared to the 2 MB PSRAM.
For the ESP32-S3 with 8 MB PSRAM modules you need a specific build which has PSRAM in the name.
If you're flashing the wrong one on those boards, the board will enter a boot loop.
There is no build for ESP32-S3 with 8 MB flash with "PSRAM" in the name as those boards with 8 MB PSRAM only exist for 16M flash units.
Espressif made it quite complex for the S3, but I hope it is clear when you mainly follow the flash sizes and only pick "PSRAM" build on those 16MB flash units which do have PSRAM (thus have 8 MB PSRAM)
The S3 with 16M flash is available with and without PSRAM.
However the 8 MB PSRAM is wired differently internal compared to the 2 MB PSRAM.
For the ESP32-S3 with 8 MB PSRAM modules you need a specific build which has PSRAM in the name.
If you're flashing the wrong one on those boards, the board will enter a boot loop.
There is no build for ESP32-S3 with 8 MB flash with "PSRAM" in the name as those boards with 8 MB PSRAM only exist for 16M flash units.
Espressif made it quite complex for the S3, but I hope it is clear when you mainly follow the flash sizes and only pick "PSRAM" build on those 16MB flash units which do have PSRAM (thus have 8 MB PSRAM)
Re: several PZEM004T to esp or just one
Bad luck! No flash possible.
What do you advice?
Throw away these?
What do you advice?
Throw away these?
Re: several PZEM004T to esp or just one
Can you try with the Espressif Download tool?
It is included in the release build ZIP files and also here: https://github.com/letscontrolit/ESPEas ... tool_3.9.6
Or you can download it from the Espressif site: https://www.espressif.com/en/support/download/all (called "Flash Download Tools")
Make sure to use a "factory.bin" file and set the offset to 0 bytes.
It is included in the release build ZIP files and also here: https://github.com/letscontrolit/ESPEas ... tool_3.9.6
Or you can download it from the Espressif site: https://www.espressif.com/en/support/download/all (called "Flash Download Tools")
Make sure to use a "factory.bin" file and set the offset to 0 bytes.
Re: several PZEM004T to esp or just one
pfff
downloaded the flastool but it confuses me a bit because it overwhelmes me with bin files someting as we dutch say to may trees in the wood.
can you advice me which bin to use? And from the downloadtool I found bthere must be 3 files combined?
downloaded the flastool but it confuses me a bit because it overwhelmes me with bin files someting as we dutch say to may trees in the wood.
can you advice me which bin to use? And from the downloadtool I found bthere must be 3 files combined?
Re: several PZEM004T to esp or just one
Nope you do not need to combine anything. Only a single file is needed.
Just to be complete, when using the Espressif Download Tool:
- For ESP8266 you need a ".bin" file and not the ".bin.gz"
- For ESP32 (any variant) you need a bin file with "factory" in the name.
The next column labelled "@" should contain a 0 as you have to start writing at the start of the flash.
Thus the file you need for an ESP32-S3 with 8M flash should be something like this:
ESP_Easy_mega_20240902_max_ESP32s3_8M1M_LittleFS_CDC_ETH.factory.bin
N.B. The date can of course differ
Just to be complete, when using the Espressif Download Tool:
- For ESP8266 you need a ".bin" file and not the ".bin.gz"
- For ESP32 (any variant) you need a bin file with "factory" in the name.
The next column labelled "@" should contain a 0 as you have to start writing at the start of the flash.
Thus the file you need for an ESP32-S3 with 8M flash should be something like this:
ESP_Easy_mega_20240902_max_ESP32s3_8M1M_LittleFS_CDC_ETH.factory.bin
N.B. The date can of course differ
Re: several PZEM004T to esp or just one
well, there is progress but nu good result yet
how to?
how to?
Re: several PZEM004T to esp or just one
Hm still looking real strange, don't own a single module (I have several dozens here ) that cause me this kind of issues, since I started using ESPs.
A few things to check:
- If you press the boot button and click reset shortly to enable flashing, once the upload has started, release the boot button so the reset afterward, triggered by the uploader, will not keep it in flash-mode
- Have you considered replacing the USB cable that is used?
- Or try another USB port on the computer?
A few things to check:
- If you press the boot button and click reset shortly to enable flashing, once the upload has started, release the boot button so the reset afterward, triggered by the uploader, will not keep it in flash-mode
- Have you considered replacing the USB cable that is used?
- Or try another USB port on the computer?
/Ton (PayPal.me)
Re: several PZEM004T to esp or just one
Ath,
I tried your suggestions. The results are in the picture.
I tried several more bin files but all giving same result. But I could not get back the action writing the dots on the screen. So in fact (imho) flash failed.
I tried your suggestions. The results are in the picture.
I tried several more bin files but all giving same result. But I could not get back the action writing the dots on the screen. So in fact (imho) flash failed.
Re: several PZEM004T to esp or just one
Hm, do you have a spare ESP available? As it is of course possible, this one is broken... (DOA)
/Ton (PayPal.me)
Re: several PZEM004T to esp or just one
Good news today.
I once tried again flashing via website TD-er.
I noticed that this time there was a com-port found with ID : USB JTAG/serial debug unit serial (COM10) whereas before it said: USB 2.0-Ser! (COM10)
So I presume there are different drivers required for this ESP32 compared to ESP8266.
I was able to flash the bin file: ESP_Easy_mega_20240822_max_ESP32s3_8M1M_LittleFS_CDC_ETH
So it seems I can now continue using the device with my applications. I think I will start with the 'project as mentioned in the subject of this thread:
"several PZEM004T to esp"
Ton and Gijs, thanks again for your patient and helpness.
-Bart
I once tried again flashing via website TD-er.
I noticed that this time there was a com-port found with ID : USB JTAG/serial debug unit serial (COM10) whereas before it said: USB 2.0-Ser! (COM10)
So I presume there are different drivers required for this ESP32 compared to ESP8266.
I was able to flash the bin file: ESP_Easy_mega_20240822_max_ESP32s3_8M1M_LittleFS_CDC_ETH
So it seems I can now continue using the device with my applications. I think I will start with the 'project as mentioned in the subject of this thread:
"several PZEM004T to esp"
Ton and Gijs, thanks again for your patient and helpness.
-Bart
Re: several PZEM004T to esp or just one
Great!
That's the difference when connecting either of the USB ports of the ESP-S3 board you own. The USB JTAG is detected for the direct USB connection to the ESP (CDC), and USB 2.0-Ser is for when connected via the UART port of the board.
/Ton (PayPal.me)
Re: several PZEM004T to esp or just one
The USB port you now used (reporting its serial port as "JTAG" in Windows Device Manager) is a simulated serial port.
So the ESP does act as an USB device to Windows then.
This also means it must do some stuff in software to emulate these ports.
If for whatever reason your board was flashed with some code which does not enable this emulated port, then you can't get the board to flash via this port... well unless you do a lot of button pushing in a specific order...
The other USB port on the ESP board is wired to an USB to serial chip.
This makes it easier to recover from such flash mishaps where the ESP may not (or no longer) do the device emulation.
For my own development I try to use those dual-USB port boards for this reason.
However this also means that if you have a board with only such emulated serial ports, you can experience quite some issues to get it to work again.
Some boards have the 2 ports labelled on the silk screen.
Like "OTG", "JT", "JTAG" or "USB" for the emulated serial ports.
And "UART", "SER" or "S0" for the USB port connected to the USB to serial chip.
And of course there are boards out there which have no marking at all and the USB to serial chip exactly in the middle of both USB ports.
To make matters worse... USB-C can be connected in both orientations of the plug.
But not all boards have 2x 5.1 kOhm resistor present on the CC pins and/or not all A/B pins wired.
Combine this with some cheap USB-C cables which also have not all pins wired in the USB-C connector and you end up in a lot of combinations where it will not work at all or not work well when the USB port is not set to deliver the needed max. current.
TL;DR
I can think of lots of causes why you had issues flashing your board.
Hopefully you understand how to successfully flash a board.
Typically:
- try the other USB port
- try rotating the USB connector
- try another USB cable (IKEA does have quite good cables for a fair price)
So the ESP does act as an USB device to Windows then.
This also means it must do some stuff in software to emulate these ports.
If for whatever reason your board was flashed with some code which does not enable this emulated port, then you can't get the board to flash via this port... well unless you do a lot of button pushing in a specific order...
The other USB port on the ESP board is wired to an USB to serial chip.
This makes it easier to recover from such flash mishaps where the ESP may not (or no longer) do the device emulation.
For my own development I try to use those dual-USB port boards for this reason.
However this also means that if you have a board with only such emulated serial ports, you can experience quite some issues to get it to work again.
Some boards have the 2 ports labelled on the silk screen.
Like "OTG", "JT", "JTAG" or "USB" for the emulated serial ports.
And "UART", "SER" or "S0" for the USB port connected to the USB to serial chip.
And of course there are boards out there which have no marking at all and the USB to serial chip exactly in the middle of both USB ports.
To make matters worse... USB-C can be connected in both orientations of the plug.
But not all boards have 2x 5.1 kOhm resistor present on the CC pins and/or not all A/B pins wired.
Combine this with some cheap USB-C cables which also have not all pins wired in the USB-C connector and you end up in a lot of combinations where it will not work at all or not work well when the USB port is not set to deliver the needed max. current.
TL;DR
I can think of lots of causes why you had issues flashing your board.
Hopefully you understand how to successfully flash a board.
Typically:
- try the other USB port
- try rotating the USB connector
- try another USB cable (IKEA does have quite good cables for a fair price)
Who is online
Users browsing this forum: No registered users and 0 guests