An IoT garbage monitoring system built with Arduino sensors, ESP8266 WiFi, a Python desktop dashboard, and a Kotlin Android app, plus what it taught me about hardware constraints.
A university project where I built a garbage bin that knows how full it is and tells you about it. An ultrasonic sensor measures the fill level, an ESP8266 sends the data over WiFi, and you can monitor it from a desktop GUI or an Android app.
The Hardware
An Arduino Uno with an HC-SR04 ultrasonic sensor measures distance to the garbage surface. A servo motor opens the lid when someone approaches (second ultrasonic sensor detects proximity). The Arduino sends distance readings over serial to an ESP8266, which transmits them over WiFi.
// The core measurement is simple — pulse timing to distance conversion
long duration = pulseIn(echoPin, HIGH);
long cm = duration / 29 / 2;The ESP8266 connects to a laptop or cloud endpoint over TCP and forwards the readings.
What Worked
The HC-SR04 measured garbage levels to within 1-2cm in a 22cm bin. The math is basic physics (speed of sound, halved for the round trip).
Publishing sensor data to ThingSpeak over MQTT gave us a real-time dashboard with almost no code. For prototyping IoT, it's hard to beat.
The Kotlin Android app was overkill but fun. It shows bin status and sends a notification when the bin is full. A web dashboard would have been enough, but piping IoT data all the way to a phone notification was a worthwhile exercise.
What I'd Change
Power management was an afterthought. The Arduino and ESP8266 run continuously, which drains batteries fast. A production system would need sleep modes: wake up, take a reading, transmit, sleep. We never implemented this because we had wall power during the demo.
The ESP8266 drops WiFi connections silently. Our code had a basic reconnect loop that didn't hold up well. A real deployment would want MQTT with QoS 1 (at-least-once delivery) and offline buffering.
We added Azure IoT Hub because it sounded impressive for the project defense, while ThingSpeak was already doing everything we needed. I wouldn't add cloud infrastructure to a project that works fine without it again.
Physical Constraints
Most of the difficulty was physical. Mount the sensor wrong and you measure the bin wall instead of the garbage. The ESP8266 has a weak antenna, so WiFi range is limited, and power was a problem the whole way through. Pure software projects never put these in front of you, and I learned more from them than from the code.
Source code: Arduino | ESP8266 | Edge Layer