0% found this document useful (0 votes)
33 views5 pages

Experiment 14 18

The document describes interfacing a DHT11 temperature and humidity sensor with an Arduino UNO. It provides details on the sensor specifications and accuracy. It then shows the circuit diagram and provides an Arduino program to read the sensor values and output them to the serial monitor.

Uploaded by

Nitin Khetade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views5 pages

Experiment 14 18

The document describes interfacing a DHT11 temperature and humidity sensor with an Arduino UNO. It provides details on the sensor specifications and accuracy. It then shows the circuit diagram and provides an Arduino program to read the sensor values and output them to the serial monitor.

Uploaded by

Nitin Khetade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Problem statement 6

Write a program for Arduino UNO to interface the VDHT11 Temperature-Humidity sensor and display
output on serial monitor.

Software:
1. Arduino IDE
2. Proteus professional 8

VDHT11 Temperature-Humidity sensor:


The DHT11 is a commonly used Temperature and humidity sensor that comes with a
dedicated NTC to measure temperature and an 8-bit microcontroller to output the values of
temperature and humidity as serial data.

The sensor can measure temperature from 0°C to 50°C and humidity from 20% to 90% with
an accuracy of ±1°C and ±1%. So, if you are looking to measure in this range then this sensor might be
the right choice for you.

Circuit:

The data signal of VDHT11 sensor passes through the pin 2 of the Arduino UNO while other
two terminal of sensor gets VCC and ground.
Program:
#include <DHT.h>

#define DHT_PIN 2 // Connect the DHT sensor to digital pin 2

DHT dht(DHT_PIN, DHT11);

void setup() {

Serial.begin(9600);

dht.begin();

void loop() {

delay(2000); // Delay to stabilize the sensor readings

float humidity = dht.readHumidity();

float temperature = dht.readTemperature();

if (isnan(humidity) || isnan(temperature)) {

Serial.println("Failed to read from DHT sensor!");

} else {

Serial.print("Humidity: ");

Serial.print(humidity);

Serial.print("%\t");

Serial.print("Temperature: ");

Serial.print(temperature);

Serial.println("°C");

}
Output:
Problem statement 7
Write a program for Arduino UNO to interface the LDR sensor and display output on serial monitor.

Software:
1. Arduino IDE
2. Proteus professional 8

LDR sensor:
The Light Dependent Resistor (LDR) or also popularly known as Photoresistor is just another
special type of Resistor and hence has no polarity so they can be connected in any direction. They are
breadboard friendly and can be easily used on a perf board also. The symbol for LDR is similar to Resistor
but includes inward arrows. The arrows indicate the light signals.

Circuit:

The data signal of LED sensor passes through the pin A0 of the Arduino UNO while other two
terminal of sensor gets VCC and ground.

Program:
const int ldrPin = A0; // Connect the LDR to analog pin A0
void setup() {
Serial.begin(9600);
}
void loop() { // Read the analog value from the LDR
int ldrValue = analogRead(ldrPin); // Print the value to the Serial Monitor
Serial.print("LDR Value: ");
Serial.println(ldrValue);
delay(1000); // Delay for readability, adjust as needed
}
Output:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy