SEN-DHT22 Temperature and Humidity Sensor Instruction Manual
- June 26, 2024
- SEN
Table of Contents
- SEN-DHT22 Temperature and Humidity Sensor
- Product Usage Instructions
- CONNECTION INFORMATION
- USAGE WITH ARDUINO
- USE WITH A RASPBERRY PI
- Initialize the DHT with the data pin connected to pin 16 # (GPIO 23) of the
- Output of values via the serial interface
- Mistakes happen quite often, DHT’s are hard to # read, just keep going
- FURTHER INFORMATION
- References
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
SEN-DHT22 Temperature and Humidity Sensor
Specifications:
- Product Name: SEN-DHT22
- Function: Temperature and humidity sensor
- Input Voltage Range: 3.3V to 6V
- Output Signal: Digital via 1-Wire-Protocol
Product Usage Instructions
Usage with Arduino:
-
Install necessary libraries:
- Open Arduino IDE.
- Go to Sketch -> Include Library -> Manage Libraries.
- Search for “DHT” and install the DHT sensor library.
- Search for “Adafruit Unified Sensor” and install the Adafruit
Unified Sensor library by Adafruit.
-
Connect the sensor to your Arduino.
-
Test the functions:
-
Open File -> Examples -> DHT sensor library ->
DHTtester. -
Upload the code examples to your Arduino.
-
Observe the sensor output on the serial display.
-
Use with Raspberry Pi:
Note: The guide is based on Raspberry Pi OS Bookworm for Raspberry Pi
4 and 5.
- Create a new Python file:
- Enter command: nano dht22.py
- Insert the provided Python code snippet.
- Save the file (CTRL + O) and exit (CTRL + X).
- Execute the file:
- Run command: python3 dht22.py
FAQ:
-
Q: What is the input voltage range of the DHT22 sensor?
A: The DHT22 sensor can operate within a voltage range of 3.3V to 6V, making it versatile for use in various systems. -
Q: How can I test the DHT22 sensor with Arduino?
A: To test the DHT22 sensor with Arduino, install the required libraries, connect the sensor to Arduino, upload code examples provided in the library, and monitor the sensor output on the serial display. -
Q: What operating systems and hardware are compatible with the Raspberry Pi setup?
A: The guide provided is based on Raspberry Pi OS Bookworm for Raspberry Pi 4 and 5. Compatibility with newer operating systems or hardware has not been confirmed.
GENERAL INFORMATION
Dear customer,
Thank you for purchasing our product. In the following, we will show you which
things should be observed during the use.
Should you encounter any unexpected problems, do not hesitate to contact us.
CONNECTION INFORMATION
The DHT22 temperature and humidity sensor is versatile and especially flexible with its input voltage. So, it is not dependent to a voltage of exact 3.3 V but can be used with a voltage range from 3.3 to 6 V. For that reason, the sensor can be applied in many different systems. The output signal is issued digital via the 1-Wire-Protocol.
USAGE WITH ARDUINO
For the usage with an Arduino, you have to install the necessary libraries
beforehand.
Therefore, open your Arduino IDE and choose Manage libraries in Sketch ->
Implement libraries -> Manage libraries.
The Arduino library manager will now open. Here, you can enter the term DHT
into the search bar. Install the DHT sensor library here.
Enter the next term Adafruit Unified Sensor and install the library Adafruit Unified Sensor by Adafruit.
After you have connected the sensor to your Arduino and have installed the
libraries, you can test the functions of this sensor.
The installed DHT library includes already code examples which you can use for
the first function test.
These can be performed in your Arduino IDE via File -> Example ->DHT sensor
library -> DHTtester.
Transfer the code examples onto your Arduino and observe the output of the
sensor on the serial display.
USE WITH A RASPBERRY PI
This guide was written under Raspberry Pi OS Bookworm for the Raspberry Pi 4 and 5. It has not been checked with newer operating systems or hardware.
First you have to install pip, enter the following command in your
terminal:
sudo apt-get install python3-pip
The next step is to set up the virtual environment.
To do this, enter the following commands:
mkdir dein_projekt && cd dein_projekt
python -m venv –system-site-packages env
source env/bin/activate
Now you have to install the Adafruit_CircuitPython_DHT library from Adafruit
which was published under the MIT license.
To do this, enter the following command:
pip3 install adafruit-circuitpython-dht
After the installation, you can create a new Python file by entering the
following command:
nano dht22.py
Now insert the following code.
import time
import board
import adafruit_dht
Initialize the DHT with the data pin connected to pin 16 # (GPIO 23) of the
Raspberry Pi:
dhtDevice = adafruit_dht.DHT22(board.D23)
while True:
try:
Output of values via the serial interface
temperature_c = dhtDevice.temperature
temperature_f = temperature_c * (9 / 5) + 32
humidity = dhtDevice.humidity
print(“Temp: {:.1f} F / {:.1f} C Luftfeuchtigkeit: {}%”.
format(temperature_f, temperature_c, humidity))
except RuntimeError as error:
Mistakes happen quite often, DHT’s are hard to # read, just keep going
print(error.args[0])
time.sleep(2.0)
continue
except Exception as error:
dhtDevice.exit()
raise error
time.sleep(2. )
Save the file with CTRL + O and Enter and close it again with CTRL+X.
Now you can execute the file with the following command: python3 dht22.py
FURTHER INFORMATION
Our Information and Take-back Obligations according to the German Electronic Law (ElektroG)
Symbol on Electrial and Electronic Products:
This crossed-out bin means that electrical and electronic products do not
belong into the household waste. You must hand over your old appliance to a
registration place. Before you can hand over the old appliance, you must
remove used batteries and replacement batteries which are not enclosed by the
device.
Return Options:
As the end user, you can hand over your old appliance (which has essentially
the same functions as the new one bought with us) free of charge for disposal
with the purchase of a new device. Small devices, which do not have outer
dimensions bigger than 25 cm can be handed in for disposal independently of
the purchase of a new product in normal household quantities.
-
Possibility of return at our company location during our opening hours
SIMAC Electronics GmbH, Pascalstr. 8, D-47506 Neukirchen-Vluyn -
Possibility of return nearby
We will send you a parcel stamp with which you can send us your old appliance free of charge. For this possibility, please contact us via e-mail at service @joy-it.net or via telephone.
Information about Package:
Please package your old appliance safe for transport. Should you not have
suitable packaging material or you do not want to use your own material, you
can contact us and we will send you an appropriate package.
SUPPORT
If any questions remained open or problems may arise after your purchase,we
are available by e-mail, telephone and ticket support system to answer these.
E-Mail: service@joy-it.net
Ticket-system: https://support.joy-it.net
Telephone: +49 (0)2845 9360 – 50 (Mo – Do: 09:00 – 17:00 o’clock,
Fr: 09:00 – 14:30 o’clock)
For further information visit our website:
www.joy-it.net
www.joy-it.net
Simac Electronics GmbH
Pascalstr. 8, 47506 Neukirchen-Vluyn
References
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>