Suresh Krishna
Published © GPL3+

Streetlight Automation Using Bolt IoT

Due to delay of powering on/off lead to power consumption too high... by this model we can control lights automatically..

IntermediateFull instructions provided1 hour464
Streetlight Automation Using Bolt IoT

Things used in this project

Hardware components

LDR, 5 Mohm
LDR, 5 Mohm
×1
LED (generic)
LED (generic)
×1
Resistor 330 ohm
Resistor 330 ohm
×1
Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1

Software apps and online services

VMWare
Ubuntu Server ISO

Hand tools and fabrication machines

Breadboard, 170 Pin
Breadboard, 170 Pin

Story

Read more

Code

python code

Python
if u know how to use linux(ubuntu server) then use this code in that.
from boltiot import Bolt
import json,time
maximum_limit=350
minimum_limit=0
api_key="your bolt api key"
device_id="your bolt device id"
mybolt=Bolt(api_key,device_id)
while True:
  print("Reading the LDR value")
  responce=mybolt.analogeRead('A0')
  print(responce)
  data=json.loads(responce)
  print("sensor value is:"+str(data['value']))
  try:
    sensor_value=int(data['value'])
    if sensor_value > minimum_limit and sensor_value < maximum_limit :
      print("light is going to ON")
      responce=mybolt.analogWrite('0','100')
      print(responce)
    else:
      print("light is going to OFF")
      responce=mybolt.analogeWrite('0','0')
      print(responce)
except Exception as e:
  print("error occured:below are the details")
  print(e)
time.sleep(5)  

Credits

Suresh Krishna

Suresh Krishna

3 projects • 2 followers

Comments