srivijaykalki
Published

Water Tank Reminder

It notifies you when your water tank reached minimum emptiness level. i. e water tank is full.

IntermediateProtip1 hour627
Water Tank Reminder

Things used in this project

Story

Read more

Schematics

Water Tank Reminder

Code

Code for Arduino

Arduino
#include <Ultrasonic.h>
Ultrasonic ultrasonic(12,13);//(Trigger_Pin,Echo_Pin)
void setup() {
   Serial.begin(9600);
    }

void loop() {
  Serial.println(ultrasonic.distanceRead());
  delay(3000)
}

code for ubuntu

Python
from boltiot import Bolt, Sms #Import Sms and Bolt class from boltiot library
import json, time

garbage_full_limit = 5 # the distance between device and  garbage in dustbin in cm

SID = 'AC5ec0b10430013ce93421850c67e8f62b' 
AUTH_TOKEN = '1f89f6ec4ecdea016b22d0a9e87c96a6' 
FROM_NUMBER = '+15129007565'
TO_NUMBER = '+918639273073'
API_KEY = '8a474bfc-2bd0-4463-a78e-19ebb94e21a9'
DEVICE_ID = 'BOLT13624844'


# Credentials required to send SMS


mybolt = Bolt(API_KEY, DEVICE_ID) #Create object to fetch data
sms = Sms(SID, AUTH_TOKEN, TO_NUMBER, FROM_NUMBER) #Create object to send SMS
response = mybolt.serialRead('10')
print (response)

while True:
    response = mybolt.serialRead('10')  #Fetching the value from Arduino
    data = json.loads(response)
    garbage_value = data['value'].rstrip()
    #waterlevel=garbage_value
    print("water level is",garbage_value )
    if int( garbage_value )< garbage_full_limit:
        response = sms.send_sms('Hello vijay!!! water level is full Water level is almost full')
    time.sleep(2)

code for configuration

Python
SID = 'AC5ec0b10430013ce93421850c67e8f62b' 
AUTH_TOKEN = '1f89f6ec4ecdea016b22d0a9e87c96a6' 
FROM_NUMBER = '+15129007565'
TO_NUMBER = '+9181919794555'
API_KEY = '8a474bfc-2bd0-4463-a78e-19ebb94e21a9'
DEVICE_ID = 'BOLT13624844'

Credits

srivijaykalki
1 project • 0 followers

Comments