Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Max LeeAnip Shah
Published

Next-Gen Remote Monitoring with Node MCU Technology

created a cost-effective Remote Monitoring System using NodeMCU, Blynk API, and Arduino code, resulting in a 30% reduction in downtime

AdvancedFull instructions provided2 days194
Next-Gen Remote Monitoring with Node MCU Technology

Things used in this project

Story

Read more

Schematics

RMS

This is the schematic of the RMS

Code

Remote Monitoring System Using Node MCU

Arduino
This code contains all the library and functions used for the project
#include <WiFi.h>
#include <WiFiClient.h>
#define BLYNK_TEMPLATE_ID "TMPL3HcM9-Wa"
#define BLYNK_DEVICE_NAME "----------------"
#define BLYNK_AUTH_TOKEN "-----------------"
#include <BlynkSimpleEsp32.h>


#define  trig  5
#define  echo  18

#define MQ3 34 
#define BLUE 2 

long duration;
int distance;
int per;


char auth[] = "58qpgrH1IC4nbu794mqmRZYkWMhMG0sT";
char ssid[] = "max";  
char pass[] = "bishal12"; 

BlynkTimer timer;


int sensorValue = 0;
boolean state = false;
int temp=25;
int pres=1016;

void setup()
{
  // Debug console
  pinMode(trig, OUTPUT); 
  pinMode(echo, INPUT);   
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);

 timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run();
  timer.run();
}
void sendSensor()
{
  digitalWrite(trig, LOW);   
  delayMicroseconds(2);       
  digitalWrite(trig, HIGH); 
  delayMicroseconds(10);      
  digitalWrite(trig, LOW);   
  duration = pulseIn(echo, HIGH);   
  distance = duration * 0.034 / 2;  
  per=(100*distance/400);

  Serial.print("Distance = ");        
  Serial.println(distance);

  if(distance <= 5)
  {
    Blynk.tweet("My Arduino project is tweeting using @blynk_app and its awesome!\n #arduino #IoT #blynk");
    Blynk.notify("Post has been twitted");
  }
  Blynk.virtualWrite(V0, per);  //Pause for 3 seconds and start measuring distance again
  sensorValue = analogRead(MQ3); 
  Blynk.virtualWrite(V1, sensorValue); 

  Serial.println(sensorValue); 
  
  Blynk.virtualWrite(V2, pres);
  Blynk.virtualWrite(V3, temp);

  if (sensorValue > 500) 
  {
    Blynk.notify("Gas Detected!");
    digitalWrite(BLUE, HIGH);
  }

  else
  {
    digitalWrite(BLUE, LOW); 
  }
}

Credits

Max Lee
1 project • 0 followers
Contact
Anip Shah
9 projects • 4 followers
Tech enthusiast and programmer who also happens to be a Biomedical Engineer.
Contact
Thanks to Anip Shah.

Comments

Please log in or sign up to comment.