[Solved]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)
-
@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)
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. -
@ajb2k3 But I can find IP5306 on another board by same program.
-
which device are you using?
-
@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 0x75Thank you.
-
The UIFlow scanner shows it as Decimal 117 which is the address 0x75.
-
@ajb2k3 I using the one that cannot be found
-
@salty_good Yes. I use Arduino IDE.
-
@bluewhite said in Can‘t find IP5306 I2C address:
@salty_good Yes. I use Arduino IDE.
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. -
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/74Your 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.
-
@world101 My m5stack grey is 2018.3, but i don't know if with the IP5306_I2C chip.
-
@world101 The code is no work. Return -1
-
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.
-
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.