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

    [Solved]Can‘t find IP5306 I2C address

    M5stack Grey
    5
    14
    24.2k
    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.
    • ajb2k3A
      ajb2k3 @BlueWhite
      last edited by

      @bluewhite said in Can‘t find IP5306 I2C address:

      I want to get the battery charge status, but can't find IP5306 I2C address, only find the MPU9250 I2C address (0x68)
      0_1555144376330_WeChat Image_20190413171547.jpg

      According to the documents, the IP5306 is on the Grove Port (I2C 2).
      The M5Stacks and sticks run on an esp32 which has 2 I2C ports.

      UIFlow, so easy an adult can learn it!
      If I don't know it, be patient!
      I've ether not learned it or am too drunk to remember it!
      Author of the WIP UIFlow Handbook!
      M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

      B 1 Reply Last reply Reply Quote 0
      • B
        BlueWhite @ajb2k3
        last edited by

        @ajb2k3 But I can find IP5306 on another board by same program.

        1 Reply Last reply Reply Quote 0
        • ajb2k3A
          ajb2k3
          last edited by

          which device are you using?

          UIFlow, so easy an adult can learn it!
          If I don't know it, be patient!
          I've ether not learned it or am too drunk to remember it!
          Author of the WIP UIFlow Handbook!
          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

          B 1 Reply Last reply Reply Quote 0
          • S
            salty_good @BlueWhite
            last edited by

            @bluewhite Hi, I am Shio.

            Did you use Arduino IDE?
            If you yes, Please try Sketch sample -> M5Stack -> Advanced -> I2C_Tester
            The I2C address of IP5306 is 0x75

            Thank you.

            B 1 Reply Last reply Reply Quote 0
            • ajb2k3A
              ajb2k3
              last edited by

              The UIFlow scanner shows it as Decimal 117 which is the address 0x75.

              UIFlow, so easy an adult can learn it!
              If I don't know it, be patient!
              I've ether not learned it or am too drunk to remember it!
              Author of the WIP UIFlow Handbook!
              M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

              1 Reply Last reply Reply Quote 0
              • B
                BlueWhite @ajb2k3
                last edited by

                @ajb2k3 I using the one that cannot be found

                1 Reply Last reply Reply Quote 0
                • B
                  BlueWhite @salty_good
                  last edited by

                  @salty_good Yes. I use Arduino IDE. 0_1555235830046_WeChat Image_20190414185624.jpg

                  ajb2k3A 1 Reply Last reply Reply Quote 0
                  • ajb2k3A
                    ajb2k3 @BlueWhite
                    last edited by

                    @bluewhite said in Can‘t find IP5306 I2C address:

                    @salty_good Yes. I use Arduino IDE. 0_1555235830046_WeChat Image_20190414185624.jpg

                    You are on the internal I2C bus, 68 is showing that the code works.
                    @salty_good the code needs to be altered to define and use wire2. At the Moment I can't remember how I did it because I've lost my sourcecode for the grove port.

                    UIFlow, so easy an adult can learn it!
                    If I don't know it, be patient!
                    I've ether not learned it or am too drunk to remember it!
                    Author of the WIP UIFlow Handbook!
                    M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                    1 Reply Last reply Reply Quote 0
                    • world101W
                      world101
                      last edited by world101

                      It will depend if your m5stack grey is the newer version with the IP5306_I2C chip. See this thread:
                      https://github.com/m5stack/M5Stack/issues/74

                      Your picture shows the same hardware version as the one in the above thread, so I assume you have the newer version. However, run this code in the Arduino IDE to see if it works.

                      #include <M5Stack.h>
                      
                      int8_t getBatteryLevel()
                      {
                        Wire.beginTransmission(0x75);
                        Wire.write(0x78);
                        if (Wire.endTransmission(false) == 0
                         && Wire.requestFrom(0x75, 1)) {
                          switch (Wire.read() & 0xF0) {
                          case 0xE0: return 25;
                          case 0xC0: return 50;
                          case 0x80: return 75;
                          case 0x00: return 100;
                          default: return 0;
                          }
                        }
                        return -1;
                      }
                      
                      void setup() {
                          M5.begin();
                          Wire.begin();
                        }
                      
                      void loop() {
                        delay(1000);
                        M5.Lcd.clear();
                        M5.Lcd.setTextColor(GREEN);
                        M5.Lcd.setCursor(0, 20);
                        M5.Lcd.setTextSize(2);
                        M5.Lcd.print("Battery Level: ");
                        M5.Lcd.print(getBatteryLevel());
                        M5.Lcd.print("%");
                      }
                      

                      I am working on a battery gauge indicator for uiFlow that I will do the same as above, but using MicroPython instead of Arduino C. I hope to release it soon.

                      B 2 Replies Last reply Reply Quote 0
                      • B
                        BlueWhite @world101
                        last edited by

                        @world101 My m5stack grey is 2018.3, but i don't know if with the IP5306_I2C chip.

                        1 Reply Last reply Reply Quote 0
                        • B
                          BlueWhite @world101
                          last edited by

                          @world101 The code is no work. Return -1

                          world101W 1 Reply Last reply Reply Quote 0
                          • world101W
                            world101 @BlueWhite
                            last edited by

                            @bluewhite

                            If the I2C scanner does not show 75 and the program returns -1, then I can only assume you have the older version of the IP5306 chip. ☹️

                            I have the M5Stack fire and grey. I only tested the fire (which works with the program above) because my grey is a 2017 model. So I knew it didn’t have the newer chip.

                            1 Reply Last reply Reply Quote 0
                            • m5-docsM
                              m5-docs
                              last edited by

                              @BlueWhite

                              Really sorry about that !!

                              After downloading this iic example for detecting iic address, if the screen shows 0x75, it means the IP5306 chip is IIC version. Otherwise, the IP5306 on your core is not IIC version.

                              M5Stack documentation URL

                              https://docs.m5stack.com

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