Lab Assign 10
Lab Assign 10
B 10
● Aim:Write a program read the temperature sensor and send the values to the serial
monitor on thecomputer
● Outcome:Temperature sensor
Connectivity,configurationandserialcommunicationwithArduino.
HardwareRequirement:
Arduino board –
Breadboard.
Some male-female wires.
DHT 11 temperature sensor
Arduino,USBcableetc.
● SoftwareRequirement:ArduinoIDE
● Theory:
The DHT11 is a commonly used and cost-effective sensor that provides readings of
both temperature and humidity. Compact and cost-effective, it has become a popular choice in the
electronics community for its relative accuracy and ease of integration. Operating on a simple one-wire
communication protocol, the DHT11 can be seamlessly interfaced with a variety of microcontrollers,
making it suitable for a wide range of applications.
Developed for digital systems, the DHT11 finds its applications in environments where there’s a need
to monitor or control atmospheric conditions, such as in smart homes, weather stations, and agricultural
monitoring systems.
Features/Specifications of DHT11 Sensor
Power Supply: Typically operates from 3.3 to 5V DC, making it suitable for interfacing with
most microcontrollers.
Temperature Range: 0°C to 50°C with ±2°C accuracy.
Humidity Range: 20% to 90% RH (Relative Humidity) with ±5% accuracy.
Output: Calibrated digital signal. It employs a single-wire communication protocol which
simplifies integration with microcontroller systems.
Sampling Period: Suggested minimum time of 1 second between readings to ensure sensor
accuracy.
Dimensions: Compact size, often available in a 4-pin single-row package.
Longevity: Offers excellent long-term stability, thanks to its calibrated digital output.
Construction of DHT11 Sensor
Sensing Elements: The DHT11 integrates two primary components for its operations:
1. A thermistor for temperature measurements.
2. A capacitive humidity sensor for gauging atmospheric moisture.
IC Integration: An 8-bit microcontroller reads the outputs from the two sensors and translates
them into a format suitable for digital systems.
Packaging: The sensor elements are often encased in a plastic casing, which ensures protection
against environmental factors while still allowing for accurate readings.
o Temperature Measurement: The core of the temperature sensing capability is the
thermistor, a type of resistor whose resistance changes with temperature. As the
temperature fluctuates, so does the resistance of the thermistor. This variance is then
read and converted into temperature values by the onboard microcontroller.
Humidity Measurement: The capacitive humidity sensor operates by having a dielectric material
between two plates. As humidity changes, the dielectric constant of the material changes,
leading to a variance in capacitance. This change in capacitance is then read and interpreted as a
humidity percentage by the onboard microcontroller.
Signal Output: After the microcontroller processes the readings, the data is sent as a digital
signal through a single-wire communication protocol. This digital output can then be easily read
by microcontrollers such as Arduino, making integration and data interpretation straightforward.
Pinout of DHT11 Sensor
The DHT11 typically comes with a 4-pin package, although only three of them are functionally used:
1. VCC (Pin 1): This is the power supply pin, which can accept voltages from 3.3V to 5V, making
it compatible with most microcontroller systems.
2. Data (Pin 2): This is the pin through which the DHT11 communicates. It uses a proprietary
single-wire protocol to transmit temperature and humidity data to the connected microcontroller.
3. NC (Pin 3): Not connected or used.
4. GND (Pin 4): Ground pin, used to complete the circuit.
Hardware Connection
The connection diagram is pretty simple as shown in the image below.
Connect the VCC & GND Pin of DHT11 Sensor Module to 3.3V & GND pin of Arduino respectively.
Similarly connect the DHT11 Data pin to Arduino Digital Pin 2.
You can use a jumper wire & connect the sensor with Arduino Board.
As shown in fig. DHT11 sensor has three pins: GND, DATA and VCC
Steps:
1. Connect GND and VCC to ground and VCC of Aurdino
2. Connect Data pin of temp sensor to 2 pin.
3. RunPythoncode temp.py
3. When the code is uploaded, open the Serial Monitor and set the baud rate to 9600.
Program:
Conclusion