I’m using the module esp8266-12 Nodemcu , but I’m with the following problems:
Do not get caught the LED signal even in virtual mode , I’m using the MQ -2 and verify the presence of gas when the LED status changes from green to red . This change 'm unable to view the blynk and not put the buzzer to alarm .
I will use module Fire detection to get the information ?
The module esp8266 nodemcu is disconnecting all the time, even though event of change or not.
How to resolve these situations?
Does anyone have any example to mq -2 , leds, fire detection and LM35 ?
It’s not enough details. What’s your code? set up? Did you manage to run your project without Blynk?
Also there are similar threads on the forum already.
I’m out of the code in hand, when you get home to send you look .
Was using the Arduino and without weriless communication was worked, after entering the blibliotecas the blynk and made changes only visualize the gas data, yet the connection is unstable .
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
int pinSensor = A0; //Pino Sensor_MQ-2
int Rele = D9; //Pino Relé
int buzzer = 15; //Pino Buzzer
int var = 0;
int Gas = 30; //Variável para selecionar a quantidade de Gás/Fumaça detectada
int valor = 0;
int LedR = 13;
int LedG = 12;
int pinoLm = D1; //Pino do LM35 analogico
int valorLido =0;
float temperatura =0;
char auth[] = "dd644b54ef174afebd9474091e24de48";
void setup()
{
Serial.begin(115200); //Inicia porta Serial em 9600 baud
Blynk.begin(auth, "P@$$0$", "71915321347182286112FelixAnalice");
pinMode(Rele, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(LedR, OUTPUT);
pinMode(LedG, OUTPUT);
pinMode(pinoLm,INPUT);
//Serial.println("TCC Félix Passos");
}
void loop()
{
valorLido = digitalRead(pinoLm); //Faz a leitura da entrada do LM35
temperatura = (valorLido * 0.00488); // Faz o calculo da leitura
temperatura = temperatura * 100;
Serial.print("Temperatura atual:");
Serial.println(temperatura);
Blynk.virtualWrite (1,temperatura);
valor = analogRead(pinSensor); //Faz a leitura da entrada do sensor
// valor = digitalRead(pinSensor);
valor = map(valor, 0, 1023, 0, 100); //Faz a conversão da variável para porcentagem
Serial.println(valor); //Escreve o valor na porta Serial do sensor Gás
Blynk.virtualWrite (2,valor);
if (valor>=Gas){ //Condição, se valor continuar maior que ValDesarm faça:
Blynk.tweet("Vazamento de Gás!!!");
digitalWrite(Rele, HIGH); //Liga relé para "sprinkler"
Blynk.virtualWrite (3,Rele);
digitalWrite(LedG,LOW);
Blynk.virtualWrite (4,LedG);
digitalWrite(LedR,HIGH);
Blynk.virtualWrite(5,LedR);
// Serial.println("Alarme disparado!!!"); //Apresenta mensagem na porta serial
tone(buzzer,1500,3000);
Blynk.virtualWrite(9,buzzer);
delay(1000); //Tempo de disparo do alarme
digitalWrite(buzzer, LOW); //Desliga o alarme
// digitalWrite(LedR,HIGH);
delay(2000); //Aguarda
Blynk.tweet("Alarme Desligado!!!");
}else
{
digitalWrite(Rele, LOW); //Caso contrário permaneça com o relé desligado
Blynk.virtualWrite (6,Rele);
digitalWrite(LedR,LOW);
Blynk.virtualWrite (7,LedG);
digitalWrite(LedG,HIGH);
Blynk.virtualWrite(8,LedR);
Blynk.run();
}
// Blynk.run();
// delay(1000);
} //Fim do loop