Utkarsh tiwari
Published © GPL3+

Weather Alert using Blot IOT

Its simple weather alert system and can serve different purposes. This project is made using bolt wifi module and python coding

IntermediateFull instructions provided1 hour76
Weather Alert using Blot IOT

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Buzzer
Buzzer
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
SMS Messaging API
Twilio SMS Messaging API
OpenWeatherMap

Story

Read more

Schematics

Circuit Digram

Code

main.py

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

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

my_api="https://api.openweathermap.org/data/2.5/weather?lat=12.901074&lon=77.723770&appid=9deb1f4d5a90ffa8c3e35fedc41f4c6e"

api_link= requests.get(my_api)
api_data= api_link.json()
#print(api_data)

status=api_data['weather'][0]['main']
temp=int(((api_data['main']['temp'])-273))
description=api_data['weather'][0]['description']
wind_speed=api_data['wind']['speed']

while True:

 try:
  if status == 'Rain' or status == 'Drizzle' or status == 'Thunderstorm':
   mybolt.digitalWrite('4','HIGH')
   print("\nIts Raining , get you cloths from the root ")
   print("\nWeather out is "+description)
   print("\nTemperature is: "+str(temp)+" Celcious")
   print("\nWind speed is "+str(wind__speed))
   response1=sms.send_sms("Alert get your cloths ")
   print("\nStatus of SMS: "+str(response1.status))
   print("------------------------------------------")

  elif status == 'Clouds' or status == 'Clear':
   mybolt.digitalWrite('3','HIGH')
   print("\nYout can Dry your cloths outside")
   print("\nWeather outside is: "+description)
   print("\nTemperature is: "+str(temp)+" celcious")
   print("\nWind speed is "+str(wind_speed))
   response1=sms.send_sms("Its Dry outside ")
   print("\nStatus of SMS: "+str(response1.status))
   print("------------------------------------------")

 except Execption as e:
      print(e)
 time.sleep(10)
 mybolt.digitalWrite('4','LOW')
 mybolt.digitalWrite('3','LOW')
 time.sleep(10)

conf.py

Python
SSID = "Write your twillio SSID here" #generated when you have created your twillio account

AUTH_TOKEN = "write your twillio auth_token here"#you can access it from your twillio account dashboard

FROM_NUMBER = "This is the number generated by twillio"
TO_NUMBER = "This is your personal mobile number"#must add +91 in the beginning 

BOLT_API = "This your bolt api key"
DEVICE_ID = "This your bolt device id like BOLTXXXXXXXX"

Credits

Utkarsh tiwari
1 project • 0 followers

Comments