VARSHATH GUPTA S
Published © GPL3+

Agricultural Water Management

The moisture content of land is measured and it delivers to owner. Based on the message he can irrigate the land

BeginnerFull instructions provided2 hours614
Agricultural Water Management

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Soil Moisture and Soil Humidity Sensor
×1
Jumper wires (generic)
Jumper wires (generic)
×5

Software apps and online services

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

Story

Read more

Schematics

circuit diagram

Code

Moist_sms.py

Python
import config    #this file contains the SSID API Key and Bolt device ID
import json,time   
from boltiot import Sms,Bolt     #used to call methods to sen SMS and use Bolt WiFi Module

     

mybolt = Bolt(config.API_KEY, config.DEVICE_ID)        #To configure the Bolt WiFi Module
sms = Sms(config.SSID, config.AUTH_TOKEN, config.TO_NUMBER, config.FROM_NUMBER)       #To configure the Twilio SMS Service

while True:
    response = mybolt.analogRead('A0')     #Read the values
    data = json.loads(response)     #store the response given recieved in JSON format
    if data['success'] != 1:            # To detect if the value recieved contains keyword success and corresponding value should be 1 denoting STATUS OK
        print("There was an error and error is " + data['value'] )
        time.sleep(10)
        continue

    print ("This is the value "+data['value'])  #To print the Analog Value received form the Bolt WiFi Module

    try:
        moist=(int(data['value'])/1024)*100   #To convert the vales in Percentage
	moist = 100 - moist     #To find the moisture content left in soil out of total 100%
        print ("The Moisture content is ",moist," % mg/L")
    except e:
        print("There was an error while parsing the response: ",e)
        continue
    try:     #To find the moisture content of the land
        if moist < 30:
            print ("The Moisture level is  highly decreased.  SMS is sent.")
            response = sms.send_sms("THE MOISTURE CONTENT  IN LAND IS LESS THAN 30%, SO PLEASE START MOTOR TO IRRIGATE LAND.THE LAND HIGHLY DRY")
            print("This is the response ")
        elif moist < 30 and moist < 50:
            print ("The Moisture level is decreased.  SMS is sent.")
            response = sms.send_sms("THE MOISTURE CONTENT  IN LAND IS LESS THAN 50%, SO PLEASE START MOTOR TO IRRIGATE LAND.")
            print("This is the response ")
        elif moist < 50 and moist < 70:
            print ("The Moisture level moderate.  SMS is sent.")
            response = sms.send_sms("THE MOISTURE CONTENT  IN LAND IS MODERATE, SO AFTER  SOME TIME YOU START MOTOR TO IRRIGATE LAND.")
            print("This is the response ")
        else:
            print("The Moisture level is highly. SMS is sent")
            response = sms.send_sms("DON'T IRRIGATE THE LAND AS IT'S MOISTURE CONTENT IS HIGH")
            print("This is the response")     
    except Exception as e:
        print ("Error occred : Below are details",e)
    time.sleep(10)

config

Python
SSID = 'xxxxxx'
AUTH_TOKEN = 'xxxxxx'
FROM_NUMBER = '+xxxxx'
TO_NUMBER = '+91xxxx'
API_KEY = 'xxxxxxx'
DEVICE_ID = 'xxxxxx'
FRAME_SIZE = 10
MUL_FACTOR = 3

Credits

VARSHATH GUPTA S

VARSHATH GUPTA S

1 project • 1 follower
A budding electronics engineer who has interested in IoT, Deep Learning, Image Processing, Data Analytics.

Comments