Display Temperature and Humidity (Part 1)
It’s nice how our phones phones can show us the temperature currently outside, but sadly it cannot show us the temperature or humidity of the room we are presently in. Here I am going to demonstrate how you can display the temperature and humidity.
Hardware:
- Zuino PsyFi32 (ESP32)
- SHT20 Temperature and Humidity sensor
- Qwiic connector to male connectors
- Zio Qwiic OLED Display
Software:
- Arduino IDE
- For the Library, we need to use the Adafruit’s OLED display library, GFX library, SSD1306 library, and GithHub DFRobot_SHT20 sensor library
- Arduino Demo Code
Step 1: Hardware
With my help, this part should be as easy as pie.
You will be required to connect a Qwiic connector from the ESP32 to the oled display and Qwiic connector from the display to male connectors to the SHT20
All Qwiic cables follow this color scheme and pin arrangement:
Black = GND
Red = 3.3V
Blue = SDA
Yellow = SCL
Step 2: Software
Here you can change the text size and text you want to put on the display.
display.setTextSize(0.75);
display.setTextColor(WHITE);
display.setCursor(10,0);
display.clearDisplay();
display.print(" Temperature:");
display.print(temp);
display.print("C");
display.print(" Humidity:");
display.print(humd);
display.print("%");
Now lets upload the code.
You can watch how the humidity or temperature changes quickly as you blow air onto the sensor.
In the next tutorial, we will show you how to turn this temperature sensor to an IOT device!