Test of the SHT30 shield for LoLin d1 mini, temperature and humidity in I2C (ESP8266)

Table of Contents

The DHT22 temperature and humidity sensor (and its small brother the DHT11) are ubiquitous in the Arduino / ESP8266 / Raspberry Pi tutorials. You are also probably familiar with Dallas DS18b20 which uses the 1-Wire protocol. Wemos offers a new expansion board, the Shield SHT30.


The Sensirion SHT30 is a miniature sensor. In addition to its very small size which makes it possible to obtain an ultra-flat shield, the SHT30 communicates with the Wemos d1 mini on the I2C bus. This is a very big advantage for the ESP8266 which has far fewer pins than the Arduino.

Unpacking shield SHT30 for LoLin d1 mini

Sold less than 3 € in direct from Asia, the shield SHT30 is delivered in an anti-static pouch. Unlike other Shields in the family, it is delivered with only one connector type at 2.54mm pitch.

deballage shield sht30 wemos d1 mini

Technical characteristics of the sensor

The technical documentation of the manufacturer Sensirion is available here. The SHT30 (and its larger brother, SHT31) is capable of measuring the temperature in a range of -40°C to + 125°C. The humidity can be measured from 0 to 100%. Measurement accuracy varies with temperature. Around the ambient (-10°C to + 55°C), the accuracy of temperature measurement is ± 0.3°C.

shield sht30 wemos d1 mini courbe precision mesure temperature

Mounting the Shield SHT30 seamless

When I had the shield in my hands, I found it a shame to weld the connectors. So I tried to tin the edges of pins GND, 3V3, D1 and D2 (used by the I2C bus). I then stacked the board on a Shield OLED. This results in an extremely compact assembly. From bottom to top :

shield sht30 wemos d1 mini stack oled battery

Warning. Seamless mounting may prevent the Shield SHT30 from working properly. If there is a problem, go back to a classic editing

SHT30 library for IDE Arduino

Wemos has provided a library that can be retrieved on GitHub here. First download the repository before unpacking it into the Library folder of the Arduino IDE. Re-run the IDE so that the IDE takes into account the library.

Basic Program

A basic example (SHT30_Shield.ino) is included with the library. It shows how to recover the temperature and humidity measurement. The WEMOS_SHT3X library is called at the beginning of the program

#include <WEMOS_SHT3X.h>

By default, the SHT30 is accessible at address 0x45. To use the address 0x44, it will be necessary to make a point of welding on the jumper ADDR

SHT3X sht30(0x45);

Then, call the sht30.get () function to retrieve the measurements. Finally, there are three public classes that allow the recovery of measures:

  • sht30.cTemp for temperature in Celcius
  • sht30.fTemp to get the temperature in Fahrenheit
  • sht30.humidity for humidity
#include <WEMOS_SHT3X.h>
SHT3X sht30(0x45);

void setup() {

void loop() {
  Serial.print("Temperature in Celsius : ");
  Serial.print("Temperature in Fahrenheit : ");
  Serial.print("Relative Humidity : ");

Temperature sensor with OLED display 64×48 pixels

The Shield is installed below a Shield OLED (presented previously), I propose a small program to display the temperature and the humidity on the latter. To work, it is necessary to manually include the Adadruit_SSD1306 library modified by Mike Causer available on Github here.

shield sht30 wemos d1 mini shield battery oled

 * SHT30 Shield for Wemos d1 mini
 * - Read temperature and humidity
 * - Display value on OLED Shield (64x48 pixels) 
 * - Lit la température et l'humidité sur le capteur 
 * - Affiche les mesures sur l'écran OLED (64x48 pixels)
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * Licence : MIT
 * Copyright (C) 2017 : www.projetsdiy.fr and www.diyprojects.io
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_SSD1306.h"
#include <WEMOS_SHT3X.h>

#define OLED_RESET 0  // GPIO0
Adafruit_SSD1306 display(OLED_RESET);
SHT3X sht30(0x45);

void setup() {
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 64x48)

void loop() {

  display.println("- SHT30 -");
  display.print("T ");
  display.println(" *C");

  display.print("H ");
  display.println(" %");

The Shield SHT30 has many advantages. Its price is equivalent to Shield DHT22 (about €2,90 instead of €2,77). It uses the I2C bus to communicate with the Wemos which saves a pin. Finally, the Shield is extremely compact. It can be inserted between 2 other shields. Small flat for beginners, this sensor being less answered, you will find fewer examples and no plugin ESP Easy has yet been developed.

Click to rate this post!
[Total: 0 Average: 0]

Thanks for your reading

Did you like this project ? Don't miss any more projects by subscribing to our weekly newsletter!

Are you having a problem with this topic?

Maybe someone has already found the solution, visit the forum before asking your question
  1. I had tried two different programs which failed. I was about to report a dead SHT30 but I tried your example and it worked. Thanks for posting the WINNER!! Now go get your cigar.

    • Thank you so much. Usually I have no chance at gambling … maybe it’s time to try. See you soon Micheal !

      • I finally figured out that I was using the version of the program for the full size Wemos D1 Mini before trying this one. My mistake! Your example used the correct library and the correct pins. That made the difference. If you would like to see the results of all this, take a look at stats.ILikeTheInternet.com for a full page presentation of stats for the last 24 hours here. It is still an inside temperature. Next, working on adding outside temperature with a Dallas sensor. If I have any pins left on the D1 Mini after BMP280, SHT30, OLED and SD attached already. I may, well, be out of pins…

  2. How long will it take the battery?

    • Hello Giovanni. It is quite difficult to answer that question. Everything will depend on the type of sensor. For example, a pollutant detector consumes much more than a DHT22. Frequency of sending data. The capacity of the battery (and its quality). the outside temperature. Batteries do not like the cold. The optimization of the code … To try to give you an order of magnitude, you should be able to operate a temperature probe at least 1 month if it is not too cold (below 0 ° C) measured per hour. I’ve already seen articles with much higher estimates … but these are estimates 😉 For a while, I’ve been thinking about putting a point on a standard test. See you soon

Leave a Reply

Read more
DIY Projects
DIY Projects
%d bloggers like this: