ATOM Lite and ENV.II

  • Hello,

    I'm trying to get the working with ENV.II unit using modified sample code from but I keep getting the "Could not find a valid BMP280 sensor, check wiring!" error.

    I've got the ENV.II working with M5Stack Core, but can't figure out the ATOM Lite.

    The code is as follows:

    #include "M5Atom.h"
    #include <Wire.h>
    #include "Adafruit_Sensor.h"
    #include <Adafruit_BMP280.h>
    #include "SHT3X.h"
    SHT3X sht30;
    Adafruit_BMP280 bme;
    float tmp = 0.0;
    float hum = 0.0;
    float pressure = 0.0;
    void setup()
      M5.begin(true, true, true);
      Serial.println(F("ENV Unit(SHT30 and BMP280) test..."));
      while (!bme.begin(0x76))
        Serial.println("Could not find a valid BMP280 sensor, check wiring!");
    void loop() {
      pressure = bme.readPressure();
        tmp = sht30.cTemp;
        hum = sht30.humidity;
      Serial.printf("Temperature: %2.2f*C  Humidity: %0.2f%%  Pressure: %0.2fPa\r\n", tmp, hum, pressure);

    Any suggestions would be appreciated,
    Thank you

  • Hi @regres

    the Groove connector on M5Atom Lite uses GPIO26 and GPIO32 as SDA and SDL. Try this:

      M5.begin(true, false, true);
      Wire.begin(26, 32);

    Note: second parameter to M5.begin() set to false to disable default I2C initialisation (which uses different GPIOs). Then initialise I2C with desired GPIOs.


  • Hi @felmue

    Thank you for the advice, the Wire.begin(26, 32) is what I was missing.
    I tired M5.begin(true, false, true) before but, by itself, it didn't make any difference.

    Looks like explicitly specifying I2C pins is the way to go.

    Again, thank you

  • I have tried using code above and similar from M5Stack repo. I changed the pin assignments to 19 and 22, which works fine on an alt. setup with Atom Lite, Env I hat, and Atom Mate.

    Using the setup below:
    Atom Matrix
    Env II hat
    Atom Mate

    I get this error and continuous reset loop.

    [ 913][W][Wire.cpp:301] begin(): Bus already started in Master Mode.
    Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

    If I pull out the hat, I get a warning via the code that it is disconnected. I know the origin of this post was from long ago, but I can't think what could be causing it. Is there any difference between Env II unit and Env II hat? Any other thoughts welcome.