Temperature based door control

// Interfacing Arduino with DHT11 humidity and temperature sensor

// include LCD library code
#include <LiquidCrystal.h>
// include DHT library code
#include "DHT.h"

#define DHTTYPE DHT11 // DHT11 sensor is used
DHT dht // Initialize DHT library
#define DHTPIN 8 // DHT11 data pin is connected to Arduino pin 8 it will act as input

#define motor_pin 9
#define led_pin 11

// LCD module connections (RS, E, D4, D5, D6, D7)
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

char temperature[] = "Temp = 00.0 C ";

void setup() {
// set up the LCD's number of columns and rows
Serial.begin(9600)
pinMode(motor_pin, OUTPUT);
pinMode(led_pin, OUTPUT) ;
pinMode(DHTPIN , INPUT);
lcd.begin(16, 2);
dht.begin();
}

void loop()
{
delay(1000); // wait 1s between readings
//Read temperature in degree Celsius
byte Temp = dht.readTemperature;

// Check if any reads failed and exit early (to try again)
if (Temp>36 && Temp<38 )
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Tempreature:");
lcd.print(Temp);
lcd.setCursor(0,0);
lcd.print("Welcome");

door();
return;

}

else if(Temp<36)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Tempreature:");
lcd.print(Temp);
lcd.setCursor(0,0);
lcd.print("Try Again");
return;
}

else if(Temp<38)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Tempreature:");
lcd.print(Temp);
lcd.setCursor(0,0);
lcd.print("High Tempreature");
return;
}

}

void door()
{
digitalWrite(motor_pin, HIGH);
digitalWrite(led_pin, HIGH);

delay(50000); //wait second

digitalWrite(motor_pin, LOW);
digitalWrite(led_pin, LOW);
}

This is code i have written for a Arudino Uno for tempreature based door control
i have certain difficulties in the code.
Any help is welcomed.

Here is schematic for which i am trying

I have some difficulty in knowing what your difficulties are.
Paul

The code i have written is having errors and i don't know how to correct them.

There are many errors.
Should i post the errors also

comb:16:1: error: expected initializer before 'LiquidCrystal'
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

what this error means

missing ";" after dht on previous line

i will see it

error: 'lcd' was not declared in this scope

what does this error means

did you fix the previous error?

Yes i got that one

i don't know i don't get that error

but also
temperature needs to be either a ptr or array []

const char *temperature = "Temp = 00.0 C ";

missing ";"

Serial.begin(9600);

missing "()"

byte Temp = dht.readTemperature ();

Means i need to change the variable type of Tempereature

yes, add the '*"

Okk done .
I just need one more help.
My project is for a door which is controlled a motor, which will opened only when the temperature of the person standing in front of it is in range of 36-38. And for other cases it will not.
AM I going in correct direction?

seems ok -- if temp good, open door for 50 sec, then close door.

not sure you need to report temp not good. won't that be what normally happens when no person is near door?

what happens if air temperature is ~37C? do you need something to check if person is near door and then check temperature?

Yes i was going for Ultrasonic Sensor but the budget limited , so had to drop that.
and i will take -ve values into consideration.
Any other ways I can improve.
Welcome for more suggestions

Nice it is cheap and I will use it , thanks

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.