PaHUB + ENVIII pressure reading issue



  • Using an Atom Matrix with a PaHUB, a TVOC/eCO2 unit and an ENVIII gives a strange pressure result.
    The pressure value reads about 5 times the actual pressure level. This is the same whether the ENV is solo, or the other sensor is connected. Other readings seem to be working as expected,
    When the ENVIII is connected on its own the pressure readings are as expected.
    from m5stack import *
    from m5ui import *
    from uiflow import *
    import wifiCfg
    from m5mqtt import M5mqtt
    import time
    import unit

    rgb.set_screen([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xFFFFFF,0,0,0,0])
    tvoc_2 = unit.get(unit.TVOC, unit.PAHUB1)
    pahub_0 = unit.get(unit.PAHUB, unit.PORTA)
    env3_0 = unit.get(unit.ENV3, unit.PAHUB0)

    tempdata = None
    humdata = None
    pressdata = None
    iapbase = None
    tvoc = None
    basetvoc = None
    co2 = None
    baseco2 = None
    h2 = None
    eth = None

    wifiCfg.doConnect('', '')

    m5mqtt = M5mqtt('atomenv', '192.168.178.14', 1883, '', '', 600)
    m5mqtt.start()
    tvoc_2.set_iaq_baseline(35187, 35502)
    while True:
    tempdata = env3_0.temperature
    humdata = env3_0.humidity
    pressdata = env3_0.pressure
    m5mqtt.publish(str('temperature'),str(tempdata))
    m5mqtt.publish(str('humidity'),str(humdata))
    m5mqtt.publish(str('pressure'),str(pressdata))
    wait(2)
    iapbase = tvoc_2.get_iaq_baseline()
    tvoc = tvoc_2.TVOC
    basetvoc = tvoc_2.baseline_TVOC
    co2 = tvoc_2.eCO2
    baseco2 = tvoc_2.baseline_eCO2
    h2 = tvoc_2.H2
    eth = tvoc_2.Ethanol
    m5mqtt.publish(str('IAPbaseline'),str(iapbase))
    m5mqtt.publish(str('TVOCnow'),str(tvoc))
    m5mqtt.publish(str('TVOCbase'),str(basetvoc))
    m5mqtt.publish(str('CO2'),str(co2))
    m5mqtt.publish(str('CO2base'),str(baseco2))
    m5mqtt.publish(str('H2'),str(h2))
    m5mqtt.publish(str('ethanol'),str(eth))
    wait_ms(2)



  • @boomvalt I have the same issue. The ENV III Unit works well when connected directly to Port A, it displays the temperature, humidity, and pressure correctly, but when I connect the sensor to PaHub, the temperature and humidity have still correct values, but the pressure is static and shows a negative number something like -513233.2. I have two units and with both, I have the same results.

    Were you able to solve this issue?

    Regards.

    Alvaro B



  • Hello,
    Maybe its because PaHUB and sensor QMP6988 have same I2C adresse 0x70.
    Possibly modify PaHUB adresse to 71 by soldering on the component.



  • @octopuss you are correct.
    Because the ENVIII has the same I2C address, you are getting corruption from the hub



  • @ajb2k3 By the way , now we speaking about I2C do you know why Icannot use PaHub and Hat 8 servo in same time ? Is not the same I2C 0x38 vs 0x70 ? Its seem the first i initiate in script will be the only will work.



  • @octopuss I don't know but it may be a power issue. Mine is sat in a box waiting for me to connect it to the project



  • Hello guys

    as stated before PaHUB and ENV III units cannot be used together as they share the same I2C address 0x70 by default. That said the I2C address of the PaHUB unit can be modified (let's say to use 0x71) to avoid the conflict.

    And in UIFlow2 it is possible to use a PaHUB unit with modified I2C address. So in UIFlow2 add an ENV III unit and select PAHUB as BUS (which automatically will add a PaHUB unit as well). Then replace the resulting Init env3_0 block with an Execute code block with the following content:

    env3_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=0, address=0x71), type=3)

    Note: ENV III unit is connected to the first channel of the PaHUB unit, e.g. channel 0.

    Complete Micropython code:

    import os, sys, io
    import M5
    from M5 import *
    from hardware import *
    import time
    from unit import *
    
    label0 = None
    label1 = None
    label2 = None
    i2c0 = None
    pahub_0 = None
    env3_0 = None
    
    def setup():
      global label0, label1, label2, i2c0, pahub_0, env3_0
    
      M5.begin()
      label0 = Widgets.Label("label0", 3, 4, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
      label1 = Widgets.Label("label1", 2, 22, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
      label2 = Widgets.Label("label2", 2, 44, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
    
      i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
      env3_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=0 , address=0x71), type=3)
    
    def loop():
      global label0, label1, label2, i2c0, pahub_0, env3_0
      M5.update()
      time.sleep(1)
      label0.setText(str(env3_0.read_temperature()))
      label1.setText(str(env3_0.read_pressure()))
      label2.setText(str(env3_0.read_humidity()))
    
    if __name__ == '__main__':
      try:
        setup()
        while True:
          loop()
      except (Exception, KeyboardInterrupt) as e:
        try:
          from utility import print_error_msg
          print_error_msg(e)
        except ImportError:
          print("please update to latest firmware")
    

    BTW: In UIFlow1 I have not been able to figure out how (if at all) it is possible to use a PaHUB unit with non default I2C address.

    Thanks
    Felix