ENV IV Sensor with M5Atom (lite)
-
@kees What program language do you use?
I have a ENV IV and a AtomS3 to try.
Is yours a S3 model? -
@teastain Hi, I use c++ with Arduino (IDE Microsoft Visual Studio and Visual Micro) and as far as I can tell I use the Atom Lite version. A basic version that I use for home automated applications. I expect both to work with the sensor. If you can shed some light on this I'd grateful.
-
@kees said in ENV IV Sensor with M5Atom (lite):
@teastain Hi, I use c++ with Arduino (IDE Microsoft Visual Studio and Visual Micro) and as far as I can tell I use the Atom Lite version. A basic version that I use for home automated applications. I expect both to work with the sensor. If you can shed some light on this I'd grateful.
What's the error and are you sure you have the correct sensors as there are currently 5 different versions
Does the sensor and ATOM lite work in UIFLow?
-
@kees The old Atom Lite is grey and the new AtomS3 Lite is white.
It can make a difference!
I will set up a test this afternoon with my AtomS3 and get back.
Are you seeing these results on the Serial Monitor?
-
@kees said in ENV IV Sensor with M5Atom (lite):
(IDE Microsoft Visual Studio and Visual Micro)
\o/
is like playing Arduino IDE on 'hard mode'
I use the new Arduino IDE ver2.3.x and I got it running on:
AtomS3
Stamp-Pico (which is about the same as the grey Atom Lite)
And a generic ESP32
I'm displaying in the Serial.monitor.
16:23:46.537 -> Pressure=102.4
16:23:46.537 -> Temp=23.21
16:23:46.537 -> Humidity:40.32
The pressure is in Pa, so I added this fix to make more sense and calibrate to my local atmosphere:
Serial.println(pressure / 1000 + 3.6, 1);
Gives 102.4 kPa, here in Southern Ontario Canada
If you would tell me your Atom model I will post my sketch here:
-Terry -
-
Thanks Teastain (Terry) and Felmue (Felix),
Terry I am not sure what else I can tell than it is the M5Atom Lite! I would like to see your sketch. However it could basically be the same as Terry's.
Felix, thanks for your sketch. For some reason it fails on linking this: sht4x.begin(Wire, 0X44); I can not really see what is different in libraries. However I tried this: sht4x.begin(Wire). And this works well. At least I get readings that compare to the ones using another sensor (temperature and humidity). Perhaps the I2C address 0X44 is default.
Thanks both,
Kees. -
@kees If your Atom Lite has a Gray plastic body the try this sketch that I tested and it works!
#include <SensirionI2CSht4x.h> #include <Adafruit_BMP280.h> #include "Adafruit_Sensor.h" Adafruit_BMP280 bmp; SensirionI2CSht4x sht4x; float temperature, pressure, humidity; // Store the vuale of pressure and Temperature. void setup() { Wire.begin(26, 32); // you may have to try other numbers, I do not have a gray Atom Lite! Serial.begin(115200); while (!Serial) { delay(100); } while (!bmp.begin( 0x76)) { // Init this sensor,True if the init was successful, otherwise // false. Serial.println(F("BMP280 fail")); delay(500); } Serial.println(F("BMP280 test")); uint16_t error; char errorMessage[256]; sht4x.begin(Wire); uint32_t serialNumber; error = sht4x.serialNumber(serialNumber); if (error) { Serial.print("Error trying to execute serialNumber(): "); errorToString(error, errorMessage, 256); Serial.println(errorMessage); } else { Serial.print("Serial Number: "); Serial.println(serialNumber); } bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, Adafruit_BMP280::SAMPLING_X2, Adafruit_BMP280::SAMPLING_X16, Adafruit_BMP280::FILTER_X16, Adafruit_BMP280::STANDBY_MS_500); } void loop() { uint16_t error; char errorMessage[256]; delay(500); error = sht4x.measureHighPrecision(temperature, humidity); if (error) { Serial.print("Error trying to execute measureHighPrecision(): "); errorToString(error, errorMessage, 256); Serial.println(errorMessage); } else { Serial.print("Pressure="); Serial.println(pressure / 1000 + 3.6, 1); Serial.print("Temp="); Serial.println(temperature); Serial.print("Humidity:"); Serial.println(humidity); Serial.println(" "); } pressure = bmp.readPressure(); delay(500); }
Cheers, -Terry
-
@teastain Thanks, this is indeed basically the same as Felmue (Felix) has and it works also.
I compared the readings with the readings from a CO2-sensor. Temperature is close to each other (difference of about max. 0.2 Celsius). But the humidity differs about 8-9%. That is a lot. The sensors are adjacent to each wonder and should not differ so much regarding humidity (compared to a mechanic sensor, the CO2 sensor comes closest (difference of about 2-3%)).
I wonder how reliable the readings really are.Thanks for the support anyway!
-
I uploaded an example to UIFlow2 project zone on how to use the AtomS3lite and ENIV in UIFLOW with MQTT last night