Arduino Projects

SHT20 Temperature & Humidity Sensor Arduino, measure atmospheric temperature

SHT20 Sensor:


SHT20 Temperature & Humidity Sensor Arduino, measure atmospheric temperature- The earth’s temperature has risen by an average of 0.08 degree Celsius per decade since 1880. The rate of warming since 1980 is more than twice as fast 0.18 degrees Celsius per decade. I am going to perform indoor and outdoor temperature tests using this highly accurate Temperature and humidity sensor. Previously, I checked the CO2 concentration and it was around 430ppm, which is the highest value in 2.1 million years. Our home planet is in danger. Let’s find out what’s the temperature status.

Waterproof SHT20 sensor, a temperature and humidity sensor compatible with Arduino.

This is an i2c supported waterproof Temperature and Humidity sensor SHT20 by the DFrobot and today, I am going to use it with Arduino and an I2C supported SSD1306 Oled display module.

I have used DHT11 and DHT21 temperature and humidity sensors in many projects. There is no doubt that these sensors are quite inexpensive. However, it is also true that these sensors are quite slow and not very accurate. Moreover, these temperature and humidity sensors are not waterproofed. Therefore, these sensors are not recommended for outdoor applications.

While on the other hand the SHT20 Temperature and humidity sensor is waterproofed. It comes with the 4C CMOSens SHT20 Temperature & Humidity Sensor chip and the probe has gone through dual waterproof protection test. The SHT20 I2C supported temperature and Humidity Sensor adopt Sensirion techniques. This sensor has an amplifier, Analog to digital converter, OTP memory, and a digital processing Unit. And that’s why the SHT20 sensor is relatively more expensive than the DHT11, DHT21, and other sensors in this series.

Compared with early SHT1x series and SHT7x series, SHT20 shows a strong reliability and long-term stability. It can precisely measure the temperature and humidity of the surrounding environment. There is also a built-in 10K Pull-up resistor and a 0.1uf filter capacitor.

So, in today’s tutorial, I am going to measure the indoor and outdoor temperature and humidity values. And I am going to print the values on the SSD1306 Oled display module. So, without any further delay, let’s get started!!!

Amazon Links:

Arduino Nano USB-C Type (Recommended)

SHT20 Temperature and Humidity Sensor

SSD1306 Oled display Module

Other Tools and Components:

ESP32 WiFi + Bluetooth Module (Recommended)

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

About Sensirion CMOSens:

Sensirion is a company that specializes in sensor technology and sensor solutions. They develop and manufacture a wide range of sensors for various applications, including environmental sensing, liquid flow sensing, gas flow sensing, humidity and temperature sensing, and more.

While Sensirion utilizes various techniques in their sensor products, one of their notable technologies is the CMOSens® technique. CMOSens stands for “Complementary Metal-Oxide-Semiconductor Sensing.” It is an innovative approach to integrating sensing elements with the readout circuitry on a single CMOS chip.

CMOSens technology enables the miniaturization and integration of multiple sensor functions into a compact package. The technique leverages the advantages of CMOS technology, which is widely used in the semiconductor industry, to achieve highly accurate and reliable measurements.

The CMOSens technique typically involves integrating the sensing element, such as a capacitive humidity sensor or a thermal flow sensor, with the associated analog and digital signal processing circuitry on the same CMOS chip. This integration allows for precise measurements, low power consumption, and improved signal integrity.

Sensirion’s CMOSens-based sensors are known for their high performance, small form factor, and ease of integration into various devices and systems. They are used in applications ranging from automotive and industrial automation to consumer electronics and medical devices.

It’s important to note that Sensirion develops and employs other sensing techniques and technologies besides CMOSens, depending on the specific sensor and application requirements.

SHT1x series and SHT7x series

The SHT1x series and SHT7x series are product families of humidity and temperature sensors developed by Sensirion. These series offer high-precision measurements of relative humidity and temperature, making them suitable for a wide range of applications.

