<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Unable to read temperature value from SHT30]]></title><description><![CDATA[<p dir="auto">I'm attempting to read temperature values from the SHT30 (Yanmis SHT30) sensor. However, I'm encountering an error mentioned below.<br />
<img src="/assets/uploads/files/1712233105435-763d9f73-e78a-42da-b5af-1c34b6a137ed-image-resized.png" alt="0_1712233103960_763d9f73-e78a-42da-b5af-1c34b6a137ed-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Can someone kindly provide me with guidance or solutions to resolve the issue I'm facing?</p>
<p dir="auto">Here is my setup:<br />
<img src="/assets/uploads/files/1712233358667-8723dcd8-4006-4b91-8fe6-dadc0d4ebd4b-image.png" alt="0_1712233338034_8723dcd8-4006-4b91-8fe6-dadc0d4ebd4b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Code:<br />
<a href="https://github.com/RobTillaart/SHT31/blob/master/examples/SHT31_rawValues/SHT31_rawValues.ino" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/RobTillaart/SHT31/blob/master/examples/SHT31_rawValues/SHT31_rawValues.ino</a></p>
<pre><code>#include &lt;M5AtomS3.h&gt;
#include &lt;M5Unified.h&gt;
#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);
}</code></pre>
]]></description><link>https://community.m5stack.com/topic/6298/unable-to-read-temperature-value-from-sht30</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 01:50:29 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6298.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Apr 2024 12:28:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Mon, 08 Apr 2024 05:33:57 GMT]]></title><description><![CDATA[<p dir="auto">Okay, We're gonna buy PaHub to make it work.</p>
<p dir="auto">Thank you all for your invaluable solutions and clarifications on my issue. Your help is greatly appreciated!</p>
]]></description><link>https://community.m5stack.com/post/24717</link><guid isPermaLink="true">https://community.m5stack.com/post/24717</guid><dc:creator><![CDATA[Surya]]></dc:creator><pubDate>Mon, 08 Apr 2024 05:33:57 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Sat, 06 Apr 2024 16:53:14 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/surya" aria-label="Profile: Surya">@<bdi>Surya</bdi></a></p>
<p dir="auto">neither SHT30 nor SHT40 allow for an I2C address change programmatically. The I2C address of SHT30 can be changed via ADDR pin; SHT40 is sold in two variants with two I2C addresses. Please also see my post <a href="https://community.m5stack.com/topic/6266/read-sht30-and-sht40-from-enviii-hat-and-enviv-unit-at-the-same-time/2">here</a>.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/24709</link><guid isPermaLink="true">https://community.m5stack.com/post/24709</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Sat, 06 Apr 2024 16:53:14 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Sat, 06 Apr 2024 16:19:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/surya" aria-label="Profile: surya">@<bdi>surya</bdi></a> You need a PaHub:<br />
<a href="https://docs.m5stack.com/en/unit/pahub2" target="_blank" rel="noopener noreferrer nofollow ugc">https://docs.m5stack.com/en/unit/pahub2</a></p>
<p dir="auto"><a href="https://shop.m5stack.com/products/i2c-hub-1-to-6-expansion-unit-pca9548apw" target="_blank" rel="noopener noreferrer nofollow ugc">https://shop.m5stack.com/products/i2c-hub-1-to-6-expansion-unit-pca9548apw</a></p>
<p dir="auto">They are easy to set up and work very well.</p>
]]></description><link>https://community.m5stack.com/post/24707</link><guid isPermaLink="true">https://community.m5stack.com/post/24707</guid><dc:creator><![CDATA[teastain]]></dc:creator><pubDate>Sat, 06 Apr 2024 16:19:47 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Sat, 06 Apr 2024 11:56:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/surya" aria-label="Profile: surya">@<bdi>surya</bdi></a> Generally not as often the soldering of the devices pins is what's used to set the address.</p>
]]></description><link>https://community.m5stack.com/post/24704</link><guid isPermaLink="true">https://community.m5stack.com/post/24704</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sat, 06 Apr 2024 11:56:04 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Sat, 06 Apr 2024 08:31:28 GMT]]></title><description><![CDATA[<p dir="auto">I'm just curious, Is there a way to accomplish this programmatically, without needing to physically change the addresses?</p>
<p dir="auto">Thanks<br />
Surya</p>
]]></description><link>https://community.m5stack.com/post/24703</link><guid isPermaLink="true">https://community.m5stack.com/post/24703</guid><dc:creator><![CDATA[Surya]]></dc:creator><pubDate>Sat, 06 Apr 2024 08:31:28 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Fri, 05 Apr 2024 12:45:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/surya" aria-label="Profile: surya">@<bdi>surya</bdi></a> if you can’t physically change the addresses then you will need an I2C hub which overrides the I2C internal address</p>
]]></description><link>https://community.m5stack.com/post/24696</link><guid isPermaLink="true">https://community.m5stack.com/post/24696</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Fri, 05 Apr 2024 12:45:16 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Fri, 05 Apr 2024 09:54:51 GMT]]></title><description><![CDATA[<p dir="auto">The SHT30 perfectly worked with "<strong>M5UnitENV.h</strong>". Thanks again!</p>
<p dir="auto">Here I am encountering another challenge: I'm attempting to read temperature data from both the <strong>SHT30</strong> and <strong>SHT40</strong> 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.</p>
<p dir="auto">Here is my new setup:<br />
<img src="/assets/uploads/files/1712310319694-9d3090af-c3a3-4636-86ec-e0b98cbdef77-image.png" alt="0_1712310307256_9d3090af-c3a3-4636-86ec-e0b98cbdef77-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Code:</p>
<pre><code>#include &lt;M5AtomS3.h&gt;
#include &lt;M5Unified.h&gt;
#include "Wire.h"
#include "M5UnitENV.h"
#include &lt;SensirionI2CSht4x.h&gt;

