jasjeet
Published © GPL3+

Mask Alert in Pandemic

This project alerts you that you should put a mask when you go outside from home or office.

BeginnerProtip1 hour230
Mask Alert in Pandemic

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Buzzer
Buzzer
×1
Resistor 10k ohm
Resistor 10k ohm
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
Breadboard (generic)
Breadboard (generic)
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
SMS Messaging API
Twilio SMS Messaging API
VM VirtualBox

Story

Read more

Schematics

Circuit Connection

Code

Code

Python
import conf
from boltiot import Sms, Bolt
import requests
import json, time

myBolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)

def readSensor():
     print("Reading LDR sensor value")
     input = myBolt.analogRead("A0")
     data=json.loads(input)
     print("LDR sensor value is " + str(data["value"]))
     return data

def buzzeron():
     output = myBolt.digitalWrite("0", "HIGH")
     return output
def buzzeroff():
     output = myBolt.digitalWrite("0", "LOW")
     return output

data1 = readSensor()
value1 = int(data1["value"])
while True:
     data2 = readSensor()
     value2 = int(data2["value"])
     value1 = value1 + 100
     if value2<1024:
         buzzeron()
         print("Making Request to Twilio for SMS")
         response=sms.send_sms("Alert: Don't forget to wear your face mask")
         print("Response received from Twilio is:" +str(response))
         time.sleep(5)
         buzzeroff()
     value1 = value2
     time.sleep(5)

Credits

jasjeet
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.