Using ENV.III UNIT on M5StickC Plus:getting I2C error 19



  • Hello,

    I am trying to get the ENV.iii unit (not hat) to with on the M5 stickC (regular and plus).

    I have got the ENV.ii hat to work fine (but accuracy is not great next to the hot LCD).

    So I thought I would use the UNIT, which happens to be i2c.

    Using UiFLow 1.7.5, 1.8.1 firmware.

    The ENV.iii is not supported in blocky, but the ENV.ii is, and the specs say it is compatible, so...autogenerated code is:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import unit

    setScreenColor(0x111111)
    env20 = unit.get(unit.ENV2, unit.PORTA)
    lcd.print((env20.temperature), 0, 0, 0xffffff)

    I get an error: "I2C bus error (19)"
    I have tried different M5 stick, different wires, different ENV.iii units.

    Thanks for any help!



  • Hello @microdynasty

    not sure where you read that ENV II and ENV III are compatible. Yes, they both use I2C and yes, one sensor IC is the same, but the other sensor IC is different and uses a different I2C address. E.g.

    • ENV II - SHT30:0x44, BMP280:0x76
    • ENV III - SHT30:0x44, QMP6988:0x56

    so I'd be very surprised if an ENV III would work with ENV II selected in UIFlow.

    I am afraid you'll need to wait until M5Stack engineers have added ENV III to UIFlow.

    Thanks
    Felix



  • Felix,

    I'm only interested in temperature. They are both the same in that regard. SHT30:0x44

    I am concerned it throws the error 19. I thought at least it would connect on the I2C :(

    The ENVIII page states it is compaitilble with UiFlow.

    If you look at the page for: ENV2](https://docs.m5stack.com/en/unit/envII)

    M5 states "This product is EOL now, we've released the updated version ENV III Unit with Temperature Humidity Air Pressure Sensor (SHT30+QMP6988) which is fully compatible with this product."

    I don't mind coding the I2C interface in MicroPython vs Blocky, but I don't know how. I have done write to i2C for the 4-unit relay. But I have never done READ.

    i2c0 = i2c_bus.easyI2C(i2c_bus.PORTA, 0x26, freq=400000)
    i2c0.write_u8(0x11, 0x00)



  • Hello @microdynasty

    I think in UIFlow, when a unit is added, part of the internal initialization, e.g. what's happening when below line is executed, is to check for the two sensors in the ENV III unit, which in your case results in the I2C error.

    env20 = unit.get(unit.ENV2, unit.PORTA)
    

    Hmm, I can see what you mean about ENV III being compatible, but I wonder if M5Stack meant after ENV III has been added in UIFlow?

    Sorry, I don't know enough about MicroPython to help you, but maybe have a look at the Arduino example to get an idea about the I2C commands required to read data from that sensor?

    Good luck!

    Thanks
    Felix