Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
VAMSHHI
Published © Apache-2.0

Automatic smart gardening and monitoring system

Monitor the water content of the plants and giving water to the plants by setting a threshold value using soil moisture sensor and alerts.

IntermediateProtip15 hours1,292
Automatic smart gardening and monitoring system

Things used in this project

Story

Read more

Schematics

Soil moisture monitoring

Code

Soil moisture monitoring

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

minimum_limit = 921
maximum_limit = 1024  


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 sensor_value > maximum_limit or sensor_value < minimum_limit:
            response = mybolt.digitalWrite('0', HIGH)
            print("Making request to Twilio to send a SMS")
            response = sms.send_sms("The Current temperature sensor value is " +str(sensor_value))
            response = sms.send_sms("MOTOR turned on")
            print("Response received from Twilio is: " + str(response))
            print("Status of SMS at Twilio is :" + str(response.status))
        else:
            response = mybolt.digitalWrite('0', 'LOW')
            print("Making request to Twilio to send a SMS")
            response = sms.send_sms("The Current temperature sensor value is " +str(sensor_value))
            response = sms.send_sms("MOTOR is in off condition")
            print("Response received from Twilio is: " + str(response))
            print("Status of SMS at Twilio is :" + str(response.status))

    except Exception as e: 
        print ("Error occured: Below are the details")
        print (e)
    time.sleep(10

Credits

VAMSHHI
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.