Tarun Singh Negi
Published © GPL3+

Street Light On and Off Over Internet

When the light intensity goes down, this device sends a notification to the municipality to turn on street lights.

IntermediateFull instructions provided2 hours2,580

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
Awesome WiFI Module by BOLT IOT
×1
LED (generic)
LED (generic)
A light-emitting diode is a semiconductor light source that emits light when current flows through it
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 330 ohm
Resistor 330 ohm
×1
Light Dependent Resistor (LDR)
Light Dependent Resistors (LDR), are light sensitive devices most often used to indicate the presence or absence of light or to measure the light intensity.
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Bolt Cloud platform for connecting and managing Bolt IoT devices
Bolt IoT Android App
Bolt IoT Android App
Link your Bolt devices to your Bolt Cloud account.
SMS Messaging API
Twilio SMS Messaging API
Cloud communications platform for building SMS, Voice & Messaging applications
Oracle VM Virtual Box or Digital Ocean

Story

Read more

Schematics

Connection of LDR and LED with BOLT

Code

Webpage for ON and OFF switch

HTML
For making the Switch
<html>

    <head>
        <style>
            
            
            h1 { text-align:center;}
            .button {
  background-color: #7FFF00; 
  border: none;
  color: red;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
        
        </style>

        <title>IoT Platform</title>

        <script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>

        <script>

        setKey('{{ApiKey}}','{{Name}}');

        </script>
        <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

    </head>
    
    <body >
        <h1 style = font-family:"courier",text-align:"center"> Controlling Street  LED Over Internet </h1>

        <center>

        <button class="button" onclick="digitalWrite(0, 'HIGH');">ON</button>

        <button class="button" onclick="digitalWrite(0, 'LOW');">OFF</button>

        </center>
        <center>
            <i class="material-icons" style="font-size:60px;color:#00FFFF;">cloud</i>
        </center>
        

    </body>

</html>

sms.py

Python
For sending the Notification
import conf, json, time
from boltiot import Sms, Bolt
import json, time

minimum_limit = 80 #can be change
maximum_limit1 = 300 #can be change
maximum_limit2 = 350

mybolt = 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.analogRead('A0') 
    data = json.loads(response) 
    print("Sensor value is: " + str(data['value']))
    try: 
        sensor_value = int(data['value']) 
        if maximum_limit1 <sensor_value > maximum_limit2 :
            response = sms.send_sms("Hi there Turn OFF the Street Lights Of Kolar region Bhopal")
        elif sensor_value < minimum_limit:
            response = sms.send_sms("Hi there Turn ON the Street Lights Of Kolar region Bhopal")
    except Exception as e: 
        print ("Error occured: Below are the details")
        print (e)
    time.sleep(900) #after 15 min again read the data

conf.py

Python
For the information of Twilio and Bolt IOT device
SSID = 'You can find SSID in your Twilio Dashboard' 
AUTH_TOKEN = 'You can find  on your Twilio Dashboard' 
FROM_NUMBER = 'This is the no. generated by Twilio. You can find this on your Twilio Dashboard'
TO_NUMBER = 'This is your number. Make sure you are adding +91 in beginning'
API_KEY = 'This is your Bolt Cloud account API key'
DEVICE_ID = 'This is the ID of your Bolt device'

Credits

Tarun Singh Negi

Tarun Singh Negi

2 projects • 5 followers
a student and want to learn a lot of things

Comments