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.
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.
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.
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.
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.