Cod
Cod
#include <Wire.h>
#include <SoftwareSerial.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd(8,9,10,11,12,13);
//**************************************************
#include <DallasTemperature.h>
#define ONE_WIRE_BUS A2
// Setup a oneWire instance to communicate with any OneWire devices (not just
Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
int temp;
//************************************
int CT=A0;
int celsius,p6,gas;
#define L A1
float current;
int bz=7;
int rl=6;
int val, reading;
//************************************
//String myAPIkey = "72E5WOY95GIS7DSV";//old
//***************************************
void setup()
{
pinMode(CT,INPUT);
pinMode(L,INPUT_PULLUP);
// pinMode(Lv,INPUT_PULLUP);
pinMode(bz,OUTPUT);
pinMode(rl,OUTPUT);
digitalWrite(bz,HIGH);
delay(500);
digitalWrite(bz,LOW);
delay(500);
lcd.print("T/F Monitoring");
Serial.println("transformer");
lcd.setCursor(0,1);
lcd.print("Project By:Pratik ");
delay(1500);
lcd.clear();
lcd.print("Vaibhav,Pratiksha");
lcd.setCursor(0,1);
lcd.print("Durgesh,Prathmesh");
delay(1000);
lcd.clear();
lcd.print("Machhindra");
delay(1000);
// wifi();
}
void loop()
temp1();
Oil();
ct();
if (waitTime > (writingTimer*1000))
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Updating ");
updatedata();
}
void readSensor(){
p6 = digitalRead(L);
Serial.println(p6);
sensors.requestTemperatures();
temp =sensors.getTempCByIndex(0);
Serial.print("c: "); Serial.println(temp);
val = analogRead(CT);
//Serial.println(celsius);
Serial.println("CT");
float adcVoltage = (val / 1024.0) * 5;
//float current =((adcVoltage-2500)/66);
current=((4.73*adcVoltage)); // 330ohm
//Serial.println(val);
///Serial.println(adcVoltage);
//Serial.println(current);
}
void temp1()
{
sensors.requestTemperatures();
Serial.print("Temperature is: ");
temp =sensors.getTempCByIndex(0);
Serial.print("c "); Serial.println(temp);
if(temp>40)
Serial.println("Temprature Is High");
lcd.clear();
lcd.print("Over temp");
digitalWrite(bz,HIGH);
delay(1000);
digitalWrite(bz,LOW);
}
else
{
digitalWrite(bz,LOW);
}
}
void Oil()
{
if(p6 ==0)
{
Serial.println("Oil Level Below Normal level And Above 50%");
lcd.clear();
lcd.print("oil Level Low");
digitalWrite(bz,HIGH);
delay(1000);
}
else
{
digitalWrite(bz,LOW);
}
}
void ct()
{
if(current>2)
{
lcd.clear();
lcd.print("Over current");
delay(1000);
Serial.println("Over Current");
digitalWrite(rl,HIGH);
digitalWrite(bz,HIGH);
delay(2000);
digitalWrite(bz,LOW);
}
else
{digitalWrite(rl,LOW);
void display1()
{
lcd.clear();
lcd.print("Temp CT Oil");
lcd.setCursor(0,1);
lcd.print(temp);
lcd.setCursor(5,1);
lcd.print(current);
if(p6==1)
{
lcd.setCursor(10,1);
lcd.print("Normal");
}
else
{
lcd.setCursor(10,1);
lcd.print("LoW");
}
delay(1000);
void updatedata(){
command += "\r\n";
Serial.print("AT+CIPSEND=");
esp.print("AT+CIPSEND=");
Serial.println(command.length());
esp.println(command.length());
Serial.println("AT+CIPCLOSE");
esp.println("AT+CIPCLOSE");
//Resend...
}
}
if (debug)
{
Serial.print(response);
}
return response;
}
void wifi(){
Serial.println("Connected ok");
lcd.clear();
lcd.print("Connected");
delay(500);