Solid waste disposal in Java, PHP, CodeIgniter and C

Solid waste disposal in Java, PHP, CodeIgniter and C

May 7, 2020

In January 2019, the Federal Law on waste collection came into effect in Russia. The so-called ‘waste reforms’ have transformed the collection and disposal of solid household waste. According to the Federal Law No. 89 ‘On Industrial and Consumer Waste’, from now on solid household waste must be sorted into separate materials: plastic, paper, glass, etc.

Waste collection and disposal can only be carried out by authorised operators selected through a tender process. Local authorities need to ensure tariff regulations are met and provide operators with landfill sites. The authorities cannot collect, store or dispose of waste independently. Residents will now have to pay fees for waste collection.

01 Household solid waste HSW ‘Household solid waste’ is waste produced by daily human life: food, paper waste, plastic and polymers, glass containers and glass waste, scrap metal.
02 Municipal solid waste MSW ‘Municipal solid waste’ from the upkeep of residential premises: waste from cleaning or repairs, damaged equipment or furniture, and plant waste such as grass, foliage and tree branches.

Waste is collected only at the sites set out in accordance with the MSW management scheme approved in the region. Waste from an apartment building is taken out only from containers in refuse rooms, or from containers at container sites.

Waste collection has become much more sophisticated. Previously, a refuse truck would drive along every street in a given area and collect waste, regardless of whether the containers were full or not. Old containers were not sorted. There was no regulation of the efficiency of refuse trucks. A refuse truck could arrive when the container was half empty, or when mountains of waste had accumulated around the container. The cost of waste removal was not monitored or taken into account.

Now that operators are responsible for this, and private companies own the refuse trucks, there is a need to reduce costs on the one hand, and to carry out timely waste disposal on the other. A refuse truck empties bins containing a single class of waste, whether paper, plastic, glass, unsorted solid waste, construction waste, or general waste.

Refuse truck owners are only interested in emptying containers that are 100% full. At the same time, operators need to make sure that waste is taken out on time and does not accumulate around the bins. A solution can be found via specialised hardware and software.

Logic system

01 Server Server A physical or virtual server running Linux with installed software.
02 Administrator Administrator A specialist who controls the settings and manages the system.
03 Operator Operator A specialist who opens shifts for drivers and monitors the movement of vehicles.
04 Container Container A smart waste collection device that sends its ID code and geographical coordinates, as well as information about bin fill level and battery charge to the server.
05 MSW collection point MSW collection point The start point of each waste delivery trip.
06 Vehicle Vehicle The refuse truck.
07 Class Class Classifier of waste category: plastic, glass, paper, organic waste.
08 Vehicle class Vehicle class The class of waste transported by a given refuse truck.
09 Garage Garage Parking and maintenance of vehicles.
10 Route Route The sequence of points (containers, garage, waste collection points) on the map that the vehicle has to pass through.
11 Driver Driver Drives the vehicle along the established route.
12 Trip Trip A set of containers and one collection point for solid waste on the driver's designated route.
13 Track Track Actual GPS/GLONASS coordinates of the vehicle's trip.
14 Region Region The location by area of a cluster of bins on the map. It can be used to separate trips and vehicles by urban districts, or to link to a specific landfill.
15 Tag Tag The identifier used to assign bins to customers. It is required when operators of several companies use a shared database.
16 Container size Container size Bin sizes can be different based on varying container types.
17 Administrator application Administrator application Web application for managing lists of sites, parameter settings, and reporting.
18 Operator application Operator application Web application for managing driver shifts, monitoring the performance of trips by refuse truck, and reporting.
19 Driver application Driver application A mobile Android application for starting and ending shifts, requesting trips, displaying the map and the route, recording actions involving waste bins, and regularly sending the coordinates of the refuse truck to the server.
20 Server side Server side API and database for recording information from waste bins, the times that drivers begin and end shifts, logic for recording trips, storage of real-time coordinates of refuse trucks and containers, and much more.

Smart waste bin

A device with a built-in communication module and a unique identifier sends data about bin fill level, battery charge and location coordinates to the server in the JSON format:

  • 32-bit industrial STM microcontroller;
  • GSM/GPRS module;
  • infrared range finder;
  • rechargeable battery;
  • microcontroller software developed in C.

The server address is assigned in the settings. The database records all communication sessions for each waste bin. The server checks incoming JSON and the presence of a container with the specified identifier in the database. If the identifier is absent, processing is not carried out.

The bin can be 0%, 50% or 100% full. The time of the first change in fill level and the time of the last exchange with each waste bin is recorded. For each refuse truck, beginning with those which are most full and which fill up most quickly, a list of waste bins of the appropriate waste class is compiled.

Administrator application

Web application that works in all common browsers. The administrator logs in using a personal login and password. It allows administrators to edit parameters and manage the following catalogues:

  • companies;
  • cities;
  • regions;
  • waste classes;
  • waste bins;
  • collection points;
  • vehicles;
  • users;
  • drivers' mobile devices.
