🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Core problem with UART0

    General
    esp-32 esp-8266 iot
    3
    4
    9.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      nikza5566
      last edited by

      I use PZEM V4.0 for my project, so I want to use it for 2 and I connect to TXRXD0,TXRXD2 and this is my code.

      #include <PZEM004Tv30.h>
      
      PZEM004Tv30 pzem(&Serial);
      PZEM004Tv30 pzem2(&Serial2);
      
      void setup() {
        Serial.begin(115200);
      
        Serial.print("Reset Energy");
        pzem.resetEnergy();
        pzem2.resetEnergy();
      
        Serial.print("Set address to 0x42");
        pzem.setAddress(0x42);
        pzem2.setAddress(0x42);
      }
      
      void loop() {
      
        float cur = pzem.current();
        Serial.print("Current: ");
        Serial.print(cur);
        Serial.println("A");
      
        float cur2 = pzem2.current();
        Serial.print("Current 2: ");
        Serial.print(cur2);
        Serial.println("A");
      
        delay(1000);
      }
      

      The result is not showing the value of UART0 (pin GPIO1,3).
      How can I fix this?

      M 1 Reply Last reply Reply Quote 0
      • M
        macsbug @nikza5566
        last edited by

        @nikza5566

        Level converter is required for connection.

        1. resistor to connect
          Meter PZEM-004T with Arduino ESP32 ESP8266 Python & Raspberry Pi
          Modification TTL UART from 5v to 3.3v
          http://pdacontrolen.com/meter-pzem-004t-with-arduino-esp32-esp8266-python-raspberry-pi/

        2. level converter to connect
          Measuring home energy consumption with the PZEM004T and ESP8266
          https://primalcortex.wordpress.com/tag/pzem004t/

        1 Reply Last reply Reply Quote 0
        • T
          Thrasher
          last edited by

          @nikza5566 said in M5Core problem with UART0:

          PZEM V4.0

          Also, Im not sure about your wiring, but you're using software serials, you should keep speed at 9600. My multiple experiments with rs485 and software serial show unstable results on speed beyond 9600

          N 1 Reply Last reply Reply Quote 0
          • N
            nikza5566 @Thrasher
            last edited by

            @thrasher Sorry for my bad writing.
            So I want to use 2 piece of PZEM for my project and I test PZEM that connect to UART2 it can send value to monitor with speed 115200 and then I test to PZEM that connect to UART0 it not show any value excpet "NaN" from my monitor. how can I fix this?

            1 Reply Last reply Reply Quote 0
            • First post
              Last post