+21622886281
Arduino DHT11 I2C LCD 1602 Display

Measuring temperature with DHT11 sensor and Arduino

Measuring temperature with Arduino is a common application that can be achieved by using a temperature sensor such as the LM35 or the DS18B20. These sensors can be connected to an Arduino board and used to read the temperature and convert it into a digital value that can be read by the microcontroller.

The basic steps to measure temperature with Arduino are:

  1. Connect the temperature sensor to the Arduino board. The temperature sensor typically has three pins: VCC, GND, and OUT. The VCC pin is connected to a power source (usually 3.3V or 5V), the GND pin is connected to ground, and the OUT pin is connected to an analog or digital input pin on the Arduino board.
  2. Write the code: Use the Arduino programming language to read the sensor data and convert it into a temperature value. The code can also include calculations and logic to display the temperature value on a display device or to take specific actions based on the temperature reading.
  3. Upload the code: The code can be uploaded to the Arduino board using a USB cable and the Arduino development software.
  4. Connect the output device: A display device, such as an LCD or an OLED display, can be connected to the Arduino board to display the temperature value.
  5. Power supply: Finally, the Arduino board and the other electronic components can be powered through a power supply or a battery.

It’s important to check the datasheet of the sensor you’re using to have the correct voltage level, the correct range and the correct formula to convert the raw data from the sensor to temperature measurement.

Once the system is set up and running, the temperature can be read and displayed on the connected display device. The temperature data can also be sent to a computer, a mobile device or a cloud service using communication protocols such as USB, serial, I2C or WiFi.

Purpose of this tutorial:

In this tutorial we will see how to read the temperature measured by the DTH11 sensor and display it on an LCD I2C 160A display.

Required components

Arduino UNO

The Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button. It is the most popular and widely used board among the Arduino boards.

The Arduino UNO can be programmed using the Arduino programming language, which is based on C++. It uses a simple and intuitive programming environment, making it easy for beginners to get started with microcontroller programming.

The Arduino UNO can be connected to various sensors and actuators to control different devices and perform different tasks. For example, it can be used to control motors, read data from sensors, display information on an LCD screen, and communicate with other devices via serial communication protocols such as I2C and SPI.

The Arduino UNO can also be powered by a USB cable or an external power supply, making it easy to use in a wide range of projects and applications. It’s compatible with a wide range of shields (expansion boards) that adds functionality to the board, such as Ethernet, WiFi, and Bluetooth, and it’s widely supported by a strong and active community, which provides a lot of tutorials, examples and libraries to help users to get the most of the board.

LCD I2C 160A display

An LCD I2C 160A display is a type of liquid crystal display (LCD) that uses the Inter-Integrated Circuit (I2C) protocol to communicate with the controller or host device. The “160A” in the name likely refers to the display’s dimensions, with a screen size of 160×128 pixels. I2C is a communication protocol that allows multiple devices to connect to a single bus and communicate with one another using only two wires (SDA and SCL). This can make it a more efficient and cost-effective solution for connecting multiple devices in a project, as compared to using separate wires for each device.

DHT11 sensor

The DHT11 sensor is a temperature and humidity sensor that can be used to measure the ambient temperature and humidity. It is a low-cost and easy-to-use sensor that can be connected to an Arduino or other microcontroller. The DHT11 sensor has three pins: VCC, GND, and data. The VCC pin is connected to a power source (usually 3.3V or 5V), the GND pin is connected to ground, and the data pin is connected to a digital I/O pin on the microcontroller.

The DHT11 sensor uses a one-wire communication protocol to send the temperature and humidity data to the microcontroller. To read the data from the sensor, a library can be used that provides functions to read the data and convert it into temperature and humidity values.

The DHT11 sensor is relatively accurate and can measure temperature and humidity within a range of 0-50°C and 20-90% respectively, but it’s not recommended for precision measurements. It has a resolution of 1°C for temperature and 1% for humidity.

The basic steps to measure temperature and humidity with a DHT11 sensor and Arduino are:

  1. Connect the DHT11 sensor to the Arduino board, following the pinout VCC, GND, and data.
  2. Install the DHT library for Arduino and include it in the code.
  3. Use the functions provided by the library to read the temperature and humidity data from the sensor.
  4. Display the temperature and humidity values on a display device, such as an LCD or OLED display.
  5. Optionally, the data can be sent to a computer or a cloud service for further analysis or storage.

connecting wires

Connecting wires are used to connect various components in an electronic circuit. They allow for the transfer of electricity, data, or signals between different devices and components.

When connecting wires to an Arduino or other microcontroller, it is important to pay attention to the correct pinout. The pinout refers to the arrangement of pins on the microcontroller and the corresponding function of each pin. The Arduino pinout can be found in the documentation provided by the manufacturer, or in various resources available online.

Mounting

For the DTH11 sensor, we connect:

  • DATA pin of the DTH11 sensor to the digital PIN2 of arduino.
  • VCC pin of the DTH11 sensor to the 3.3 V PIN of Arduino.
  • GND pin of the DTH11 sensor to the GND of Arduino.

For the LCD display we connect:

  • the SDA pin at the Arduino analog pin A4.

  • the SCL pin at the Arduino analog pin A5.

  • the VCC pin at the Arduino 5v pin.

  • the GND pin at the Arduino GND pin

Program

Here is the program that reads the temperature measured by the DTH11 sensor and displays it on an LCD display.

 

Note: you must import the two libraries DTH11 and I2c_LCD1602




0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée.

Scroll to Top