← Back to portfolio
Field report
Field report · IoT / deep learning · published research

A reverse vending machine that pays for itself in scale.

Commercial reverse vending machines cost $1,800 to $25,000 and depend on imported IR spectroscopy. This one used a locally trained MobileNet classifier, custom mechanical sorting, and Firebase-backed rewards to collect over 650kg of plastic at under $750 per unit — and the result was published and peer-reviewed.

Embedded/IoT
engineer, NCAI Smart City Lab
2022
two hardware iterations, field validated
ESP32 + MobileNet
edge compute & classification
Published
650kg+ plastic collected
01 · Overview

Context

Plastic bottle waste in Pakistan is largely unmanaged. Without domestic recycling infrastructure, bottles are burned, dumped, or informally resold by individual workers, and reverse vending machines — a proven incentive mechanism elsewhere in the world — were priced out of local reach: commercial units built on IR spectroscopy or barcode readers run $1,800 to $25,000.

The goal was to build an end-to-end RVM — hardware, bottle-recognition intelligence, and a reward system — designed specifically for a Pakistani installation context rather than adapted from an imported product. The resulting work, Plastic Waste Management through the Development of a Low Cost and Light Weight Deep Learning Based Reverse Vending Machine, was published in Recycling in 2022.

02 · Challenge

02Cheap compute, real-world bottles

Object recognition had to work reliably on cheap, low-power compute instead of cloud GPUs, while still handling real-world bottle variation — different sizes, colors, crushed or deformed shapes, and reflections off plastic that confuse simpler classifiers.

On the mechanical side, the machine needed to survive outdoor deployment in rain, dust, and temperature swings, sort bottles by size without human intervention, and track a reward balance per user without any proprietary payment hardware.

Project snapshot. Deployed on a university campus in Karachi · focused on bottle recognition, sorting, and reward automation · resulted in 650kg+ of recycled plastic and a published validation.
03 · Journey

03Two machines, one working system

Two full machine versions were built. The first was bulky, expensive, and indoor-only. The second — the version documented in the publication — was smaller, more accurate, and rated for outdoor operation, moving from IR to ultrasonic proximity sensing because IR proved unreliable in dust, smoke, and mist, and rebuilding the enclosure in metal so electronics stayed protected through heavy rain.

The interaction flow was practical and user-centered. Capacitive proximity sensors at the intake triggered a camera to capture images of the inserted object, which were classified on an edge computing device using a locally trained deep learning model. Non-bottles were rejected back to the user; recognized bottles were classified by size, moved by a custom mechanical arm to a load-cell weighing platform, and logged against the user's account in Firebase once they entered their details on a keypad. Reward points accumulated before the arm dropped the bottle into the correct bin, while a separate check continuously monitored bin fill level and emailed the site manager when a bin became full.

The classification dataset was collected from scratch: nearly 11,000 images captured by a camera mounted inside the machine itself, covering large bottles, small bottles, and a wide non-bottle category — cups, paper, wrappers — under varying conditions such as with and without caps, labels, and deformations.

Second-generation RVM rebuilt in a metal enclosure for outdoor durability
The second-generation RVM, rebuilt in a metal enclosure for outdoor durability after the first indoor-only version.
04 · Architecture

04Four systems, one machine

Compute split

An ESP32 acted as a secondary controller, reading the keypad, proximity sensors, and load cell over GPIO and sending data to the edge device as JSON over TCP. The edge device itself ran the TensorFlow Lite model and handled cloud/database communication.

Model selection

MobileNetV2, ResNet50, and InceptionV3 were benchmarked using transfer learning on the custom bottle dataset. MobileNet performed best on the key embedded metrics, with the highest validation accuracy and only a fraction of the model size.

Mechanical design

The enclosure was fabricated in metal and built around a conveyor belt feeding two size-based weighing and sorting stations. The design prioritized outdoor durability and low-cost fabrication over premium industrial packaging.

Database and reward logic

Firebase stored user activity and reward balances while the machine kept an operational record of bottle counts, estimated weight, and bin status, making the system more useful as a recycling platform than a standalone prototype.

System diagram showing how the conveyor and sorting stations route a bottle from intake to bin
The published system diagram showing how the conveyor and sorting stations route a bottle from intake to bin.
Onboard communication hardware that reported bin status back to the site manager
The onboard communication hardware that reported bin status and machine activity back to the site manager.
05 · Impact

Results and lessons

The MobileNet-based classification system reached 99.2% test accuracy and 99.6% validation accuracy, outperforming larger reference models while keeping deployment practical on low-power hardware. Yet whole-machine validation showed an important truth: a strong model alone was not enough. Early testing showed a 29% real-world misclassification rate, mostly caused by poor internal lighting and camera mounting angle distortion. Correcting the camera posture without changing the model cut the error rate by more than half, to 13%, highlighting how installation details and physical system design can strongly affect deployed vision performance.

Across two machine versions, the system collected more than 650kg of plastic over more than six months at an estimated build cost below $750 per unit — far lower than the $1,800–$25,000 range of comparable commercial systems. Remaining limitations were candidly documented: a jerky, noisy conveyor motor as a cost trade-off, and the significant transport weight of the metal enclosure built for outdoor reliability. The project demonstrated that a low-cost inference pipeline combined with a strong user incentive model can create a meaningful recycling intervention rather than just a technical experiment.