SHT1x Series:

The SHT1x series includes the SHT10, SHT11, and SHT15 sensors. These sensors utilize a capacitive humidity sensor and a digital temperature sensor integrated into a single chip. The SHT1x sensors provide accurate and reliable measurements with a typical accuracy of ±3% relative humidity and ±0.5°C temperature.

The SHT1x series operates on a 2-wire serial interface and can be easily connected to microcontrollers and other digital systems. They offer digital output of humidity and temperature values, which simplifies the integration process.

SHT7x Series:

The SHT7x series includes the SHT71 and SHT75 sensors. These sensors also feature a capacitive humidity sensor and a digital temperature sensor on a single chip, but they offer enhanced performance compared to the SHT1x series. The SHT7x sensors provide higher accuracy, with typical tolerances of ±2% relative humidity and ±0.3°C temperature.

Similar to the SHT1x series, the SHT7x sensors communicate via a 2-wire serial interface, enabling easy interfacing with microcontrollers and digital systems. They provide digital output for both humidity and temperature measurements.

Both the SHT1x and SHT7x series sensors from Sensirion are designed to operate in a wide range of environmental conditions and offer excellent long-term stability. They are used in various applications such as HVAC (heating, ventilation, and air conditioning) systems, weather stations, industrial automation, consumer electronics, and more.


Operating Voltage: 3.3 to 5V

This means you can use SHT20 Sensor with 3.3V and 5V compatible controller boards like ESP8266, ESP32, Raspberry Pi Pico, STM32, and all the other Arduino boards etc.

Communication Interface: I2C

Protection Class: waterproof anti-condensation

RH Response Time: 8s (tau63%)

Accuracy: ±3% RH / ±0.3 ℃

Measuring Range: 0-100% RH / -40-125 ℃

Dimension: 73mm * 17mm / 2.87 * 0.67 inches

Weight: 44g

SHT20 Sensor Interface:

It has a total of 4 wires.

Red: VCC

Black: GND

Yellow: SCL

Green: SDA

The Red and Black wires are the VCC and GND wires.The Yellow Wire is the SCL and the Green wire is the SDA. Wire details are also printed on this tag.

SHT20 Sensor with Arduino Wiring & Circuit Diagram:

Circuit diagram illustrating the interfacing of an SHT20 sensor with an Arduino board.

As usual, I am using my Arduino Nano and LoRa based development board. But you can also do the same exact connections on a breadboard. In this tutorial, I am only using the Oled display module. So, forget about all these other components.

Anyway, the SHT20 temperature and humidity sensor; and the SSD1306 Oled display module both are I2C supported devices. So connect the SCL and SDA of both the modules to the Arduino Analog pins A5 and A4. A5 is the SCL and A4 is the SDA.

Connect the VCC and GND of the Oled display module to the Arduino 3.3V and GND pins. And connect the VCC and GND wires of the SHT20 to the Arduino 5v and GND pins. If still you have got any confusion then you can follow this circuit diagram.

SHT sensor connected to an Arduino Nano board.

Now, let’s go ahead and install all the required libraries.

Altium Designer + Altium 365 + Octopart:

Arduino LoRa Free SMS

Altium 365 lets you hold the fastest design reviews ever. Share your designs from anywhere and with anyone with a single click. it’s easy, leave a comment tagging your teammate and they’ll instantly receive an email with a link to the design. Anyone you invite can open the design using a web browser. Using the browser interface, you’re able to comment, markup, cross probe, inspect, and more. Comments are attached directly to the project, making them viewable within Altium designer as well as through the browser interface. Design, share, and manufacture, all in the same space with nothing extra to install or configure. Connect to the platform directly from Altium Designer without changing how you already design electronics. Altium 365 requires no additional licenses and comes included with your subscription plan.

Get real-time component insights as you design with Octopart built into Altium 365. Octopart is the fastest search engine for electronic parts and gives you the most up-to-date part data like specs, datasheets, cad models, and how much the part costs at different amounts etc. Right in the design environment so you can focus on your designs. Start with Altium Designer and Activate Altium 365. Search for electronic parts on Octopart.

Required Libraries:

First, let’s go ahead and install the required libraries for the SHT20 Sensor and the SSD1306 Oled display Module.

Download SHT Library

Download Adafruit_GFX

Download Adafruit_SSD1306

After downloading the SHT library, next you will need to add it in the Arduino IDE. While the Arduino IDE is open, go to the Sketch Menu > to Include Library and click on the Add .Zip Library.


Browse to the location and select the zip folder and click on the open button.

Step-by-step guide on adding the SHT20 library in the Arduino IDE

The same steps you can follow for the Adafruit_GFX and Adafruit_SSD1306 libraries.

You can also install these libraries using the Arduino IDE.

Simply, go to the Sketch Menu > then to Include library > and click on the Manage Libraries. search for the Adafruit_GFX and install it.

Adafruit GFX library in the Arduino IDE.

As you can see, I have already installed this library. Next, search for the Adafruit_SSD1306 and install it.

Adafruit SSD1306 library in the Arduino IDE.

As you can see, I have also installed this library. All my libraries are installed and now let’s take a look at the programming.

SHT20 Sensor Arduino Programming:

Code explanation:

I started off by adding all the required libraries.

These lines of code are for the Oled display module.

Serial communication is initiated with a baud rate of 115200.

The Wire library is started for I2C communication.

The I2C clock speed is set to this value 100000.

The SHT sensor is initialized with the I2C address 0x44.

The OLED display is initialized with the specified parameters and you can see the i2c address which is 0x3C.

We read the status of the SHT20 sensor and print it on the Serial monitor.

There is a delay of 2 seconds, then we clear the display, and set the text color to White.

Inside the loop() function, we simply read the SHT sensor. Then we send the temperature and humidity values to the Serial monitor. And at the same we also print the temperature and humidity values on the Oled display Module. So, that’s all about the programming and now let’s go ahead and upload this program.

Connect your Arduino board to the Laptop/PC, select the Arduino board, and the communication port. And one more thing, if you are using Arduino Nano then don’t forget to select the processor type “ATmega328P (Old Bootloader)”.

Arduino Nano with the old bootloader.

Finally, click on the Upload button.

SHT20 Temperature & Humidity Sensor Demonstration:

An Arduino board connected to an SHT20 sensor for measuring indoor temperature and humidity.

This is the 12th of June 2023, and this is my first indoor test. To make it portable, I am using my 4S lithium-ion battery to power up the Arduino. Anyway, in my studio, the fan is also turned on, and in the adjacent room, the AC is also on. I have also painted the roof with White-colored paint to reflect the sunlight, but still, the temperature is very high. 32 degrees Celsius is extremely high.

Arduino setup with a waterproof SHT20 sensor for measuring outdoor temperature and humidity.

This is my second outdoor test, and the sensor is in the shade. As you can see, the temperature is 37 degrees Celsius, and the humidity is 38%.

A waterproof SHT20 temperature and humidity sensor measuring temperature under direct sunlight.

This is my third outdoor test, and as you can see, the sensor is directly under the sunlight. It has been ON for the last 10 minutes.

An Arduino board connected to an SHT20 sensor is used to measure outdoor temperature and humidity.

The temperature is 49 degrees Celsius, and the humidity is 25%. You won’t believe it, but it rained here two days ago, and there is still not full sunlight, yet the temperature is so high. This temperature is higher than the last year. And it’s due to the CO2 concentration in the Earth’s atmosphere. In my previous project, I checked the CO2 concentration using the CO2 sensor, and it was around 430ppm, which is the highest value in 2.1 million years. If we don’t control CO2 emissions, the Earth’s temperature will increase even more. We need to work on this. Otherwise, there won’t be anything left for our future generations. So, that’s all for now.

Watch the Video Tutorial:



Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button