Sibibalan
Published

Smart Water Tank

Do you forget to switch off the water pump at your home? Does the water overflow out of the tank? Well, here's a SMART WATER TANK for you!

IntermediateFull instructions provided2 hours1,428
Smart Water Tank

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Buzzer
Buzzer
×1
LED (generic)
LED (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Breadboard (generic)
Breadboard (generic)
×1

Hand tools and fabrication machines

Scissors, Free Fall
Scissors, Free Fall
Tape, Clear
Tape, Clear

Story

Read more

Schematics

Circuit Diagram

It is explained in the story

Code

Code for Smart Tank System

Python
You should have an account on Twilio for SMS services and have the boltiot library in your Linux environment. The rest of it is a simple python code
import json,time,conf  #conf contains the SID,AUTH TOKEN,FROM NUMBER,TO NUMBER, API and DEVICE ID
from boltiot import Sms,Bolt

bot = Bolt.(conf.API,conf.ID)
sms = Sms.(conf.SID,conf.TOKEN,conf.FROM,conf.TO)

print("Smart Tank System Initiated....")

while True:
  full = bot.digitalRead("1")
  over = bot.digitalRead("2")
  data = json.loads(full)
  data1 = json.loads(over)
  full_value = int(data['value'])
  over_value = int(data1['value'])
  try:
    
    if full_value == 0:  #Water level is less
        print("The Tank is not Full. You may fill more water....")
        bot.digitalWrite("3","LOW")
        bot.digitalWrite("4","LOW")
    elif full_value == 1:
      if over_value == 0:  #Reached Full Mark
        print("The Tank is Full. You may stop the Water Supply")
        bot.digitalWrite("3","HIGH")   #The LED turns ON
      elif over_value == 1: #Reached overflow mark
        bot.digitalWrite("4","HIGH") #The Buzzer turns ON
        print("The Tank is Overflowing! Switch off the Water Suplly Immediately...")
        response = sms.send_sms("The Tank is overflowing... Switch of the Water Supply Immediately")
        print("Details of the SMS:")
        print(response)
  except Exception as e:
    print("Error:")
    print(e)
  time.sleep(30)

    

Credits

Sibibalan

Sibibalan

2 projects • 0 followers

Comments