Connecting Env Unit and RFID Unit via Grove Hub on M5StickC



  • Individually connect to the Grove Hub works. But if I put both on the hub, it will gives

    ENV unit maybe not connect

    This is the code from UIFlow:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import unit
    
    setScreenColor(0x111111)
    rfid0 = unit.get(unit.RFID, unit.PORTA)
    env1 = unit.get(unit.ENV, unit.PORTA)
    
    wait(1)
    while True:
      lcd.print((('C: ' + str((env1.temperature)))), 0, 0, 0x3366ff)
      lcd.print((('RFID: ' + str((rfid0.readUid())))), 0, 10, 0x3366ff)
      wait_ms(200)
    

    Even if I manually switched the order to:

    env1 = unit.get(unit.ENV, unit.PORTA)
    rfid0 = unit.get(unit.RFID, unit.PORTA)
    

    I still get:

    ENV unit maybe not connect

    What am I doing wrong? Thanks in advance!



  • I use the following code to test:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import i2c_bus
    
    setScreenColor(0x111111)
    
    
    devices = None
    scan = None
    
    i2c0 = i2c_bus.easyI2C(i2c_bus.PORTA, 0x68)
    devices = []
    while True:
      scan = i2c0.scan()
      if devices != scan:
        lcd.clear()
        lcd.print(str(scan), 0, 0, 0xffffff)
      devices = scan
      wait_ms(2)
    

    I can see the I2C addresses for the Env unit and RFID unit combinations when I plug them into the Grove Hub. I can plug the Env unit in to see addresses 92 and 118, then add RFID unit to see [40, 92, 118] etc.

    So I am pretty clueless why the following will fail:

    rfid0 = unit.get(unit.RFID, unit.PORTA)
    env1 = unit.get(unit.ENV, unit.PORTA)
    

    Looks like I need to go to the source code and see what's going on...



  • It looks like Env unit has 2 I2C addresses (92, 118)? But many times 92 will go away in the scan loop. Strange...



  • All I can think is that the two sensors are drawing too much power for the bus.

    I have both units and also the hat versions. if I find time over the week end I may have some time to test but I may need a reminder on saturday.

    Double check the address's. The published addresses are in Hex but they are displayed in binary on the screen!



  • @ws1088 Confirmed, the RFID Unit will not work with the ENV unit and will not work with the ENV hat



  • @ajb2k3 said in Connecting Env Unit and RFID Unit via Grove Hub on M5StickC:

    @ws1088 Confirmed, the RFID Unit will not work with the ENV unit and will not work with the ENV hat

    Is the reason as you mentioned that there is not enough power? I guess not because you test it on the ENV hat with RFID unit. I noticed a lot of bus error (timeout), maybe it's a software issue? I am using UIFlow, btw. Are you using Arduino IDE and C++?



  • @ws1088 said in Connecting Env Unit and RFID Unit via Grove Hub on M5StickC:

    @ajb2k3 said in Connecting Env Unit and RFID Unit via Grove Hub on M5StickC:

    @ws1088 Confirmed, the RFID Unit will not work with the ENV unit and will not work with the ENV hat

    Is the reason as you mentioned that there is not enough power? I guess not because you test it on the ENV hat with RFID unit. I noticed a lot of bus error (timeout), maybe it's a software issue? I am using UIFlow, btw. Are you using Arduino IDE and C++?

    Nope, only UIFlow as I'm trying to write the book on it.





  • @ajb2k3 said in Connecting Env Unit and RFID Unit via Grove Hub on M5StickC:

    @ws1088 Confirmed, the RFID Unit will not work with the ENV unit and will not work with the ENV hat

    wow, RFID unit will not work with ENV hat even? I though RFID unit is I2C (G32 and G33) and ENV hat is on G26 and G36...



  • @ws1088 said in Connecting Env Unit and RFID Unit via Grove Hub on M5StickC:

    @ajb2k3 said in Connecting Env Unit and RFID Unit via Grove Hub on M5StickC:

    @ws1088 Confirmed, the RFID Unit will not work with the ENV unit and will not work with the ENV hat

    wow, RFID unit will not work with ENV hat even? I though RFID unit is I2C (G32 and G33) and ENV hat is on G26 and G36...

    I could not get them to work together but then i am not a good programmer.



  • Fellow users from the past, I encountered the same problem but managed to get it working. The problem lies in the paralell access of the RFID and ENV module. If the access is isolated in a paralell process and saved in to variables, further getting the values by using these variables, you should be able to use the two modules in unison.



  • @ws1088 said in Connecting Env Unit and RFID Unit via Grove Hub on M5StickC:

    I use the following code to test:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import i2c_bus
    
    setScreenColor(0x111111)
    
    
    devices = None
    scan = None
    
    i2c0 = i2c_bus.easyI2C(i2c_bus.PORTA, 0x68)
    devices = []
    while True:
      scan = i2c0.scan()
      if devices != scan:
        lcd.clear()
        lcd.print(str(scan), 0, 0, 0xffffff)
      devices = scan
      wait_ms(2)
    

    I can see the I2C addresses for the Env unit and RFID unit combinations when I plug them into the Grove Hub. I can plug the Env unit in to see addresses 92 and 118, then add RFID unit to see [40, 92, 118] etc.

    So I am pretty clueless why the following will fail:

    rfid0 = unit.get(unit.RFID, unit.PORTA)
    env1 = unit.get(unit.ENV, unit.PORTA)
    

    Looks like I need to go to the source code and see what's going on...

    are modules working ok on their own and you see issue when both connected?