Project tutorial
Smart Plant Monitoring with SMS Alert: Keep Plants Hydrated!

Smart Plant Monitoring with SMS Alert: Keep Plants Hydrated! © GPL3+

Have a busy schedule? Worried if they wither? Then this project is just for you. Now you can keep your plants hydrated!

  • 1,265 views
  • 2 comments
  • 4 respects

Components and supplies

Apps and online services

About this project

SMART AND HEALTHY PLANT MONITORING WITH SMS ALERT!
NOWKEEP YOUR PLANTS HYDRATED!
SMART AND HEALTHY PLANT MONITORING WITH SMS ALERT! Keep your Plants Hydrated!

https://youtu.be/cMe4cYgkYto
This is an interesting story!

My mom gave me a duty to look after the plants, water them regularly, see that they get the proper sunlight and they never dry up. She even strictly said to never water the plants at night.

But due to my busy schedule I often tend to forget to water my plants and can't keep an eye on its growth.

Due to the advancement of IoT, I was able to build this device which constantly monitors my plants and also alerts me.

This device with the help of Ultrasonic sensor checks the water level in the pot and the LDR sensor checks if it day or night.

So if the water level in the pot is below the threshold, the device with the help of LDR checks if it is day. And if it is day time then an LED glows & simultaneously it sends me an alert SMS to my mobile phone saying "Water your Plants or else they will wither."

LDR also helped me to not send an SMS at night since my mom said not to water the plants at night.

This device really made my life easy and now my Plants can stay healthy.

------Steps to make the device------

(Refer to the image below for better understanding)

1) Connect the trig pin of Ultrasonic sensor to pin no. 11 and echo pin to pin no. 12 of arduino Uno R3.

2)Connect the gnd pin of Ultrasonic sensor to any of the Gnd pin of arduino uno R3.

3)Connect the 5v pin of arduino uno R3 to the breadboard.

4)Using the bread board connect a wire from the breadboard to Vcc pin of Ultrasonic sensor.

5)Take the bolt iot module and make LDR connection using 10k ohms resistor such that one pin of ldr is in A0 port and other in 3v3. The resistor one pin to the gnd and and other to the A0 port.

6)Connect an LED to the bolt module such that positive in pin no. 1 and negative in pin no. 3.

7)Connect the 5v from the bolt module to the breadboard previous series connection.

8)Connect the RX and TX ports of bolt iot module and arduino uno R3.

9) Place your device as shown in the last image below such that ultrasonic sensor points downward in the pot.

10)Well done you have completed the hardware part of your device.

Use the below source files to complete the project.
Note: The python file is source file so run it on linux server such as Ubuntu Server or make use of digital Ocean.
You will also need to create an account ontwillio for sms APIs.

Code

Source.pyPython
This is main source file. Run this to get the actual output.
#Source Python File

#Importing Files
import config
from boltiot import Sms,Bolt
import json,time

#Declaring the threshold values
threshold_light=1000
theshold_dmax=12
threshold_dmin=7

mybolt=Bolt(config.DEVICE_API_KEY, config.DEVICE_ID)
sms=Sms(config.SSID, config.AUTH_TOKEN, config.TO_NUMBER, config.FROM_NUMBER)

#function for led
def led(pin,value):
 response=mybolt.digitalWrite(pin,value)

while True:
 #Input from LDR
 response=mybolt.analogRead('A0')
 data=json.loads(response)

 #Input from Ultrasonic HC-SR04 Module
 response=mybolt.serialRead('10')
 data2=json.loads(response)
 print(data['value'])
 print(data2['value'])
 try:
  light_intensity=int(data['value'])
  distance=int(data2['value'])
  print(light_intensity)

  #Checking if it's daytime or Night time
  if light_intensity > threshold_light:
   #Checking if the Plants have water or not
   if distance > threshold_dmax:
    print("Its Sunny Daylight! Flower are dry with no water!")
    print("Pour water")
    response=sms.send_sms("Flowers will wither! Water required!")
    led('1','HIGH')
    led('3','LOW')
    time.sleep(10)
    led('1','LOW')
   else :
    print(Plants dont need water!")
    led('1','LOW')
  else :
   print("Shh! Its night time! Plants are sleeping! No need of water!")
   led('1','LOW')
 except Exception as e:
  print("Error", e)
 time.sleep(10)
config.pyPython
This is the config file for your bolt iot module and twillio.
#Config File

DEVICE_API_KEY='XXXXXXXXXXXXXXXXXX'
DEVICE_ID='BOLTXXXXXXXX'

#Twilio Sms
SSID='XXXXXXXXXXXXXXXX'
AUTH_TOKEN='XXXXXXXXXXXXXXX'
FROM_NUMBER="+XXXXXXXXXXX'
TO_NUMBER="+91XXXXXXXXXX'
ArduinoProg.inoArduino
This is the arduino file to get input from the ultrasonic sensor.
#include <BoltDeviceCredentials.h>
#include <BoltIoT-Arduino-Helper.h>
#include <Ultrasonic.h>

#define ULTRASONIC_TRIG_PIN 11
#define ULTRASONIC_ECHO_PIN 12

#ifndef API_KEY
#define API_KEY   ""
#endif
#ifndef DEVICE_ID
#define DEVICE_ID ""
#endif

Ultrasonic ultrasonic(ULTRASONIC_TRIG_PIN,ULTRASONIC_ECHO_PIN);
int distance=0;

void setup() {
  // put your setup code here, to run once:
  boltiot.Begin(Serial);
  Serial.begin(9600);
  boltiot.setCommandString("GetDistance",ultrasonic.distanceRead());
}

void loop() {
  // put your main code here, to run repeatedly:
 boltiot.handleCommand();
 Serial.println(ultrasonic.distanceRead());
 delay(1000);
}

Comments

Similar projects you might like

Smart Garbage Monitoring System Using Arduino 101

Project tutorial by Technovation

  • 21,396 views
  • 7 comments
  • 32 respects

Water Plant System for Plants in Vases

Project tutorial by zioalex

  • 6,545 views
  • 4 comments
  • 12 respects

Controlling LED Brightness Using Bolt and Arduino

Project tutorial by Devashish Gupta

  • 1,766 views
  • 5 comments
  • 14 respects

Ultrasonic Security System

Project tutorial by Ivan

  • 21,271 views
  • 20 comments
  • 59 respects

Smart Plant IoT

Project tutorial by Shin Ae Hong and Peter Ma

  • 8,780 views
  • 3 comments
  • 33 respects

Smart Dustbin

Project tutorial by msr048

  • 7,705 views
  • 10 comments
  • 33 respects
Add projectSign up / Login