🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Atom Lite ENV II with 3A mini Relay

    Atom
    3
    4
    7.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mamtho
      last edited by

      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
      https://docs.m5stack.com/#/en/core/atom_lite
      HUB
      https://docs.m5stack.com/#/en/unit/hub
      ENV II
      https://docs.m5stack.com/#/en/unit/envII
      Relay:
      https://docs.m5stack.com/#/en/unit/relay

      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();
      if(sht30.get()==0)
      {
      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);
      delay(500);
      digitalWrite(26, LOW);
      delay(500);

      delay(100);
      }

      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

      1 Reply Last reply Reply Quote 0
      • hagueH
        hague
        last edited by

        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:
        https://docs.m5stack.com/#/en/core/atom_lite?id=peripherals-pin-map
        There you can find 5V, GND and some free GPIOs. That should work.

        Alternately you can buy the EXT.IO GPIO Expander:
        https://m5stack.com/products/official-extend-serial-i-o-unit
        Then, you can address 8 additional GPIOS via I2C.

        1 Reply Last reply Reply Quote 1
        • M
          mamtho
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • D
            Dario
            last edited by Dario

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

            0_1609104140897_77cd9ae0-5c1a-42a3-974b-1037206c1a7c-image.png

            1 Reply Last reply Reply Quote 0
            • First post
              Last post