#EXAMEN FINAL INFORMATICA SAN JOSE DE CHIQUITOS
#RESPUESTA NRO. 3
#ALUMNO GERMAN CABRERA CESPEDES
import utime, dht
from machine import I2C, ADC, Pin
from lcd_api import LcdApi
from pico_i2c_lcd import I2cLcd
#DEFINIMOS LAS VARIABLES
dht11 = dht.DHT22(Pin(16))
motor01 = Pin(13, Pin.OUT)
motor02 = Pin(14, Pin.OUT)
motor03 = Pin(15, Pin.OUT)
vent = Pin(9, Pin.OUT)
horno = Pin(8, Pin.OUT)
#DIRECCION DEL I2C Y EL TAMAÑO DEL LCD
I2C_ADDR = 0x27
I2C_NUM_ROWS = 2
I2C_NUM_COLS = 16
#CONFIRACION DE LA RASPBERRY
i2c = I2C(0, scl = Pin(1), sda = Pin(0), freq=400000)
#CONFIGURACION DEL LCD
lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
#ESTABLECEMOS UN METODO INSTANCIADO
def lcd_str(message, col, row):
lcd.move_to(col, row)
lcd.putstr(message)
#TEMPERATURA DEL HORNO INDUSTRIAL ES DESDE 300 GRADOS HASTA LOS 3000 POR HORNO INDUSTRIAL
#EN ESTE CASO LOS EJEMPLOS SERAN DE ESTA MANERA:
#EN HUMIDITY DECLARAREMOS EL AMBIENTE DEL HORNO.
#0 = 0
#20 = 2000°
#24 = 2400°
#50 = 5000°
#51 = 5100°
#79 = 7900°
#80 = 8000° (LA CUAL EL HORNO INDUSTRIAL LLEGARA AL TOPE DE LA TEMPERATURA CONFIGURADA
#Y SI SOBRE PASA DE LA TEMPERATURA AUTOMATICAMENTE SE APAGARA Y ENCENDERAN LOS VENTILADORES INDUSTRIALES PARA SU REFRIGERACION)
while True:
dht11.measure()
t = dht11.humidity()
if (t < 10):
lcd.clear()
motor01.off()
motor02.off()
motor03.off()
vent.off()
horno.on()
lcd_str("SISTEMA" , 0, 0) # HORNOS APAGADOS STAND BY
lcd_str("APAGADO" , 0, 1)
if (t >= 10 and t < 23.9): # MODO REPOSO, PRE CALENTANDO.
lcd.clear()
motor01.on()
motor02.off()
motor03.off()
vent.off()
horno.on()
lcd_str("MOTOR HORNO 1" , 0, 0) # HORNO INDUSTRIAL MOTOR 1
lcd_str("ACTIVADO" , 0, 1)
if (t >= 24 and t < 50): #TEMPERATURA 2400° A 5000°
lcd.clear()
motor01.on()
motor02.on()
motor03.off()
vent.off()
horno.on()
lcd_str("MOTOR HORNO 2" , 0, 0)# HORNO INDUSTRIAL MOTOR 2
lcd_str("ACTIVADO" , 0, 1)
if (t >= 51 and t < 79): # HORNO INDUSTRIAL MOTOR 1 Y 2 ENCENDIDOS PRECALENTANDO A TEMPERATURA 5100° A 7900°
lcd.clear()
motor01.on()
motor02.on()
motor03.on()
vent.off()
horno.on()
lcd_str("PELIGRO !!" , 0, 0) # HORNO INDUSTRIAL SOBRECALENTADO ADVERTENCIA EN DISPLAY CONTROLADOR EN CENTRAL DE MONITOREO
lcd_str("ADVERTENCIA !!" , 0, 1)
if (t >= 80): #A TEMPERATURA 8000° AUTOMATICAMENTE SE APAGARAN LOS HORNOS INDUSTRIALES Y ENCENDERAN LAS VENTILADORAS INDUSTRIALES
lcd.clear()
motor01.off()
motor02.off()
motor03.off()
vent.on()
horno.off()
lcd_str("HORNOS APAGADOS" , 0, 0) #HORNOS APAGADOS
lcd_str("VENTILADOR ON" , 0, 1)
print("T=", t) # FUNCIONAMIENTO DE LAS VENTILADORAS INDUSTRIALES.
utime.sleep(2) # Espera 2 segundos antes de leer nuevamente