Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Likhitha Maddula
Published

Garbage monitoring system using bolt and arduino

Environment is so peace we should keep our surroundings neat and clean by putting the waste in bins and save our lives from many diseases

IntermediateFull instructions provided1 hour6,175
Garbage monitoring system using bolt and arduino

Things used in this project

Story

Read more

Schematics

Hardware Setup

The HC-SR04 Ultrasonic Sensor is at the center of the Trash Talker

Hardware connections process

Hardware connections

Code

SMS ALERT FROM TWILLIO

Python
This code contains the coding for sms alert from twillio third-party website
from boltiot import Bolt, Sms #Import Sms and Bolt class from boltiot library
import json, time

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

API_KEY = "bolt cloud api"
DEVICE_ID  = "device"

# Credentials required to send SMS
SID = 'your twillio account sid'
AUTH_TOKEN = 'your twillio account auth token'
FROM_NUMBER = 'your twillio number'
TO_NUMBER = 'your number to get alert 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('13')
print(response)

while True:
    response = mybolt.serialRead('13')  #Fetching the value from Arduino
    data = json.loads(response)
    garbage_value = data['value'].rstrip()
    print("Garbage level is", garbage_value)
    
     if int(garbage_value) < garbage_full_limit:
         response = sms.send_sms('Hello DeBae, I am full- Trash Talker')
    time.sleep(200)

ultasconic

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

void loop() {

  Serial.println(ultrasonic.distanceRead());
  delay(1000);
}

Credits

Likhitha Maddula
1 project • 7 followers

Comments