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
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- i have connected the HUB with the Atom Lite
- 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
-
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. -
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