electronic

parent 284a0fc9
Pipeline #106785 passed with stage
in 44 seconds
This diff is collapsed.
......@@ -40,7 +40,7 @@
In order to better understand the project, we will divide it into 3 parts:<br>
<h2><a href="design.html">DESIGN</a></h2><br>
<h2><a href="sensors.html">SENSORS</a></h2><br>
<h2><a href="construction.html">ELECTRONICS AND CONTROL</a></h2><br>
<h2><a href="electronic.html">ELECTRONICS AND CONTROL</a></h2><br>
<h2><a href="construction.html">IMPLEMENTATION</a></h2><br>
<h2><a href="construction.html">PROBLEMS AND SOLUTIONS</a></h2><br>
The result can be seen in the following image.
......
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
SoftwareSerial mySerial(0,1);
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
#define ONE_WIRE_BUS 16
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
const float offset=1.0;
int rele=11;
int pinNivel1 = 8;//BAJO
int pinNivel2 = 9;//MITAD
int pinNivel3 = 10;//LLENO
int estadoNivelAgua1 = 0;//BAJO
int estadoNivelAgua2 = 0;//MEDIO
int estadoNivelAgua3 = 0;//LLENO
int rojo=6;
int blanco=5;
int verde=7;
void setup()
{
sensors.begin();
pinMode(rele,OUTPUT);
// pinMode(pinNivel1, INPUT);
// pinMode(pinNivel2, INPUT);
// pinMode(pinNivel3, INPUT);
pinMode(rojo,OUTPUT);
pinMode(blanco,OUTPUT);
pinMode(verde,OUTPUT);
digitalWrite(rele,HIGH);
lcd.init(); // initialize the lcd
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(7,1);
lcd.print("Vaporex");
delay(2500);
lcd.setCursor(7,1);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Data adquisition");
float sensorValue = (analogRead(A3)*7.0/1023.0)-offset;
lcd.setCursor(0,1);
lcd.print("Pressure: ");
lcd.setCursor(0,2);
lcd.print("Temperature: ");
lcd.setCursor(13,1);
lcd.print(sensorValue);
sensors.requestTemperatures();
lcd.setCursor(13,2);
lcd.print(sensors.getTempCByIndex(0));
delay(2500);
lcd.clear();
lcd.setCursor(7,1);
lcd.print("System");
lcd.setCursor(7,2);
lcd.print("Ready");
delay(2500);
mySerial.begin(9600);
}
void loop()
{
float sensorValue = (analogRead(A3)*7.0/1023.0)-offset;
sensors.requestTemperatures();
float temp=sensors.getTempCByIndex(0);
estadoNivelAgua1 = digitalRead(pinNivel1);
estadoNivelAgua2 = digitalRead(pinNivel2);
estadoNivelAgua3 = digitalRead(pinNivel3);
if (estadoNivelAgua1 == HIGH && estadoNivelAgua2 == HIGH && estadoNivelAgua3 == HIGH) {
mySerial.println("Full level");
digitalWrite(rojo,LOW);
digitalWrite(blanco,LOW);
digitalWrite(verde,HIGH);
}
if (estadoNivelAgua1 == LOW && estadoNivelAgua2 == HIGH && estadoNivelAgua3 == HIGH) {
mySerial.println("Medium level");
digitalWrite(rojo,LOW);
digitalWrite(blanco,HIGH);
digitalWrite(verde,LOW);
}
if (estadoNivelAgua1 == LOW && estadoNivelAgua2 == LOW && estadoNivelAgua3 == HIGH ) {
mySerial.println("low water level");
digitalWrite(rojo,HIGH);
digitalWrite(blanco,LOW);
digitalWrite(verde,LOW);
}
if(estadoNivelAgua1 == LOW && estadoNivelAgua2 == LOW && estadoNivelAgua3 == LOW){
mySerial.println("Tank empty.");
digitalWrite(rojo,HIGH);
digitalWrite(blanco,LOW);
digitalWrite(verde,LOW);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Pressure: ");
lcd.setCursor(0,1);
lcd.print("Temperature: ");
lcd.setCursor(10,0);
lcd.print(" ");
lcd.setCursor(10,0);
lcd.print(sensorValue);
lcd.setCursor(17,0);
lcd.print("BAR");
lcd.setCursor(13,1);
lcd.print(temp);
lcd.setCursor(18,1);
lcd.print("C");
mySerial.println(sensorValue);
if(temp<22.0 && sensorValue<1.0){
lcd.setCursor(0,2);
lcd.print("LOW TTEMPERATURE");
lcd.setCursor(0,3);
lcd.print("JUST IRONING");
digitalWrite(rojo,HIGH);
digitalWrite(blanco,LOW);
digitalWrite(verde,LOW);
digitalWrite(rele,LOW);
}
if(temp>22.0 && temp<89.0 && sensorValue<3.0){
digitalWrite(rele,LOW);
digitalWrite(blanco,HIGH);
digitalWrite(rojo,LOW);
digitalWrite(verde,LOW);
lcd.setCursor(0,2);
lcd.print("WARM");
lcd.setCursor(0,3);
lcd.print("WAIT");
}
if(temp>90.0 && sensorValue<3.0){
digitalWrite(rele,LOW);
digitalWrite(verde,HIGH);
digitalWrite(blanco,LOW);
digitalWrite(rojo,LOW);
lcd.setCursor(0,2);
lcd.print("TEMPERATURE OK");
lcd.setCursor(0,3);
lcd.print("STEAM READY");
}
if(temp>95.0 || sensorValue>=3.0){
digitalWrite(rele,HIGH);
digitalWrite(rojo,LOW);
digitalWrite(blanco,LOW);
digitalWrite(verde,HIGH);
}
if(temp>100.0 || sensorValue>=3.0 || estadoNivelAgua1 == LOW && estadoNivelAgua2 == LOW && estadoNivelAgua3 == LOW || estadoNivelAgua1 == LOW && estadoNivelAgua2 == HIGH && estadoNivelAgua3 == HIGH){
digitalWrite(rele,HIGH);
digitalWrite(rojo,HIGH);
digitalWrite(blanco,LOW);
digitalWrite(verde,LOW);
lcd.setCursor(0,2);
lcd.print("WARNING");
lcd.setCursor(0,3);
lcd.print("WAIT");
}
delay(500);
}
......@@ -169,9 +169,9 @@ Serial.println("Debes llenar el deposito.");
delay(tiempoEspera); //Espera el tiempo indicado
}</code></pre>
</p>
Return to<a href="finalproject.html"> final project</a><br>
<h2>Download</h2>
<br><h2>Download</h2>
<p>
You can download this files Here: <br>
3D design<br>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment