narra jeevan reddy
Published © GPL3+

Automatic tank filling at home

Have you ever went into the bathroom and turned on a tap and realized no water in your water tank? This project automates your motor.

IntermediateWork in progress6 hours5,068
Automatic tank filling at home

Things used in this project

Story

Read more

Schematics

circuit diagram

Code

python code for bolt

Python
from boltiot import Bolt, Sms #Import Sms and Bolt class from boltiot library
import json, time
import conf
tank_level_limit = 50 # slightly(5cm) less than height of tank 
tank_level = 5 # max level of water 5cm below the surface
mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID) #Create object to fetch data
sms = Sms(conf.SID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER) #Create object to send SMS
#response = mybolt.serialRead('10')
flag=0;
while True:
    response = mybolt.serialRead('10')  #Fetching the value from Arduino
    print (response)
    data = json.loads(response)
    water_level = data['value'].rstrip()
    print ("water level is", water_level)
    if int(water_level) > tank_level_limit:
        response = sms.send_sms('Hello your name, your tank is empty,switching on the motor')
        mybolt.digitalWrite(1,"HIGH")
        flag=1
    if int(water_level) < tank_level:
        if flag==1:
            response = sms.send_sms('Hello your name, your tank is full , switching off the motor')
            mybolt.digitalWrite(1,'LOW')
            flag=0

    time.sleep(10)

aurdino code

C/C++
/*
   Ultrasonic Simple
   Prints the distance read by an ultrasonic sensor in
   centimeters. They are supported to four pins ultrasound
   sensors (liek HC-SC04) and three pins (like PING)))
   and Seeed Studio sesores).

   The circuit:
 * * Module HR-SC04 (four pins) or PING))) (and other with
     three pins), attached to digital pins as follows:
   ---------------------    ---------------------
   | HC-SC04 | Arduino |    | 3 pins  | Arduino |
   ---------------------    ---------------------
   |   Vcc   |   5V    |    |   Vcc   |   5V    |
   |   Trig  |   12    | OR |   SIG   |   13    |
   |   Echo  |   13    |    |   Gnd   |   GND   |
   |   Gnd   |   GND   |    ---------------------
   ---------------------
   Note: You need not obligatorily use the pins defined above

   By default, the distance returned by the distanceRead()
   method is in centimeters, to get the distance in inches,
   pass INC as a parameter.
   Example: ultrasonic.distanceRead(INC)

   created 3 Apr 2014
   by Erick Simões (github: @ErickSimoes | twitter: @AloErickSimoes)
   modified 23 Jan 2017
   by Erick Simões (github: @ErickSimoes | twitter: @AloErickSimoes)
   modified 03 Mar 2017
   by Erick Simões (github: @ErickSimoes | twitter: @AloErickSimoes)

   This example code is released into the MIT License.
*/

#include <Ultrasonic.h>

/*
   Pass as a parameter the trigger and echo pin, respectively,
   or only the signal pin (for sensors 3 pins), like:
   Ultrasonic ultrasonic(13);
*/
Ultrasonic ultrasonic(12, 13);

void setup() {
  Serial.begin(9600);

}

void loop() {

  Serial.println(ultrasonic.read());
  delay(10000);
}

Credits

narra jeevan reddy
1 project • 0 followers

Comments