Atom Lite ENV II with 3A mini Relay

  • I will switch the heating on if the sensor say i'm under a defined Temp.
    but i have a Problem with the Relay.

    Hi I'm use the following parts.

    ATOM Lite
    ENV II

    1. i have connected the HUB with the Atom Lite
    2. i have connected the ENV II with the HUB

    itis working with this Code.

    #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, false, true);
    Wire.begin(26, 32);
    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);

    digitalWrite(26, HIGH);
    digitalWrite(26, LOW);


    After i connect the Relay to the HUB nothing is working.

    I also have a PbHUB, would it work with the PbHUB?

    Do you have an Code example with the Atom Lite?

    thank you

  • You are using the GPIO 26 for the I2C connection to the BMP280 and SHT30 sensors. Then you can't use this pin as GPIO to switch the relay at the same time.
    For the Relay, you will need a GPIO pin. For the BMP280, you will need I2C. This puts you in a dilemma if you only want to use the Grove connector. You can use the peripheral pins on the bottom side of the ATOM lite. Check this pin mapping:
    There you can find 5V, GND and some free GPIOs. That should work.

    Alternately you can buy the EXT.IO GPIO Expander:
    Then, you can address 8 additional GPIOS via I2C.

  • Connecting the Relay on the bottom side works fine.

    But i want it on the Groove, so the GPIO Expander will be my Solution.
    Thats what i'm looking for.

    Thank you

  • Yes, it will work with the PbHUB.
    This is an example on UI Flow. The relay is connected to PbHUB port 0