Ozeki 10
DC Motor DC Motor | Arduino Mega Arduino Mega

How to use an Arduino DHT Sensor?

By following the guide of this page you will get to know with Arduino DHT sensor. This sensor is a great tool to measure temperature and humidity and send these data to the board which can store them. This guide also shows that how you can connect the DHT sensor to your Ozeki system and manage it. The document provides some diagram and videos for better understanding. So, let's get started.

What is an DHT Sensor?

The DHT humidity and temperature sensor makes it really easy to add humidity and temperature data to your DIY electronics projects. It’s perfect for remote weather stations, home environmental control systems, and farm or garden monitoring systems.

How does an Arduino DHT Sensor work?

They consist of a humidity sensing component, an NTC temperature sensor (or thermistor) and an IC on the back side of the sensor. For measuring humidity they use the humidity sensing component which has two electrodes with moisture holding substrate between them. So as the humidity changes, the conductivity of the substrate changes or the resistance between these electrodes changes. This change in resistance is measured and processed by the IC which makes it ready to be read by a microcontroller.

On the other hand, for measuring temperature these sensors use a NTC temperature sensor or a thermistor. A thermistor is actually a variable resistor that changes its resistance with change of the temperature. These sensors are made by sintering of semiconductive materials such as ceramics or polymers in order to provide larger changes in the resistance with just small changes in temperature. The term “NTC” means “Negative Temperature Coefficient”, which means that the resistance decreases with increase of the temperature.

How to use an Arduino DHT Sensor?

To operate with a DHT sensor, you need to connect three wires to your Arduino. As you can see it on Figure 1, to the middle pin of the DHt sensor goes to the 5V pin, the pin on the right-hand side needs to be connected to the ground (Gnd) and the left-hand side pin goes to a digital input of the Arduino.

Arduino DHT sensor wiring diagram

wiring diagram of arduino dht sensor
Figure 1 - Wiring diagram of Arduino DHT Sensor

How to use an Arduino DHT sensor in Ozeki

DHT Controller connections are capable to transfer temperature or humidity measurement data from DHT11/DHT22 sensors to your Ozeki software which data can be forwarded to any direction. The measurements inside each DHT sensor are automatically refreshed in every 2 seconds. The temperature and humidity of each DHT sensor can be accessed through this connection with your Ozeki software. To use the DHT sensor in Ozeki, you first need to download Ozeki Robot Developer. Ozeki Robot Developer will install the Arduino libraries needed to use this sensor efficiently.

Download Ozeki Robot Developer

Download Ozeki Robot Developer

After Ozeki Robot developer is installed, you need to upload the DHT sensor control code to your Arduino. You can find the code and download instructions on the following pages. The upload process includes two steps: first you need to format the EEPROM of the arduino, then you need to upload the control code. The procedure is very simple, it only takes a few seconds.

Upload the DHT sensor code to Arduino Uno
Upload the DHT sensor code to Arduino Mega 2560
Upload the DHT sensor code to Arduino Nano
Upload the DHT sensor code to Raspberry Pi

The arduino sensors and Ozeki will communicate over the USB port using the Ozeki DHT sensor protocol. This protocol makes it possible for you to use the sensor directly on your PC. You will be able to control this sensor through the web based user interface or you will be able to communicate with it using Ozeki Chat. You can read more about chat control on the following page.

How to communicate with the DHT sensor using chat

It is important to understand chat control, because when you build a robot, the way you wish to control this sensor is by sending and receiving messages. If you open the Ozeki Robot Developer app, you will see, who you can write a C#.Net program to work with this sensor.

Connection steps

  1. Use the wiring diagram to connect the DHT sensor to Arduino
  2. Connect the Arduino board to your computer
  3. Check the COM port in the Windows device list
  4. Open the Arduino application on your computer
  5. Upload example code to the Arduino
  6. Open Ozeki 10 in your browser
  7. Choose the DHT sensor connection
  8. Click 'Measure' to get data from the sensor

System overview

The system we suggest consists of a DHT sensor, that is wired to the analog port of your Arduino. The Arduino will be responsible for reading data from this device in real-time. The brain of the system will be running on a PC (Figure 2). On the PC, Ozeki 10 will be able to manage the communication. You can easily run Ozeki 10 using a webbrowser

setup dht sensor to pc using arduino
Figure 2 - System configuration of DHT sensor connecting to PC using Arduino

Prerequisites

  • One of the following Temperature and Humidity sensors
    DHT11:
    • 0-50 °C (+/- 2°C accuracy)
    • 20-80 RH (5% accuracy)
    • Gets new data in every 2 seconds
    DHT22:
    • -40-80 °C (+/- 0.5°C accuracy)
    • 0-100 RH (2-5% accuracy)
    • Gets new data in every 2 seconds
  • 4.7kΩ resistor
  • Ozeki 10 installed on your computer
  • Programmable board (Arduino Mega/Nano/Uno or Raspberry Pi)
  • USB cable is needed between Arduino Mega/Nano/Uno and your computer

Step 1 - Wire the DHT sensor to your Arduino

You can see how to wire the DHT sensor (such as DHT11) to any of the following boards:

After wiring, please plug the board to your computer!

Step 2 - Upload code to the microcontroller

(Here is the code to upload)

Step 3 - Start Ozeki 10 to try the DHT sensor

Step 4 - Configure your DHT sensor in Ozeki 10

To be able to configure your DHT sensor (attached to your Arduino) in Ozeki 10, that is installed on your computer, you need to open the graphical user interface (GUI) of Ozeki 10. You can open the GUI by entering the URL of the computer into your webbrowser. For example, if our PC has an IP address of 192.168.1.5, we would enter http://192.168.1.5:9513 into our webbrowser.

Step 5 - Understand the DHT sensor protocol

The DHT Controller can communicate with Ozeki through the following protocol.

References:
https://www.circuitbasics.com
https://howtomechatronics.com

Copyright © 2000- - Ozeki Ltd | info@ozeki.hu
Home > Products > Ozeki 10 > Connections > Arduino > DHT Sensor
Legal | Privacy | Terms of use | 2986
18.233.111.242 | 92.118.27.157 | Login