Okay, We're gonna buy PaHub to make it work.
Thank you all for your invaluable solutions and clarifications on my issue. Your help is greatly appreciated!
Okay, We're gonna buy PaHub to make it work.
Thank you all for your invaluable solutions and clarifications on my issue. Your help is greatly appreciated!
I'm just curious, Is there a way to accomplish this programmatically, without needing to physically change the addresses?
Thanks
Surya
The SHT30 perfectly worked with "M5UnitENV.h". Thanks again!
Here I am encountering another challenge: I'm attempting to read temperature data from both the SHT30 and SHT40 simultaneously. However, both sensors share the same I2C address (0x44), leading to an error. I also experimented with changing the address to 0x45, but unfortunately, it didn't resolve the issue. Any advice is greatly appreciated.
Here is my new setup:
Code:
#include <M5AtomS3.h>
#include <M5Unified.h>
#include "Wire.h"
#include "M5UnitENV.h"
#include <SensirionI2CSht4x.h>
SHT3X sht3x;
SensirionI2CSht4x sht4x;
float temperature, humidity;
void setup()
{
Serial.begin(115200);
if (!sht3x.begin(&Wire, SHT3X_I2C_ADDR, 2, 1, 400000U))
{
Serial.println("Couldn't find SHT3X");
// while (1)
// {
// Serial.println("Couldn't find SHT3X");
// delay(1000);
// }
}
sht4x.begin(Wire, SHT40_I2C_ADDR_45);
}
void loop()
{
temperature = humidity = NULL;
uint16_t error;
char errorMessage[256];
if (sht3x.update())
{
Serial.println("-----SHT3X-----");
Serial.print("Temperature: ");
Serial.print(sht3x.cTemp);
Serial.println(" degrees C");
Serial.print("Humidity: ");
Serial.print(sht3x.humidity);
Serial.println("% rH");
Serial.println("-------------\r\n");
}
error = sht4x.measureHighPrecision(temperature, humidity);
if (error)
{
Serial.print("Error trying to execute measureHighPrecision(): ");
errorToString(error, errorMessage, 256);
Serial.println(errorMessage);
}
else
{
Serial.println("-----SHT4X-----");
Serial.print("Temperature:");
Serial.print(temperature);
Serial.print("\t");
Serial.print("Humidity:");
Serial.println(humidity);
Serial.println("-------------\r\n");
}
delay(1000);
}
Thanks
Surya
I'm attempting to read temperature values from the SHT30 (Yanmis SHT30) sensor. However, I'm encountering an error mentioned below.
Can someone kindly provide me with guidance or solutions to resolve the issue I'm facing?
Here is my setup:
Code:
https://github.com/RobTillaart/SHT31/blob/master/examples/SHT31_rawValues/SHT31_rawValues.ino
#include <M5AtomS3.h>
#include <M5Unified.h>
#include "Wire.h"
#include "Wire.h"
#include "SHT31.h"
#define SHT31_ADDRESS 0x44
uint32_t start;
uint32_t stop;
uint32_t cnt;
SHT31 sht(SHT31_ADDRESS); // uses explicit address
void setup()
{
Serial.begin(115200);
Wire.begin();
Wire.setClock(100000);
sht.begin();
uint16_t stat = sht.readStatus();
sht.requestData();
cnt = 0;
}
void loop()
{
uint16_t rawTemperature;
uint16_t rawHumidity;
if (sht.dataReady())
{
start = micros();
bool success = sht.readData(); // default = true = fast
stop = micros();
sht.requestData(); // request for next sample
Serial.print("\t");
Serial.print(stop - start);
Serial.print("\t");
if (success == false)
{
Serial.println("Failed read");
}
else
{
rawTemperature = sht.getRawTemperature();
rawHumidity = sht.getRawHumidity();
Serial.print(rawTemperature, HEX);
Serial.print(" = ");
// This formula comes from page 14 of the SHT31 datasheet
Serial.print(rawTemperature * (175.0 / 65535) - 45, 1);
Serial.print("°C\t");
Serial.print(sht.getRawHumidity(), HEX);
Serial.print(" = ");
// This formula comes from page 14 of the SHT31 datasheet
Serial.print(rawHumidity * (100.0 / 65535), 1);
Serial.print("%\t");
Serial.println(cnt);
cnt = 0;
}
}
cnt++; // simulate other activity
delay(1000);
}
Hello @felmue
I implemented the change using GPIO10 for the random seed, and the I2C issue seems to be resolved. Your help is greatly appreciated!
Thank you for your fix!
Surya
Oops, I forgot to share the error message. Here it is
Hello @felmue
I have already attempted a short delay, but unfortunately, that doesn't work for me. As for periodic code execution, I will give it a try.
Thanks
Surya
Thank you so much for sharing your work!
Earlier, I successfully sent data over MQTT to AWS IoT Core in UIFlow2. However, in UIFlow2, I couldn't find a way to establish a (DHCP) Ethernet connection to AtomS3 using AtomPoE Base. That's why I decide to develop the code using PlatformIO. Do you have any reference Micropython script for an Ethernet connection?
I appreciate your input! Could you please share the link or specify the topic name related to the example you mentioned in the Project zone? I'm interested in diving deeper.