Case Study: Dustbin IoT

Intelligent system for managing the refuse collection of a Smart City.

Course thesis

This project was conceived as a thesis for the biennial ITS course: "Superior Technician for Smart City & Clean Energy Management". It's an intelligent system for managing the refuse collection of a Smart City, a scalable web application written in Python / Django and deployed in Heroku. As database it uses Postgresql leaning on the Django ORM. And Javascript, HTML, CSS for the frontend.

Project Requirements

  • Use high resolution sensors.
  • Ensure energy consumption efficiency of embedded devices.
  • Ensure real-time communication of network nodes.
  • Web interface.
  • Ensure reliable data to optimize the fuel economy of vehicles intended for collection.
  • Ensure performance of tasks thus reducing the economic damage caused by the disservice.
  • Low cost of prototyping.
  • Ensure communications encryption.
  • Ensure DB security (permissions and password encryption).
Open source

Project Overview

Following the investigations conducted by the media regarding the execution of the tasks assigned to the figure of the garbage collector within the municipal AMA (hereinafter referred to as the "client" or "company"), problems arise in the performance of the tasks assigned to employees in service with consequent discontinuity of the service itself throughout the area of ​​competence and, specifically, in the context of waste collection. In particular, a part of the staff of the garbage collectors is only partially performing their duties, resulting outside the control of the company itself.

It should also be noted that the client currently uses a system based on QR Code technology which, by using applications for mobile devices on devices assigned to the operator, does not effectively detect the performance of the service. In fact, through the aforementioned apps, the garbage collector in service guarantees the collection of waste by interacting with QR codes present on the baskets, except then not completing the task assigned to him.

From these premises derives the customer's need for an effective control system in order to return to guaranteeing the continuity of the service, as well as the objectives of this project.

The Challenge

As part of the IoT-A specifications, it is necessary to develop a prototype that contributes to the development of an intelligent solution for the optimization of waste collection tasks, respecting the requirements outlined above.

The data collected by the sensors of the waste bins must be delivered to the application database to allow them later display.

The Approach & Solution

As a first approach, the Node-Red framework was used to create a conceptual prototype prior to the true development of the web application on the Django platform. The following video shows the result obtained in the first week.

The final solution is a network of "sensor nodes" (i.e. devices that incorporate a detection sensor) positioned under each city waste bin that communicate on the network through special gateways, providing real-time data to a server. The data are also stored in a relational database with different levels of authorization and can be consulted H24 via a web interface. and updates to this web app can be performed without interrupting the service. Remote control of the aforementioned nodes is also planned.

The following image illustrates the main flow of the web application. Note that only the administrator has write permission.


The sensor data is sent via a computer (pc, raspberry or arduino) with internet access and dedicated to recopilation, processing and sending of final information in JSON format to the database. All this is done by db-filler (another program that I developed) which allow to perform these activities without compromising data integrity or database security. In the security field, in addition to error management, it allows access to the database via a password which is requested from the first login or in case of computer restart.

Before writing the new data the db-filler checks in database using queries. This allow to identify if a sensor is new and it must be created a new instance or if it already exists and it must be updated.

The Results

60% up
Presumable benefits.
Overall Cost
Electronic components price.

The result is a web application that solves the customer's needs H24 a day for a price of less than €50 per each garbage basket. The final product that I have carried out is open source and is available online as well as its prototype.

Dustbin IoT project is scalable in integrating new features and allows this web application to progressively improve. Below is a list of some of the features that could be implemented to improve this program.

  • Automatic sending of emails or notifications to operators for communicates the assignment of a collection.
  • Auto generation of service orders based on following parameters: operators with less workload, capacity of the baskets and suitable days for collection.
  • Calculation of the most efficient route to perform the collection and possibility to display it on a map with access to GPS from the application.
  • Support in multiple languages for more understanding from part of the operators.
  • Tutorial on how to use the application at first access, repeatable if necessary.
  • Possibility to identify who is the responsible for the current day and if necessary contact him from the app.


Programmatore brillante e con la determinazione nel sangue, Ariel è il membro ideale di qualsiasi team: contribuisce in modo decisivo durante tutte le fasi del progetto e porta a termine i propri task in modo impeccabile e puntuale. Questi fattori, uniti al livello di competenza raggiunto da Ariel nell'ambito della programmazione in python e dei database relazionali, hanno permesso lo sviluppo di un sistema IoT per la raccolta intelligente dei rifiuti urbani in tempi rapidissimi. Alla conclusione del progetto Ariel ha comunque continuato ad implementare da solo il prodotto creandone una vera e propria versione 2.0.
Matteo Frattaroli
Smart City & Clean Energy Management

Want me to help with your project?

You can send me information about your project and request a collaboration, I will reply as soon as possible. If you found one of my projects helpful or you learned something from the source code and want to thank me consider buying me a cup of coffee.