wolverine viswa
Published © GPL3+

Automated-industrial monitoring system using BoltWifi module

A compact, automated IOT system that alerts users to malfunctions in industrial plants and helps prevent industrial accidents.

BeginnerFull instructions provided3 hours356
Automated-industrial monitoring system using BoltWifi module

Things used in this project

Story

Read more

Schematics

circuit diagram of this project

Code

code for ardiuno

Arduino
code used for system operation
 // include the library code:
#include<UltraDistSensor.h>
#include<LiquidCrystal.h>// initialize the library with the numbers of the interface pins
int relay_1 = 2;
int relay_2 = 3;
int button = 12;
int ult_tx =  4;
int ult_rx =  5;
int buzz   =13 ;
LiquidCrystal lcd(7, 6, 8, 9, 10, 11);
float time=0;
int distance=0,temp=0; 

void setup()

{
   Serial.begin(9600);
   lcd.begin(16, 2);
    pinMode(ult_tx,OUTPUT);
 pinMode(ult_rx,INPUT);
 pinMode(relay_1, OUTPUT);
 pinMode(relay_2, OUTPUT);
 pinMode(buzz , OUTPUT);
   lcd.setCursor(0,0);
    lcd.print("INITIALISING");
     delay(500);
      lcd.setCursor(0,1);
      lcd.print("please wait");
      delay(500);
  lcd.print(".");
  delay(500);
  lcd.print(".");  
  delay(500);
  lcd.print(".");
  delay(500);
  lcd.print(".");  
  delay(500);

  lcd.clear();
   lcd.print("PRESS START");
  


 }

void loop()

{ // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 0);


 
 
  
  int buttonState;
  buttonState = digitalRead(button);

if(buttonState == 1){
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("PUMP ENGAGED");
  lcd.setCursor(0,1);
  lcd.print("system normal");
  digitalWrite(relay_2, HIGH);
  digitalWrite(relay_1,LOW);
   digitalWrite(ult_tx,LOW);
 delayMicroseconds(2);
 digitalWrite(ult_tx,HIGH);
 delayMicroseconds(10);
 digitalWrite(ult_tx,LOW);
 delayMicroseconds(2);
 time=pulseIn(ult_rx,HIGH);
  distance = time/58.2;
 Serial.println(distance);

 if(distance<5 && distance>3)
 {
     digitalWrite(relay_2, LOW);
       digitalWrite(relay_1,LOW);
     lcd.clear();
     lcd.print("Tank Filled");
     delay(5000);
     lcd.clear();
     lcd.print("Shuting Down");
     lcd.setCursor(0,1);
     lcd.print("pump");
     delay(5000);
 }

 else if(distance<3)
 {
   digitalWrite(relay_1, HIGH);
   lcd.clear();
   lcd.print("MALFUNCTION");
   digitalWrite(buzz,HIGH);
    delay(1000);
    digitalWrite(buzz,LOW);
  lcd.clear();
  delay(500);
    lcd.print("MALFUNCTION");
    digitalWrite(buzz,HIGH);
    delay(1000);
    digitalWrite(buzz,LOW);
  lcd.clear();
  delay(500);
    lcd.print("MALFUNCTION");
    digitalWrite(buzz,HIGH);
    delay(1000);
    digitalWrite(buzz,LOW);
  lcd.clear();
  delay(500);
    lcd.print("MALFUNCTION");
    digitalWrite(buzz,HIGH);
    delay(1000);
    digitalWrite(buzz,LOW);
  lcd.clear();
  delay(500);
    lcd.print("MALFUNCTION");
    digitalWrite(buzz,HIGH);
    delay(1000);
    digitalWrite(buzz,LOW);
  lcd.clear();
  delay(500);
    lcd.print("MALFUNCTION");
    digitalWrite(buzz,HIGH);
    delay(1000);
    digitalWrite(buzz,LOW);
  lcd.clear();
  delay(500);
    lcd.print("MALFUNCTION");
    digitalWrite(buzz,HIGH);
    delay(1000);
    digitalWrite(buzz,LOW);
  lcd.clear();
  delay(500);
   delay(3000);
   lcd.clear();
   lcd.print("EMERGENCY");
   lcd.setCursor(0,1);
   lcd.print("SHUT DOWN");
   delay(5000);
   temp=0;
 }


}

}

code for bolt python software

Python
code used for sending alert messages.
import conf 
from boltiot import Sms, Bolt 
import json, time

thershold_level=5

mubolt = Bolt(conf .API_KEY, conf.DEVICE_ID) 
sms = Sms(conf.SID, conf.AUTH TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)

while True:
    print("Reading sensor value")
    response = mybolt.serialRead('5') 
    data = json. loads (response) 
    j=data['value' ].rstrip() 
    print("Sensor value is: " +j) 
    try: 
        if int(j)<= thershold_level:
            print("Making request to Twilio to send a SMS") 
            response = sms.send_sms("SYSTEM MALFUCTION: Emergency Shut Down Initiated...") 
            print("Response received from Twilio is: "#str(response ))
            print("Status of SMS at Twilio is :" + str(response.status))
    except Exception as e:
        print("Error occured: Below are the details")
        print(e) 
        time.sleep(5)

conf file for bolt iot code

Python
SID =" YOUR TWILLIO PROJECT'S SID "
AUTH_TOKEN = "YOUR TWILLIO PROJECT'S AUTH TOKEN"
FROM_NUMBER = "FROM NUMBER PROVIDED BY TWILLIO ACCOUNT"
TO_NUMBER = "YOUR PHONE NUMBER"
API_KEY = " API OF OUR BOLT DEVICE"
DEVICE_ID = "ID OF OUR BOLT DEVICE"

Credits

wolverine viswa
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.