VISHAL SIVARAMAN
Published © GPL3+

Trash Talker

This system monitors the garbage level and sends an sms to the user when value crosses threshold value.

BeginnerFull instructions provided4 hours3,132
Trash Talker

Things used in this project

Story

Read more

Schematics

hardware setup

Hardware setup:



Ultrasonic to arduino connections

Vcc -> 5V#SUPPLY VOLTAGE TO SENSOR

Trig -> 12

Echo -> 13

GND -> GND

Arduino to bolt wifi modiule connections

Rx -> TX#RX->RECIEVER, TX->TRANSMITTER

Tx -> RX

GND -> GND

VIN->5V #SUPPLY VOLTAGE TO BOLT



After completing the above connections just power on ur arduinoby connecting the arduino to your laptop/pc via usb cable and then u will see all the light glowing like this In the below picture

Code

SERVER CODING

Python
NOTE:

We read 13th pin rather than the 12th pin cause if we read 12th pin we get a set of present values sensed by sensor but are not compatable with int()base with 10 but if we use 13th pin we get only one value at a time .But u guys will be wondering wont there be any delay between the reading of sensor and the reading received at the bolt.actually this delay does exist so I also found the solution to it by increasing time between two consecutive readings sensed by sensor and lowered the time.sleep() of bolt. After this I noticed a drastic change between the delay it was minimised to a large extent . One more thing when any object is bought too close to the sensor it displays an error value of 357 and hence we do consider it here also if u change the ports of the sensor in your code please do change the port in the command response = mybolt.serialRead('13') ,else it will read the voltage at the unused port and that value is transmitted to the bolt rather than the distance sensed by sensor
from boltiot import Bolt, Sms #Import Sms and Bolt class  from boltiot library 

import bolt, json, time # accesing the json and time function 

 Maxlimit= 10 # the distance between device and garbage in dustbin in cm
  

mybolt = Bolt(bolt.API, bolt.ID) #Create object to fetch data 

sms = Sms(bolt.SID, bolt.AUTH, bolt.TO, bolt.FROM) #Create object to send SMS 

response = mybolt.serialRead('13')# we are now receiving the data read at the 13th pin of arduino board 

print(response) 

  

while True: 

    response = mybolt.serialRead('13')  #Fetching the value from Arduino 13th pin 

    data = json.loads(response)#storing the value received to the bolt from arduino 

    glevel = data['value'].rstrip()#storing the integer part  

    print("Garbage level is", glevel) 

     

     if (int(glevel) <= Maxlimit or int(glevel)==357): 

         response = sms.send_sms('Hello  I am full,please clean me out') #sending the sms to your mobile number 

    time.sleep(2.5)#time between two consecutive readings in seconds 

arduino IDE

C/C++
The Arduino integrateddevelopment environment (IDE) is a cross-platform application (for Windows,mac OS,Linux)that is written in the programming language Java. It is used to write and upload programs to Arduino board. It is a open source software so either visit the Arduino home page and download the software in your system else you can use the link below to guide you in setting up Arduino IDE in your system

https://www.youtube.com/watch?v=TbHsOgtCMDc
#include <Ultrasonic.h>/* library to access the function distance read*/ 

 Ultrasonic ultrasonic(12, 13);/*trig-12,echo-13*/ 

 void setup() {/* setting up the sensor to work*/ 

  Serial.begin(9600); /* initializing the frequency to run the sensor*/ 

  } 

 void loop() {/* initializing the loop*/ 

 Serial.println(ultrasonic.distanceRead());/* prints the distance measure by the sensor on the serial monitor also transmits these values to the bolt wifi module*/ 

  delay (4000) ;/* time taken between two consecutive readings*/ 

} 

bolt

Python
this is a python file which has all the credentials for bolt to access the cloud as well as access your twilio account via API
 API = "bolt cloud api" 

 ID  = "device" 

 # Credentials required to send SMS 

SID = 'your twillio account sid' 

AUTH = 'your twillio account auth token' 

FROM = 'your twillio number' 

TO =' your number to get alert sms, please dont forget to add your country  code in the beginning of your phone number '

# Save it in a separate file called as bolt.py and then we can acces this file in the main code by importing it there

Credits

VISHAL SIVARAMAN

VISHAL SIVARAMAN

3 projects • 1 follower

Comments