SHT3X sht3x;
SensirionI2CSht4x sht4x;

float temperature, humidity;

void setup()
{
  Serial.begin(115200);

  if (!sht3x.begin(&amp;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);
}
</code></pre>
<p dir="auto">Thanks<br />
Surya</p>
]]></description><link>https://community.m5stack.com/post/24690</link><guid isPermaLink="true">https://community.m5stack.com/post/24690</guid><dc:creator><![CDATA[Surya]]></dc:creator><pubDate>Fri, 05 Apr 2024 09:54:51 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Fri, 05 Apr 2024 05:01:02 GMT]]></title><description><![CDATA[<p dir="auto">Thank you, <a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a>  and <a class="plugin-mentions-user plugin-mentions-a" href="/user/teastain" aria-label="Profile: teastain">@<bdi>teastain</bdi></a>, I will give it a try.</p>
]]></description><link>https://community.m5stack.com/post/24684</link><guid isPermaLink="true">https://community.m5stack.com/post/24684</guid><dc:creator><![CDATA[Surya]]></dc:creator><pubDate>Fri, 05 Apr 2024 05:01:02 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Fri, 05 Apr 2024 03:40:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/surya" aria-label="Profile: surya">@<bdi>surya</bdi></a> The alternate I2C address is 45, some suppliers set it to this by default.<br />
Alternately you could try an sketch called an I2C scanner  to see what devices are hooked up.<br />
This little sketch works on my AtomS3:</p>
<pre><code>#include "M5UnitENV.h"
SHT3X sht3x;

void setup() {           //runs once on start up
  Serial.begin(115200);  //open the serial port for USB cable
  delay(500);
  Serial.println("in setup");
  delay(1000);  //wait for a second
}

void loop() {  
  if (sht3x.begin(&amp;Wire, 0x44, 2, 1, 400000U)) {
     Serial.println("Address 44 detected");
  } else if (sht3x.begin(&amp;Wire, 0x45, 2, 1, 400000U)) {
    Serial.println("Address 45 detected");
  } else {
    Serial.println("No ENV detected");
  }
</code></pre>
<p dir="auto">-Terry</p>
]]></description><link>https://community.m5stack.com/post/24683</link><guid isPermaLink="true">https://community.m5stack.com/post/24683</guid><dc:creator><![CDATA[teastain]]></dc:creator><pubDate>Fri, 05 Apr 2024 03:40:11 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to read temperature value from SHT30 on Thu, 04 Apr 2024 18:37:34 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/surya" aria-label="Profile: Surya">@<bdi>Surya</bdi></a></p>
<p dir="auto">maybe checkout this <a href="https://github.com/m5stack/M5Unit-ENV/blob/master/examples/Unit_ENVIII_M5AtomS3/Unit_ENVIII_M5AtomS3.ino" target="_blank" rel="noopener noreferrer nofollow ugc">example</a> here. It uses an SHT30 as well.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/24680</link><guid isPermaLink="true">https://community.m5stack.com/post/24680</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Thu, 04 Apr 2024 18:37:34 GMT</pubDate></item></channel></rss>