Arduino interfacing with DHT11 and 4Relay and LCD display
In this article we will learn how to interface Arduino with DHT11 and 4Relay with LCD display.
In the last post we learn about how to interface Arduino with LDR and servo motor. you can visit our website ,
Now a day’s I’m busy in giving interviews that’s why there was a little delay of making the projects ,I hope you appreciate my work ,lets discuss about today’s project.
Actual image of this project.
Components which we use in this project list below:
- Humidity sensor (DHT11)
- Bread Board
- LED’s
- 9V Battery
- Push button
- 4 Relay module
- LED’s (4 Pcs)
- Wires (As req.)
- LCD display.
- Resistors 1K. (4Pcs)
Construction diagram which we use in this project.
Construction of arduino interfacing with DHT11 and 4Relay with LCD display:
Connect the GND point of arduino with –ve terminal of battery.
Connect the VIN point of arduino with +ve terminal of battery through toggle button.
Connect DHT11’s –ve point to GND of arduino.
Connect DHT11’s +ve point to 5V of arduino nano.
Connect signal points of sensor (DHT11) to D2 pin of arduino nano.
Connect VCC point of four relay module to 5V point of arduino.
Connect GND point of four relay to GND point of arduino.
Connect in1 point of four relay module to D3 point of arduino.
Connect in2 point of four relay module to D4 point of arduino.
Connect in3 point of four relay module to D5 point of arduino.
Connect in4 point of four relay module to D6 point of arduino.
Connect LCD point to arduino respectively RS to D7, EN point to D6, D4 to D5, D5 to D4, D6 to D3, D7 to D2, K to GND, VDD to 5V, VO to GND.
Connect 5V of arduino to common point of relays.
Connect GND points of arduino to GND points of fans.
Connect NO point of relay1 to LED1 through 1K resistor.
Connect NO point of relay2 to LED2 through 1K resistor.
Connect NO point of relay3 to LED3 through 1K resistor.
Connect NO point of relay4 to LED4 through 1K resistor.
Dress up all the wires clean and tidy.
Working of arduino interfacing with DHT11 and 4Relay with LCD display:
After connecting all the components, press the toggle switch then arduino is power on.
When temperature lies between 90 to 95F then LED1 is on which display on LCD.
When temperature lies between 95 to 100F then LED2 is on which display on LCD.
When temperature lies between 100 to 105F then LED3 is on which display on LCD.
When temperature increase to 105F then LED4 is on which display on LCD.
Application of the arduino interfacing with DHT11 and 4relay with LCD display:
- This project is use for (Home automation system).
- This project is use for (Green house monitoring and control).
- This project is use for (Terrarium control).
- This project is use for (wine cellar management).
- This project is also use for (Data logging for environmental analysis).
- This project is use for (Automated plant watering system).
- This project is use for (Home Brewery system).
- This project is also use for (server room monitoring).
- This project is also use for (Pet habitat control).
- This project is use for (Weather station).
Advantages of arduino interfacing with DHT11 and 4relay with LCD display project are listed below:
- Customizability
- Automation.
- Energy efficiency.
- Data monitoring.
- Remote control.
- Versatility.
- Learning opportunity.
- Low-cost solution.
- Scalability.
- Diy flexibility.
- Fun creativity.
In this project we will use the following codes which are listed below.
#include <LiquidCrystal.h> // Include the LiquidCrystal library for using the LCD display.
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); // Initialize the LCD object with the specified pins.
int entryIR = 8; // IR sensor for entry
int exitIR = 9; // IR sensor for exit
int slotIR[] = {10, 11, 12, 13}; // IR sensors for parking slots
int barrierServoPin = A0; // Servo motor pin
Servo barrierServo; // Initialize the servo motor object.
int availableSpace = 4; // Total available parking spaces
int occupiedSpace = 0; // Currently occupied parking spaces
#include <LiquidCrystal.h> // Include the LiquidCrystal library for using the LCD display.
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); // Initialize the LCD object with the specified pins.
int entryIR = 8; // IR sensor for entry
int exitIR = 9; // IR sensor for exit
int slotIR[] = {10, 11, 12, 13}; // IR sensors for parking slots
int barrierServoPin = A0; // Servo motor pin
Servo barrierServo; // Initialize the servo motor object.
int availableSpace = 4; // Total available parking spaces
int occupiedSpace = 0; // Currently occupied parking spaces
void setup() {
pinMode(entryIR, INPUT);
pinMode(exitIR, INPUT);
for (int i = 0; i < 4; i++) {
pinMode(slotIR[i], INPUT);
}
barrierServo.attach(barrierServoPin); // Attach the servo to the specified pin.
lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows.
lcd.print(“Available: “);
lcd.print(availableSpace);
lcd.setCursor(0, 1);
lcd.print(“Occupied: “);
lcd.print(occupiedSpace);
}
void loop() {
// Check if a car enters the parking area.
if (digitalRead(entryIR) == HIGH) {
if (occupiedSpace < availableSpace) {
barrierServo.write(90); // Open the barrier.
delay(1000); // Allow time for the car to pass.
barrierServo.write(0); // Close the barrier.
occupiedSpace++;
updateLCD();
delay(500); // Delay to avoid multiple readings due to bouncing.
}
}
// Check if a car exits the parking area.
if (digitalRead(exitIR) == HIGH) {
if (occupiedSpace > 0) {
barrierServo.write(90); // Open the barrier.
delay(1000); // Allow time for the car to exit.
barrierServo.write(0); // Close the barrier.
occupiedSpace–;
updateLCD();
delay(500); // Delay to avoid multiple readings due to bouncing.
}
}
}
void updateLCD() {
lcd.setCursor(11, 0);
lcd.print(availableSpace – occupiedSpace);
lcd.setCursor(10, 1);
lcd.print(occupiedSpace);
}