0 Comments

ସର୍କିଟ ଡାୟଗ୍ରାମ:

ମାଇକ୍ରୋକଣ୍ଟ୍ରୋଲର କୋଡ:

//Code for  microntroller
//PROTECTION FROM HEAT AND RAIN
//Su-Din Technology, Contact: 9861004895
#include <TinyDHT.h>
#include <LiquidCrystal.h>
#define DHTPIN 10
#define DHTTYPE DHT11
DHT dht(DHTPIN,DHTTYPE);
//----------------------
#include<Servo.h>
int readPin=A0;
int readVal;
float V=0;
Servo s1;
//----------------------
LiquidCrystal lcd(2,3,4,5,6,7);// Initialize the interface pins
byte degree[] = {
  B00010,
  B00101,
  B00010,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000
};//This is for creating a degree symbol in LCD

void setup() {
Serial.begin(9600);
dht.begin(); // Initialize the sensor
//-------------------------
s1.attach(9);//Control wire of servo to PWM pin D9
s1.write(0); /*when project is initially powered, 
           servo angle=0, 
          THIS IS A RESET OF PROJECT*/          
pinMode(readPin,INPUT);
//-------------------------
lcd.begin(16, 2);
lcd.createChar(0, degree);
lcd.home();
lcd.setCursor(12,0);
lcd.write((byte)0); 
}
 
void loop(){
float h=dht.readHumidity();
float t=dht.readTemperature();
Serial.print("Temperature = ");
Serial.println(t);
Serial.print("Humidity = ");
Serial.println(h);
delay(2000);
lcd.setCursor(0,0);
lcd.print("Temp = ");
lcd.setCursor(7,0);
lcd.print(t);
lcd.setCursor(9,0);
lcd.print("   ");// This is for not representing fractional values in LCD
lcd.setCursor(13,0);
lcd.print("C  ");
lcd.setCursor(14,0);
lcd.print("  ");
lcd.setCursor(0,1);
lcd.print("                ");
//--------------------------
readVal=analogRead(readPin);/*We have to read the analog 
                             voltage value at pin A0
                             which is developed at anode of led
                             of water sensor circuit*/
V=(5./1023.)*readVal;  
Serial.print(V);
Serial.println("volts");
delay(500);

if(V<=2.6){
  s1.write(90);
  delay(1000);}  
//--------------------------
if(t>=40) // THIS IS THE LIMIT WE HAVE TO SET
{
  s1.write(90);
  delay(1000);
  }
delay(1000);
}

Designer:
Er. Anil Kumar Prusty
WhatsApp: +91 9861004895

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts