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

    2RELAY on Core2 v1.13.6

    Modules
    3
    22
    2.9k
    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.
    • R
      Robertof @cryptospok
      last edited by Robertof

      Hello @cryptospok :
      It worked well on my hardware. In the example I will send you, you can alternate the address between 0x25 (default) and 0x30. If the M5 is disconnected while the address is set to 0x30, you will have a problem.

      This can possibly be solved by writing the address to the EEPROM and retrieving it at startup.

      Best regards,
      Roberto.

      1 Reply Last reply Reply Quote 0
      • R
        Robertof
        last edited by

        uiflow_block_1723765936020.png

        cryptospokC 1 Reply Last reply Reply Quote 0
        • R
          Robertof @cryptospok
          last edited by

          @cryptospok Captura de pantalla 2024-08-16 021823.png

          1 Reply Last reply Reply Quote 0
          • cryptospokC
            cryptospok @felmue
            last edited by

            Hi Felix,

            I removed the original battery and the gray part, bought the M5GO2 to replace it, but now I'm not even using it.
            I'm trying with just one module, but when I use the examples (I tried with my code and it didn't work either), I get the message that the module is not attached... I tried with each of them individually.

            Thank you.

            R 1 Reply Last reply Reply Quote 0
            • cryptospokC
              cryptospok @Robertof
              last edited by

              Hi @Robertof,

              Did you use UIFlow1?
              I didn't find the 2RELAY module in UIFlow2.
              I'll try to reproduce your tip and see if it works.

              Thanks!

              R 2 Replies Last reply Reply Quote 0
              • R
                Robertof @cryptospok
                last edited by Robertof

                Hi @cryptospok .
                In my tests, I received that error when there was a conflict with the I2C address.
                I used Uiflow V1.13.6; it’s a short text for 2Relay, and I also had trouble finding it.
                I’m sending you the modified version that includes storing the I2C address in EEPROM.
                If you need to save the state of the relays, you can also store it in memory.
                Saludos
                Roberto

                cryptospokC 1 Reply Last reply Reply Quote 0
                • R
                  Robertof @cryptospok
                  last edited by

                  Hi @cryptospok .
                  uiflow_block_1723848786392.png

                  1 Reply Last reply Reply Quote 0
                  • R
                    Robertof @cryptospok
                    last edited by Robertof

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • cryptospokC
                      cryptospok @Robertof
                      last edited by

                      Hi @Robertof,
                      I reproduced and understood your code, but as you can see in the images, nothing happens.
                      I'm also using UiFlow 1.13.6, it seems that there is some error in the module library...
                      I'm testing with only one 2RELAY module at a time, but both have the same problem.
                      I think the connection is fine... if I put the battery module underneath, the Core2 works without the USC-C connection, that is, with the attached battery (M5GO2 module).
                      Could there be an update in the Core2 firmware?

                      Thank you very much for your help!

                      Captura de Tela 2024-08-17 às 10.32.39.png

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

                        Hello @cryptospok

                        something is very strange. Try a simple internal I2C scan and see if the 2Relay module shows up.

                        • Without any 2Relay module stacked the result should be: [52, 56, 81].
                        • With one 2Relay module stacked the list should be something like: [37, 52, 56, 81].

                        UIFlow1_Core2_ScanInternalI2C_20240817.png

                        Note: I don't have an 2Relay module so I cannot test this myself.

                        Thanks
                        Felix

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

                        cryptospokC 1 Reply Last reply Reply Quote 0
                        • cryptospokC
                          cryptospok @felmue
                          last edited by

                          Hi @felmue,

                          With one 2RELAY module, the result is: [52, 56, 64, 81, 102] and without is [52, 56, 64, 81]...

                          Sorry, I'm just starting with this...
                          Thank you very much...

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

                            Hello @cryptospok

                            ok, I sorted the list w/o 2Relay out. I was testing with an M5Core2 v1 initially and it looks like you have an M5Core2 v1.1. So I re-run the test with an M5Core2 v1.1 and with that I get the same result [52, 56, 64, 81] as you without 2Relay.

                            So that would mean your 2Relay for some reason is using I2C address 102 (decimal) which is 0x66 (hex).

                            Try to run below code and hopefully that will work.

                            UIFlow1_2Relay_Test_20240817.png

                            Thanks
                            Felix

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

                            cryptospokC 1 Reply Last reply Reply Quote 0
                            • cryptospokC
                              cryptospok @felmue
                              last edited by

                              @felmue, the screen shows numer 1, only...

                              R 1 Reply Last reply Reply Quote 0
                              • R
                                Robertof @cryptospok
                                last edited by Robertof

                                Hi @cryptospok
                                “It is correct that it gives you 1, it is the firmware version (I have the same version), now you can breathe easy. In the example I sent you, change all the 37s to 102 and the texts 0x25 to 0x66. It should work.

                                felmueF cryptospokC 3 Replies Last reply Reply Quote 0
                                • felmueF
                                  felmue @Robertof
                                  last edited by

                                  Hello @cryptospok

                                  like @Robertof says - 1 is the firmware version. At least now you know your 2Relay is alive, your M5Core2 can finally talk to it, and which I2C address it is using. (And if you are ever in doubt again, you can use the I2C scan method again to find its current I2C address.)

                                  Thanks
                                  Felix

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

                                  1 Reply Last reply Reply Quote 0
                                  • cryptospokC
                                    cryptospok @Robertof
                                    last edited by

                                    This post is deleted!
                                    1 Reply Last reply Reply Quote 0
                                    • cryptospokC
                                      cryptospok @Robertof
                                      last edited by

                                      @Robertof ab @felmue, thank you very much!
                                      Now everything works!

                                      I finally understood what was going on... I did some tests and then I managed to put an address in one module, then in the other and then I can access both at the same time. One of them was at 0x32 and the other at 0x33. I need 4 relays for my project... now the conditions acquired by a BME688 will change the states of the relays.

                                      You helped a lot, not only to solve my problem but also to understand the process.

                                      Success and health to you all!

                                      felmueF R 2 Replies Last reply Reply Quote 0
                                      • felmueF
                                        felmue @cryptospok
                                        last edited by

                                        Hello @cryptospok

                                        you are welcome. I am glad to hear you got it working the way you wanted.

                                        And you!

                                        Thanks
                                        Felix

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

                                        R 1 Reply Last reply Reply Quote 0
                                        • R
                                          Robertof @cryptospok
                                          last edited by

                                          Hi @cryptospok .
                                          I’m glad you resolved it. I also experienced the frustration of not being able to solve the problems and seeing time pass without finding a way out. Fortunately, Felix was there to advise me and provide an example that I could adapt to my needs. Good luck with that project, and we’ll meet again around here.
                                          Until next time,
                                          Roberto.

                                          1 Reply Last reply Reply Quote 0
                                          • R
                                            Robertof @felmue
                                            last edited by

                                            Hi @felmue
                                            Friend, thank you very much for your interest in our problems.
                                            Cheers.

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