Trash Talker Using Bolt IoT

Trash Talker Using Bolt IoT © GPL3+

The trashcan in our office isn't smart. No smarter than a 1 year old baby which can shout and cry to make its needs heard anyway.

  • 46 respects

Components and supplies

Apps and online services

About this project

DeBae, our friendly office superhero, usually takes care of the trash at Bolt IoT. It's his responsibility to throw out the trash into the local cans for garbage collection once our main bin fills up. Except... he usually doesn't check our trash can often enough.

What he does check quite often is his Whatsapp, Facebook timeline and SMS's.

Hence we, the developers at Bolt IoT, decided to come up with the Trash Talker system. It's essentially a setup which uses the popular Ultrasonic Sensor (HC-SR04), the Bolt Wi-Fi module, and an Arduino Uno to measure how much of the trash can has filled up. Once above a threshold, it sends an SMS to DeBae to check the trashcan and hence help save the olfactory systems of the entire company.

Hardware Setup

The HC-SR04 Ultrasonic Sensor is at the center of the Trash Talker. You can check out how it works with the Arduino in this nicely explained blog post by Dejan Nedelkovski. The Fritzing breadboard diagram is as follows:

Software Setup

Usually, interfacing the Ultrasonic sensor is kind of non-trivial, in that one needs to use it in the manner of the functioning as explained in the blog by Dejan linked in above. However, Erick Simoes' Ultrasonic library (available from the Arduino Library Manager) greatly simplifies things by abstracting away the core implementation.

Check it out on GitHub to see the basic Hardware connections as well as an explanation of the basic structure and usage of the library.

The Arduino Code linked in below measures the distance using the Ultrasonic sensor and thereafter sends it to the Bolt Wi-Fi module over serial communication.

A Python Script (running on a server or your PC, for instance) queries the Bolt Cloud for this distance value using the Bolt Python Library, which in turn is based on the Bolt open APIs for Serial Read.

The Python script then checks if the distance is less than a preset threshold (basically if the last banana peel is too high in the trash pile). In case the bin is full, an SMS alert is sent out using the Twillio SMS service.

That's it! Have a go at this project and in case you like our friendly little Trash Talker, check us out on Indiegogo, back us, and spread the word! We have exclusive discounts for developers and the first batch of Bolts ships out in February 2018.


Trash Check DistanceArduino
Modified Ultrasonic Simple example from ErickSimoes/Ultrasonic library to send data from sensor over serial to Bolt.
 * 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() {

void loop() {

Trash AlertPython
This is the Python script you run on your PC to check the distance against a threshold and send SMS alerts.
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

API_KEY = "your Bolt Cloud api key"
DEVICE_ID  = "your device id"

# Credentials required to send SMS
SID = 'your twilio sid'
AUTH_TOKEN = 'your twilio auth token'
FROM_NUMBER = 'This is the no. generated by Twilio. You can find this on your Twilio Dashboard'
TO_NUMBER = 'This is your number. Make sure you are adding country code in the beginning'

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()
    print "Garbage level is", garbage_value
    if int(garbage_value) < garbage_full_limit:
        response = sms.send_sms('Hello DeBae, I am full- Trash Talker')


Trash Talker Breadboard Circuit
The circuit for the Trash Talker system
Ultrasonic bb hk93qicxyw


Similar projects you might like

Anomaly Detection & Temperature Monitoring Using Bolt IoT

Project tutorial by ashish anand

  • 24 respects

Controlling LED Brightness Using Bolt and Arduino

Project tutorial by Devashish Gupta

  • 22 respects

Water Level Alerting System

Project tutorial by Pranav Kundaikar and Vinayak Shantaram Joshi

  • 20 respects

Intrusion Alert System using Arduino and Bolt IoT

Project tutorial by Rohit Kumar

  • 20 respects

IoT Blink - Getting started with IoT

Project showcase by AppShed Support

  • 1 comment
  • 26 respects
Add projectSign up / Login