Display Temperature and Humidity in the OLED Display with Arduino
In this section, we’ll build a project that displays temperature and humidity readings on the OLED display. We’ll get temperature and humidity using the DHT11 temperature and humidity sensor.
Demonstration
After wiring the circuit and uploading the code, the OLED display shows the temperature and humidity readings. The sensor readings are updated every five seconds.
Parts required
To complete this project you need the following components:
- 0.96 inch OLED display
- Arduino UNO
- DHT11 or DHT22 temperature and humidity sensor
- Breadboard
- 4.7k Ohm resistor (or 10k Ohm resistor)
- Jumper wires
Schematic
Assemble the circuit by following the next schematic diagram.
Note: if you’re using a module with a DHT sensor, it normally comes with only three pins. The pins should be labeled so that you know how to wire them. Additionally, many of these modules already come with an internal pull-up resistor, so you don’t need to add one to the circuit.
Installing Libraries
Before proceeding, make sure you have installed the“adafruit_GFX.h” and the “adafruit_SSD1306.h” libraries to control the OLED display.
For this project, you also need two additional libraries to read from the DHT sensor: the DHT library and the Adafruit_Sensor library. Follow the next steps to install those libraries
1. Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open.
2. Search for “DHT” on the Search box and install the DHT library from Adafruit.
3. After installing the DHT library from Adafruit, type “Adafruit Unified Sensor” in the search box. Scroll all the way down to find the library and install it.
4. Restart your Arduino IDE.
Code
After installing all the necessary libraries, you can upload the following code.
Comments
Post a Comment