Display temperature and humidity measured by DHT22 connected to Arduino on SSD1306 display

Arduino UNO 30-12-23
386 0

Tutorial plan

1- How to use the DHT22 sensor by the Arduino UNO board ?

2- The components required to use DHT22 sensor and SSD1306 display by Arduino UNO

3- Mounting the Arduino board with the DHT22 sensor and the SSD1306 display

4- Programming the Arduino UNO board to display the temperature and humidity measured by the DHT22 sensor on the SSD1306 display

 

 

How to use the DHT22 sensor by the Arduino UNO board ?

The DHT22 sensor is an electronic component designed to measure both temperature and relative humidity in the surrounding environment. It belongs to the family of temperature and humidity sensors produced by Aosong (also known as AOSONG).

To use the DHT22 sensor with an Arduino Uno board, you'll need to connect the sensor to the board and use a library to interact with it. Here are the steps to do so:

Hardware Connection: Connect the DHT22 sensor to the Arduino Uno board:

Software Setup:

1-Install the Library:

Open the Arduino IDE.

Go to "Sketch" > "Include Library" > "Manage Libraries."

Search for "dhtlib" and install the "DHT sensor library".

Write the Code: Use the  code to read data from the DHT22 sensor

Upload the Code: Connect your Arduino Uno board to your computer.

The components required to display the temperature and humidity measured by the DHT22 sensor connected to Arduino on the SSD1306 display

To display the temperature and humidity readings from the DHT22 sensor on SSD1306 display using an Arduino, you'll need the following components:

Arduino UNO Board

Arduino Uno

The Arduino Uno board is a microcontroller board based on the ATmega328P microcontroller. It's one of the most popular and widely used boards in the Arduino family due to its simplicity and versatility.

It is the central control unit for your project.

DHT22  Sensor

The DHT22 sensor is popular for its relative accuracy, ease of use, and affordable cost, making it a common choice for various electronic projects. However, like any sensor, it has its limitations, and considering its specifications is important for accurate measurements.

SSD1306 Display

The SSD1306 is a popular display controller used in OLED (Organic Light-Emitting Diode) screens. It's commonly employed in various electronics projects to showcase information on small screens. The SSD1306 controller is compatible with different screen sizes and is often integrated with microcontrollers like Arduino to display text, graphics, and images.

This display is used for displaying the temperature and humidity from the DHT22 sensor .

Jumper Wires:

Jumper wires

For making temporary connections and wiring between components.

Breadboard:

Test plate

A breadboard is a useful tool for creating temporary electronic circuits. It allows you to connect components without soldering.

Mounting the Arduino board with the DHT22 sensor and the SSD1306 display

Mounting the Arduino board along with the DHT22 sensor and SSD1306 display can be done in various ways based on the preferences for the project's permanence, aesthetics, and convenience. Here's a suggestion on how to mount them:

Attaching the SSD1306 Display :

- connect the VCC pin of the display to 5V pin of the Arduino

- connect the GND pin of the display to GND pin of the Arduino

- connect the SDA pin of the display to A4 pin of the Arduino

- connect the SCL pin of the display to A5 pin of the Arduino

Mounting the DHT22 Sensor:

- connect the (+) pin of the DHT22 Sensor to 3.3V pin of the Arduino

- connect the (-) pin of the DHT22 to GND pin of the Arduino

- connect the OUT pin of the DHT22 to pin 2 of the Arduino

Mounting the Arduino board with the DHT22 sensor and the SSD1306 displayMounting the Arduino board with the DHT22 sensor and the SSD1306 display

Programming the Arduino UNO board to display the temperature and humidity measured by the DHT22 sensor on the SSD1306 display

To display temperature and humidity measured by the DHT22 sensor on an SSD1306 OLED display using an Arduino Uno, you'll need to integrate both the DHT sensor library and the Adafruit SSD1306 library. Here's an example code that accomplishes this task:

Ensure you've installed the necessary libraries: dhtlib and Adafruit SSD1306.

This code initializes the DHT22 sensor and SSD1306 display. It then reads temperature and humidity data from the DHT22 sensor and displays it on the SSD1306 OLED display.

Upload the code to your Arduino Uno and observe the readings on the SSD1306 OLED display and Serial Monitor.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info