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

    M5Core problem with UART0

    Scheduled Pinned Locked Moved General
    esp-32 esp-8266iot
    4 Posts 3 Posters 11.9k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post