Introduction: IDC2018 IOT Smart Trash Bin

Good waste management has become an essential issue for our planet. In public and natural spaces, many do not pay attention to the waste they leave behind. When there is no garbage collector available, it is easier to leave waste on site than bring them back. Even the so-called preserved spaces are polluted by waste.

Why we need a smart waste bin? (Solution)

To preserve natural areas, it is important to provide well-managed waste collection points: To prevent them from overflowing, the bins must be raised regularly. It is hard to get through the right time: too soon, and the trash can be empty, too late and the trash can overflow. This problem is all the more critical when the bin is difficult to access (such as on hiking trails in the mountains).In this rational waste management, sorting can be a major challenge. Organics waste can be directly processed by nature, in composting.

Purpose of the Project

The purpose of our project is to provide a supervision device for an intelligent waste bin. This device integrates several sensors to supervise the state of the trash.

  • Capacity sensor: based on the ultrasonic system, used to prevent overflows by alerting the garbage collection team.
  • Temperature and humidity sensor: used to monitor the trash environment. This can be useful to manage the condition of organic compost and to prevent contamination in some specific case (very wet or hot conditions, the risk of fire in very dry conditions). A garbage fire can have dramatic effects on the environment (for example it can cause a forest fire). The combination of the temperature and humidity values can alert supervision team about the problem.
  • PIR Motion sensor: an opening detector will be installed on the trash lid to get statistics on garbage use and detect bad closure.

Step 1: Hardware Components Required

In this section, we will describe the hardware and electronics used to create this device.

First, we need a simple trash bin with a lid. Next: NodeMCU board with a built-in ESP8266 Wifi module that will help us create connectivity with cloud services, and a set of sensors to supervise the state of the trash:


  • DHT11 - Temperature and Humidity analog sensor
  • Sharp IR 2Y0A21 - Proximity / Distance digital sensor
  • Servo Motor
  • PIR motion sensor

Additional hardware needed:

  • Any trash bin with a lid
  • Breadboard (generic)
  • Jumper wires (a bunch of them...) Double-sided bonding tape!

We'll also need to create:

  • AdaFruit account - receive and maintain information and statistics about the bin state.
  • IFTTT account - store incoming data from Adafruit and trigger events in different edge cases.
  • Blynk account - enables using “Webhooks” applications on IFTTT.

Step 2: Program the NodeMCU ESP8266

Here is the whole code, feel free to use it :)

You can easily find the libraries we've used online (mentioned at the header).

*** Don't forget to enter your WiFi name and password at the top of the file

Step 3: Wiring

Connection to the NodeMCU ESP8266 board


  • + -> 3V3
  • - -> GND
  • OUT -> Pin A0

Sharp IR 2Y0A21:

  • Red wire -> 3V3
  • Black wire -> GND
  • Yellow wire -> Pin D3

Servo Motor:

  • Red wire -> 3V3
  • Black wire -> GND
  • White wire -> Pin D3

PIR motion sensor:

  • VCC -> 3V3
  • GND -> GND
  • OUT -> Pin D1

Step 4: System Architecture

Cloud Components in Architecture:

  • Adafruit IO MQTT: The ESP8266 is connected through WiFi to Adafruit’s cloud servers. Allows us presenting the data collected by the sensors in a remote computer and in an organized and concise dashboard, managing history etc.
  • IFTTT Services: Allows triggering actions according to sensors’ values or events. We have created IFTTT applets connecting steady data flows from Adafruit cloud and real-time emergency events directly from sensors.

Data flow scenarios in the System:

  1. Values are gathered from active sensors located on the bin: trash capacity rate, bin temperature, bin humidity, number of times the bin was opened today -> Publish data to MQTT broker -> IFTTT applet pipelines the data to a daily-report table Google Sheet.
  2. Trash Capacity is nearly full (Sharp sensor reaches a predefined capacity limit) -> Capacity entry on the daily-basis report is updated -> Waste Control Station locks the bin's lid and displays the time in which the garbage collector arrives (through Blynk cloud protocol and IFTTT applet).
  3. Irregular values on sensors are measured. For example, fire risk - high temperature & low Humidity -> Event is recorded on the Blynk cloud -> IFTTT Triggers alarm to Waste Control Station.

Step 5: Challenges & Deficiencies


The main challenge we’ve encountered during the project was to process, in a reasonable and logical way, all the data that our sensors had collected. After trying different data-flows scenarios, we achieved our final decision that makes the system more maintainable, reusable and scalable.

Current deficiencies:

  1. Relying on Blynk servers, the data is updated after a large delay from its real-time measurement.
  2. The system relies on an outer power supply (connection to a power generator or batteries), hence it is still not fully automated.
  3. In case the bin catches fire, it must be handled using outer intervention.
  4. Currently, our system supports only a single bin.

Step 6: Looking Into the Future...

Future enhancements:

  1. Solar energy charging.
  2. Self trash-compression system.
  3. Cameras monitoring the bin, using computer-vision based events (detect fire, trash overloading).
  4. Develop an autonomous car for touring between trash bins and empty them based on their capacities.

Possible Deadlines:

  • Implement a solar system and self trash-compression (about 6 months).
  • Develop image detection algorithms and Connect a cameras system, about a year.
  • Develop an algorithm to build an optimal tour for garbage collection based on data from all bins in about 3 years.

Step 7: Final Pics...

Step 8: About Us

Asaf Getz ---------------------------- Ofir Nesher ------------------------ Yonathan Ron

Hope you'll enjoy this project and greetings from Israel!