Control A.C MOTOR By Pressure Sensor

I work in Water Station And part Of our Sterilization method CHLORINE System
(consist of 7.5kw A.C booster and chlorine injector )

"OUR frequent problem was "low tube pressure
So I Install A pressure sensor on the tube
and wiring it to WEMOS D1 board With 5v Relay And 16x2 LCD
to display live pressure reading for workers
the code i have here suppose to start the 5 v Relay for 3 sec in order to generate pressure and start the A.C motor(Booster)
afterwards . the code should check tube pressure repeatedly
should be (1.5 bar min )to (8 bar max)
if pressure sensor sensing lower pressure it turn off 5v relay for 2 min and then start again if pressure still not corrected it will repeat the process
UNTILL pressure stabilized
then 5v relay continue working
A.C BOOSTER continue working
chlorine system safe working
help me correct the code
it didnt work perfectly

#include <ESP8266WiFi.h>
#include <LiquidCrystal_I2C.h>
#include <BigNumbers_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd2(0x27,16,2);

int ledPin = D3;


// defines variables

// put your main code here, to run repeatedly:
 




void setup()
{
  pinMode(A0, INPUT); // Sets the echoPin as an Input
    pinMode(ledPin, OUTPUT);
    digitalWrite(ledPin, LOW);
delay(3000);

  lcd2.init();   
  lcd2.init();                      // initialize the lcd 
// initialize the lcd 
lcd2.backlight();
Serial.begin(115200);

lcd2.begin(16, 2);  
lcd2.setCursor(0,1);
lcd2.print("HUSSAIN WATER TP");
  delay(4000);
  lcd2.clear();
  
 
}

void loop()
{
   
  int sensorval=analogRead(A0);
  Serial.print("Sensor value:");
    Serial.println(sensorval);
    float voltage=(sensorval*3)/1024.0;
  Serial.print("VOLTS:");
    Serial.println(voltage);
    float pressure_pascal=(3.0*((float)voltage-0.47))*1000000.0;
    
float pressure_bar=pressure_pascal/10e5;

  Serial.print("pressure=");
    Serial.print(pressure_bar);
    
  Serial.println("bars");
  lcd2.setCursor(0,0);
lcd2.print("Pressure :");
  lcd2.setCursor(11,0);

lcd2.print(pressure_bar);



   

if (pressure_bar < 1.5 ) 
 {
  digitalWrite (ledPin,HIGH); 
  delay(50000);
    digitalWrite (ledPin,LOW);

  
  delay(1000);
}
  delay(1000);

}```
Comments (0)