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

    Can i connect a Grove (non-M5stack) rotary encoder to m5core2 with battery bottom2?

    General
    2
    5
    4.5k
    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.
    • A
      AEisele55
      last edited by AEisele55

      Hello,
      I want to have a rotary knob in my project. Can i use this?
      I cant use the M5stack encoder as i already use the only I2C Port (Port A) for a Dlight unit.

      Thanks
      Aaron

      M5Core2, M5Atom Matrix + dLight Unit, M5stickCplus

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

        Hello @AEisele55

        I tried to compile the libraries source code (Encoder / TimerOne) of that rotary knob for ESP32 and it fails with lib/TimerOne/TimerOne.h:39:10: fatal error: avr/io.h: No such file or directory. I think the reason is that the source code is meant for Arduino AVR boards which are different from ESP32 boards. While you might be able to physically connect this rotary knob to an M5Core2 you need to be prepared to adapt the library to work with ESP32 on your own.

        That said, are you aware that I2C is a bus system which allows multiple devices to be connected in parallel? The two devices can be controlled by the M5Core2 using their respective I2C address: Encoder: 0x40; Dlight: 0x23. You'll need a hub like this one.

        Thanks
        Felix

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

        A 1 Reply Last reply Reply Quote 0
        • A
          AEisele55 @felmue
          last edited by AEisele55

          @felmue: i think this rotary encoder works like any "normal" one. AFAIK, it doesn't use I2C but a kind of "If turned one step right, first pin A high, the Pin B high, then both Low".
          My concerns were that i heard somewhere about the m5stack not being 5V-tolerant (that means if you put 5v on an input pin, it destroys the pin forever)
          Is it physically safe to connect it?
          I already thought of some code how to read it , which just uses the "dual button" unit in UIflow and compares the RTC times the A high or B high.

          Thanks

          Aaron

          M5Core2, M5Atom Matrix + dLight Unit, M5stickCplus

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

            Hello @AEisele55

            most M5Stack devices (including M5Core2) use the ESP32 and yes, the GPIOs of the ESP32 are not 5 V tolerant. I am sorry for not thinking of that. So if the outputs of the rotary encoder are 5 V you would need to add some kind of level shifters.

            Note: the power supply on the Groove port is 5 V, but the two GPIOs are only 3.3 V.

            Thanks
            Felix

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

            1 Reply Last reply Reply Quote 0
            • A
              AEisele55
              last edited by

              @felmue: Thanks for your help

              M5Core2, M5Atom Matrix + dLight Unit, M5stickCplus

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