Administrator application. Basic settings

A new bin is added by dragging the ‘Add bin here’ marker onto the map. The waste bin is automatically assigned a new identifier, indicating the name, company, size, city, region and waste class.

A group of waste bins with multiple selections in the ‘Waste class’ field can be placed at a particular point with any given coordinates. A bin with a unique identifier will appear for each class.

Administrator application. Adding a container
Administrator application. Adding a container group

When adding a refuse truck, its name, registration number, VIN, body volume, bulk factor, company, city, region and waste class are provided. Each refuse truck is equipped with a tablet PC with a mobile driver application installed. The tablet links the drivers, the vehicle and the company via the server and its IMEI code is recorded.

The waste collection point is assigned a name, entry coordinates, classes of waste accepted, and a list of companies, cities and city regions which it serves.

Administrator application. Vehicle change

Operator application

Web application supported by all common browsers. The operator logs into the system with a personal login and password. Upon successful authorisation, the system checks whether there is an active shift: if so, a confirmation is offered to end the shift of another operator and start the shift for the current operator.

Operator application. Authorization

The operator then sees a map showing the first city on the list of those served by the company. Switching cities is carried out using a special button on the left, under the buttons used to toggle the map scale.

The visible part of the map displays waste bins, vehicles, and waste collection points. Objects of various types are displayed in their own layer, which can be altered. When an object is clicked, a window containing the relevant information pops up. The menu bar displays blocks with information about the shifts and trips of drivers, containing several icons above which the number of shifts or trips for a given status is displayed.

Operator application. Incoming requests to open a shift
Operator application. Map and information window
Operator application. Map

The operator approves or rejects a driver's request to begin a shift. In case of rejection, the reason for refusal is indicated. Until the shift is confirmed, the driver's application does not allow them to take any action. The operator monitors the driver, but does not create a trip or confirm the route of the trip. The operator is also unable to make any changes to the trip.

Operator application. Shift opening approval

Driver application

The mobile application is authorised in the system using the IMEI-identified tablet. The server checks whether the driver is currently on a shift, creates a request to begin a shift, or sends data to the tablet.

After confirming the start of a shift, the ‘Request route’ function becomes available, which creates a list of fully or partially filled waste bins based on the refuse truck's waste class as well as its company, city and city region.

Driver app. Route view

Waste bins are sorted in descending order of fill level (100%, 50%, 0%) and by the date and time they are expected to be filled (soonest first). Full waste bins that have been filled recently will be at the top of the list. Bins which haven't sent any information to the server for a long time are added to the list.

The number of bins to be emptied during a single trip is calculated according to a formula that takes into account the size of the refuse truck and the bulk factor of the waste, adding two extra bins to the total.

The resulting list of bins included in the trip is sent to LogDep, which fulfils the task of a travelling salesman, optimising the order of visits according to a fixed set of points. The results of the optimisation process are sent to the mobile application and the bins to be emptied during the trip are displayed on the screen.

Refuse truck drivers can accept the trip or decline it, though a reason must be given if they decline. If the trip is accepted, the refuse truck driver starts moving and the route between the first two bins is displayed on the screen. The coordinates of the refuse truck are periodically sent to the server.

Driver app. Map
Driver app. Completion of the shift

When the driver approaches a waste bin, the buttons for monitoring the unloading process appear: ‘Collected’, ‘Missed’, and ‘Failure’. The buttons can also be made to appear manually by clicking on the bin icon. The icons are given the same colour coding in the operator application and, when clicked, reveal information about the bin's fullness and whether the bin was emptied by the refuse truck.

After processing all the bins along the route, the application displays the route to the waste collection point. The driver can request a route to the waste collection point without waiting for all the bins to be processed. In this case, the server returns a list of available points indicating the distance to each of them, sorted in ascending order of distance.

Work completed

01 Gears and screwdriver Redevelopment of the website and mobile application of a system for monitoring bin fill levels and regulating the procedure for the removal of waste using specialised vehicles.
02 Research services The study of services for building routes based on given location points.
03 Chemistry tubes and stages Selection of a service that solves the ‘travelling salesman’ problem based on request data. We tried the VeeRoute service, which carries out full-scale enterprise logistics: information about vehicles, drivers, a list of bins, landfill sites, orders and delivery addresses must be uploaded. We rejected this option because we had already created our own logistics and were only looking for a way to calculate the optimal route between a series of points, from the initial point to the landfill site.
04 Web application API Implementation of new API methods for operator and administrator web applications.
05 Web application’s desing Changing the interface of the operator and administrator web applications.
06 From system unit to mobile WebSocket exchange with a mobile application.
07 API Integration Integration with the LogDep automatic planning service API to optimise the order of visits to waste bins.
08 Route Building a route between two waste bins using the Yandex.Maps JavaScript API and the Selenium WebDriver browser driver.