Shubham Kumar Jain
Published

Accident Alert System Using Bolt WiFi Module

This device will send SMS and Email to the driver's relatives when accident takes place.

IntermediateFull instructions provided5 hours1,326
Accident Alert System Using Bolt WiFi Module

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Jumper wires (generic)
Jumper wires (generic)
×5
SparkFun Audio-Sound Breakout - WTV020SD
SparkFun Audio-Sound Breakout - WTV020SD
×1
LED (generic)
LED (generic)
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Bolt IoT iOS App
Bolt IoT iOS App
SMS Messaging API
Twilio SMS Messaging API
Mail Gun
repl.it

Hand tools and fabrication machines

Breadboard, 170 Pin
Breadboard, 170 Pin

Story

Read more

Custom parts and enclosures

Proof

Proof of SMS

proof 2

Proof of Email

Schematics

Accident Alert System

This is schematic diagram to understand circuitry.

Diagram real One

Real photo of project

Code

Main Code

Python
This is main code of the project.
import conf
from boltiot import Email, Sms, Bolt
import json, time
 

mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)
mailer = Email(conf.MAILGUN_API_KEY, conf.SANDBOX_URL, conf.SENDER_EMAIL, conf.RECIPIENT_EMAIL)

while True: 
    print ("Reading sensor value")
    response = mybolt.digitalRead('0') 
    data = json.loads(response) 
    print("Sensor value is: " + str(data['value']))
    try: 
        sensor_value = int(data['value']) 
        if sensor_value == 0:
            print("Making request to Twilio to send a SMS")
            print("Making request to Mailgun to send an email")
            response = mailer.send_email("Alert", "Fatal Accident")
            response_text = json.loads(response.text)
            print("Response received from Mailgun is: " + str(response_text['message']))
            response = sms.send_sms("Fatal Accident takes place")
            print("Response received from Twilio is: " + str(response))
            print("Status of SMS at Twilio is :" + str(response.status))
            while True:
              mybolt.digitalWrite(1, 'HIGH')
              time.sleep(1)
              mybolt.digitalWrite(1, 'LOW')
    except Exception as e: 
        print ("Error occured: Below are the details")
        print (e)
        mybolt.digitalWrite(1, 'LOW')

   


            
            
            

configuration

Python
this is configuration code file
SID = "AC8714cd1bacdf538ae2985c8124535d74"
AUTH_TOKEN = "0a0940583aad505a10cdb94be7afb274" 
FROM_NUMBER = "+12512990186"
TO_NUMBER = "+919529733521"
MAILGUN_API_KEY = 'c6a9298d38a3808614c2da95056b936a-816b23ef-1074399e' 
SANDBOX_URL= 'sandbox92c8ba8b1bd54b4a938f6e44f1ea96de.mailgun.org' 
SENDER_EMAIL = 'test@sandbox92c8ba8b1bd54b4a938f6e44f1ea96de.mailgun.org'
RECIPIENT_EMAIL = 'skjshubhamkumarjain@gmail.com'
API_KEY = "74c70f0d-0cb6-4b9c-9844-318b3556eedd"
DEVICE_ID = "BOLT7420873"

Credits

Shubham Kumar Jain

Shubham Kumar Jain

1 project • 4 followers
I am student of B.Tech (ECE) from Amity University Rajasthan. I have been developing for years. I started as an Embedded system and robotics

Comments