Experiment 14 18
Experiment 14 18
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
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>
void setup() {
Serial.begin(9600);
dht.begin();
void loop() {
if (isnan(humidity) || isnan(temperature)) {
} 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: