Hardware components | ||||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
Software apps and online services | ||||||
| ||||||
| ||||||
| ||||||
| ||||||
Hand tools and fabrication machines | ||||||
|
Why this?
Read moreDue to the Sun temperature now-a-days, the farm lands and trees are damaging for not getting water on time. Every farmer needs to check all the conditions at farm. So why can't we solve this problem using our Bolt IoT?
SID = 'You can find SID 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 accout API key'
DEVICE_ID = 'This is the ID of your Bolt device'
final_project.py
PythonThis code is used to checking the temperature of the farm,controlling the motor and sending an alert messages
import conf
from boltiot import Sms,Bolt
import json,time
#this value is your wish based on your plant/farm
treshold_value=25
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)
try:
sensor_value=int(data['value']))
sensor_value=(sensor_value*100)/1024
print("Sensor value is: "+str(sensor_value))
if sensor_value>treshold_value:
response=sms.send_sms("The current temperature is: "+str(sensor_value)+"Switching on the water pump to supply water to our farm")
print("Switching on the motor")
mybolt.digitalWrite('1','HIGH')
print("Motor on succesfully")
time.sleep(30)
print("Switching off the motor")
mybolt.digitalWrite('1','LOW')
print("Motor off successfully")
except Exception as e:
print("An error occured")
print(e)
time.sleep(100)
Comments