Teacher name : Sadhana Nitin Raskar(Table 18)
Student Names:
1.)Anwita Vikrant Kane
2.)Tushar Pravin Khanderao
3.)Aniket Ashok HivraleThe Arduino UNO is connected to the DHT11 temperature sensor and a 16x2 I2C LCD display. The DHT11’s VCC pin is connected to the 5V pin on the Arduino, GND to GND, and the DATA pin to digital pin 2. The I2C LCD also connects VCC to 5V and GND to GND, while its SDA and SCL pins connect to Arduino pins A4 and A5 respectively. Both devices share the same power and ground, with the Arduino reading temperature data from the DHT11 and displaying it on the LCD. The following code was used :
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#include <Adafruit_BMP085.h>
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP085 bmp;
LiquidCrystal_I2C lcd(0x27, 16, 2); // Change to 0x3F if needed
void setup() {
lcd.init();
lcd.backlight();
dht.begin();
bmp.begin();
}
void loop() {
float temp = dht.readTemperature();
float hum = dht.readHumidity();
lcd.clear();
// First row: Temperature & Humidity
if (isnan(temp) || isnan(hum)) {
lcd.setCursor(0, 0);
lcd.print("DHT Error!");
} else {
lcd.setCursor(0, 0);
lcd.print("T:");
lcd.print(temp);
lcd.print("C H:");
lcd.print(hum);
}
// Second row: Pressure
if (bmp.begin()) {
float pressure = bmp.readPressure() / 100.0; // Convert to hPa
lcd.setCursor(0, 1);
lcd.print("P:");
lcd.print(pressure);
lcd.print(" hPa");
} else {
lcd.setCursor(0, 1);
lcd.print("BMP Not Found");
}
delay(3000);
}
