Buenos dias comunidad,tengo en marcha mi proyecto para un quemador de biomasa controlado con arduino. Esta pequeña maravilla (arduino) me permite gobernar mi quemador, darle una interfaz, proporcionarle seguridades por temperatura,... es sencillamente genial, estoy que lo flipo :D.
Os pongo un video del quemador
(prototipo, ahora ya lo tengo más avanzado) que espero utilizar en breve. Los elementos básicos a manejar son el ventilador, para el que preveo 2 marchas de velocidad (con la ayuda de una placa cebek para este fin), y una torba que alimentará el quemador con pellets por detrás.
El problema que tengo y para lo que pido ayuda y consejo viene en el programa de arduino. La alimentación del quemador es intermitente, y uso el comando "delay", pero he observado que durante esos delay, los pulsadores no funcionan. ¿habrá otra manera de controlar las pausas con la misma placa arduino o he de utilizar otros elementos?. Espero vuestro consejo, os dejo el programa que llevo escrito (sobre otro que encontré para usar el LCDSHIELD ). Saludos.
//Sample using LiquidCrystal library
#include <LiquidCrystal.h>
/*******************************************************
This program will test the LCD panel and the buttons
Mark Bramwell, July 2010
********************************************************/
// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// define some values used by the panel and buttons
int lcd_key = 0;
int adc_key_in = 0;
int estado = 0 ;//estado en el que se encuentra el quemador
int temperatura = 0; //variable para el control de la seguridad y gobierno de la potencia del quemador
float temp_in_celsius = 0, temp_in_kelvin=0, temp_in_fahrenheit=0;//variable para temperatura sensor 1
float temp_in_celsius2 = 0, temp_in_kelvin2=0, temp_in_fahrenheit2=0;//variable para temperatura sensor 2
#define apagado 0
#define marcha_rapida 1
#define btnDOWN 2
#define marcha_media 3
#define marcha_lenta 4
#define btnNONE 5
#define torba 21
#define ventilador1 20
#define ventilador2 19
#define ventilador3 18
// read the buttons (lectura de botones)
int read_LCD_buttons()
{
adc_key_in = analogRead(0); // read the value from the sensor (pin 0 da el valor usado para los botones)
// my buttons when read are centered at these valies: 0, 144, 329, 504, 741(valores que da pin 0 con cada boton)
// we add approx 50 to those values and check to see if we are close(le añade 50 al valor de cada boton y usa esta variable)
if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
if (adc_key_in < 50) return apagado;
if (adc_key_in < 195) return marcha_rapida;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return marcha_media;
if (adc_key_in < 790) return marcha_lenta;
return btnNONE; // when all others fail, return this...
}
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2); // comienza la libreria
lcd.setCursor(0,0);
lcd.print("VULCANITO POWER"); // que quede constancia del poder de vulcano!!!
pinMode (21, OUTPUT);
pinMode (20, OUTPUT);
pinMode (19, OUTPUT);
pinMode (18, OUTPUT);
}
void loop()
{
temp_in_kelvin = analogRead(6) * 0.004882812 * 100;//lee el valor del termostato en pin a6
temp_in_celsius = temp_in_kelvin - 2.5 - 273.15; //este sensor esta destinado a la temperatura del
temp_in_fahrenheit = ((temp_in_kelvin - 2.5) * 9 / 5) - 459.67;//agua del circuito de calefacción
//------------------------------------------------------------------------------------------------------------------//
temp_in_kelvin2 = analogRead(7) * 0.004882812 * 100;//lee el valor del termostato en pin a7
temp_in_celsius2 = temp_in_kelvin2 - 2.5 - 273.15; //este sensor esta destinado a la temperatura del
temp_in_fahrenheit2 = ((temp_in_kelvin2 - 2.5) * 9 / 5) - 459.67;//armazon del quemador, por si se prende
//el combustible, para parar todo el sistema
//-----------------------------------------------------------------------------------------------------------------//
//A continuacion van todas las medidas de seguridad por temperatura (tanto de agua del circuito como de incendio).
if (temp_in_celsius2 >= 28) {temperatura=1;}//si el termostato de seguridad lee una temperatura alta, para el sistema
//-----------------------------------------------------------------------------------------------------------------//
Serial.print("Celsius: ");
Serial.println(temp_in_celsius2);
// lcd.setCursor(0,1);
//lcd.print(temp_in_celsius);
//lcd.setCursor(9,1); // move cursor to second line "1" and 9 spaces over
//lcd.print(millis()/1000); // display seconds elapsed since power-up
lcd.setCursor(0,1); // move to the begining of the second line
lcd_key = read_LCD_buttons(); // read the buttons
switch (estado)
{
case 0:
digitalWrite(21,LOW);
digitalWrite(20,LOW);
digitalWrite(19,LOW);
digitalWrite(18,LOW);
lcd.setCursor(0,1);
lcd.print(temp_in_celsius);
delay(500);
break;
case 1:
lcd.setCursor(0,1);
lcd.print(temp_in_celsius);
digitalWrite(21,LOW);
digitalWrite(20,HIGH);//apagado
digitalWrite(19,LOW);
digitalWrite(18,LOW);
delay (5000);
digitalWrite(20,LOW);
lcd.clear ();
lcd.print ("apagado");
estado=0;
break;
case 2:
lcd.setCursor(0,1);
lcd.print(temp_in_celsius);
digitalWrite(19,LOW);
digitalWrite(18,LOW);
digitalWrite(20,HIGH);//marcha lenta
digitalWrite(21,HIGH);
delay (1000);
digitalWrite(21,LOW);
delay (1000);
break;
case 3:
lcd.setCursor(0,1);
lcd.print(temp_in_celsius);
digitalWrite(20,LOW);//marcha media
digitalWrite(19,HIGH);
digitalWrite(18,LOW);
digitalWrite(21,HIGH);
delay (500);
digitalWrite(21,LOW);
delay (500);
break;
case 4:
lcd.setCursor(0,1);
lcd.print(temp_in_celsius);
digitalWrite(20,LOW);
digitalWrite(19,LOW);
digitalWrite(18,HIGH);//marcha rapida
digitalWrite(21,HIGH);
delay (100);
digitalWrite(21,LOW);
delay (100);
break;
}
switch (temperatura)
{
case 1:
{
estado=0;
lcd.clear();
lcd.print("temperatura quemador");
lcd.setCursor (0,1);
lcd.print("critica, comprobar");
delay(5000);
break;
}
}
switch (lcd_key) // depending on which button was pushed, we perform an action
{ //La variable "estado" la dirige el boton que pulsemos
case apagado:
{
lcd.clear();
lcd.print("apagando");
estado=1;//ventilador activo durante 10 minutos y apagado
break;
}
case marcha_media:
{
lcd.clear();
lcd.print("marcha media");
estado=3;//led verde
break;
}
case marcha_rapida:
{
lcd.clear();
lcd.print("marcha rapida");
estado=4;//led rojo
break;
}
case btnDOWN:
{
lcd.print("DOWN ");
break;
}
case marcha_lenta:
{
lcd.clear();
lcd.print("marcha lenta");
estado=2; //led amarillo
break;
}
/case btnNONE:
{
lcd.print("NONE ");
break;
}/
}
}