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

    ISO RS485 on M5dial

    PRODUCTS
    3
    11
    1.7k
    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.
    • M
      mukul_100_
      last edited by

      Hi, So i have a ISO RS485 and i need to get modbus working on it. The primary problem im facing is that the module is UART based and by my understanding M5Dial has I2C and GPIO ports. Is it as simple as hardware serial and setting 1 and 2 pins to UART or is there something else to it
      Also it would be great help if there are any modbus library that can be used.
      Thank You

      robskiR 1 Reply Last reply Reply Quote 0
      • robskiR
        robski @mukul_100_
        last edited by

        @mukul_100_ what software you planning to use?
        see uiflow2 init example
        dial_iso485.JPG

        M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ

        M 1 Reply Last reply Reply Quote 0
        • M
          mukul_100_ @robski
          last edited by

          i am using platformio right now. thanks

          felmueF 1 Reply Last reply Reply Quote 0
          • felmueF
            felmue @mukul_100_
            last edited by

            Hello @mukul_100_

            please find an example here with M5Dial and RS485 unit controlling an ACSSR relay via Modbus protocol.

            Thanks
            Felix

            GPIO translation table M5Stack / M5Core2
            Information about various M5Stack products.
            Code examples

            M 1 Reply Last reply Reply Quote 0
            • M
              mukul_100_ @felmue
              last edited by

              @felmue hi felix sorry for the late reply, finally got a chance to get back to this

              i studied the example but not sure if i understood how to implement the master slave concept through this and also there is a error thrown in
              RS485Class RS485(Serial2, GPIO_NUM_1, GPIO_NUM_2, -1, -1);

              as there are only 4 arguments accepted by the class
              also serial2 needs some tweaking for esp32 right?
              thanks

              felmueF 1 Reply Last reply Reply Quote 0
              • felmueF
                felmue @mukul_100_
                last edited by

                Hello @mukul_100_

                I linked the incorrect variants for RS485 and Modbus libraries. Sorry about that. I fixed the example. The libraries I used are the ones from M5Stack.

                https://github.com/m5stack/ArduinoModbus
                https://github.com/m5stack/ArduinoRS485

                Thanks
                Felix

                GPIO translation table M5Stack / M5Core2
                Information about various M5Stack products.
                Code examples

                M 1 Reply Last reply Reply Quote 0
                • M
                  mukul_100_ @felmue
                  last edited by

                  @felmue Hi felix
                  the changes you mentioned are in the same example code that is linked above?

                  felmueF 1 Reply Last reply Reply Quote 0
                  • felmueF
                    felmue @mukul_100_
                    last edited by

                    Hello @mukul_100_

                    yes.

                    Thanks
                    Felix

                    GPIO translation table M5Stack / M5Core2
                    Information about various M5Stack products.
                    Code examples

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      mukul_100_ @felmue
                      last edited by

                      @felmue ,did you make any changes in the RS485.h file
                      along these line 46
                      #else
                      #ifndef RS485_DEFAULT_DE_PIN
                      #define RS485_DEFAULT_DE_PIN A6
                      #define RS485_DEFAULT_RE_PIN A5
                      #endif

                      thanks,
                      Mukul

                      felmueF 1 Reply Last reply Reply Quote 0
                      • felmueF
                        felmue @mukul_100_
                        last edited by

                        Hello @mukul_100_

                        No.

                        I think you are still on the library I incorrectly linked to in my example before.

                        Incorrect library: https://github.com/arduino-libraries/ArduinoRS485

                        Library I used: https://github.com/m5stack/ArduinoRS485

                        Thanks
                        Felix

                        GPIO translation table M5Stack / M5Core2
                        Information about various M5Stack products.
                        Code examples

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          mukul_100_ @felmue
                          last edited by

                          @felmue Hi, felix i got it working finally. The issue is, on platformIO the library Arduinomodbus library and ArduinoRS485 library are the arduino ones and not the m5stack ones which is why i was getting error.
                          A fix to this was to just replace the internal files of library to the m5stack ones from github.
                          Thank you for the help.

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