Redson Dev · Idea
Smart Bin Level Monitor for Public Park Waste Management
Published July 21, 2026
This project offers a practical solution for optimizing waste collection routes in public spaces. Busy park managers, like those overseeing Golden Gate Park in San Francisco, can use this system to monitor the fill level of trash bins remotely and in real time. This allows for proactive waste collection, reducing overflows, improving park cleanliness, and lowering operational costs by deploying collection teams only when needed.
What you'll need
- 1x ESP32 WROOM 32 Development Board
- 1x HC-SR04 Ultrasonic Distance Sensor
- 1x Breadboard (small)
- 6x Male-to-male jumper wires
- 1x Micro USB cable (for ESP32 power/programming)
- 1x 3D printed or weatherproof enclosure
Step-by-step
- 01
Assemble the Sensor Circuit
Mount the HC-SR04 sensor onto the breadboard. Connect the 'VCC' pin of the sensor to the '3V3' pin on the ESP32. Connect the 'GND' pin of the sensor to a 'GND' pin on the ESP32. Connect the 'Trig' pin of the sensor to GPIO 23 on the ESP32 and the 'Echo' pin to GPIO 22 on the ESP32 using jumper wires.
- 02
Set up ESP32 IDE and Libraries
Download and install the Arduino IDE. Add ESP32 boards support via File > Preferences > Additional Boards Manager URLs: `https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json`. Go to Tools > Board > Boards Manager, search for 'esp32' and install. Install the 'NewPing' library via Sketch > Include Library > Manage Libraries.
- 03
Program the ESP32 for Distance Measurement
Write a sketch that initializes the HC-SR04 sensor and periodically measures the distance to the trash. The NewPing library simplifies this: `sonar.ping_cm()` will return the distance in centimeters. Calibrate the maximum bin depth in your code to determine fill percentage. Example: `const int MAX_BIN_DEPTH_CM = 100;`.
- 04
Implement Wi-Fi and Data Transmission
Integrate Wi-Fi connectivity into your ESP32 sketch. Use the `WiFi.begin()` function with your Wi-Fi SSID and password. Implement HTTP POST requests to send the bin fill level data to a simple cloud-based data storage service (e.g., a custom API endpoint you control). Include unique device IDs for each bin sensor.
- 05
Configure for Deployment and Power
Once programmed and tested, house the ESP32 and sensor in a weatherproof enclosure suitable for outdoor conditions. For continuous operation, consider connecting a small solar panel with a charge controller to a lithium-ion battery, providing power autonomy for the remote bin monitor. Securely mount the sensor under the bin lid, pointing downwards.
Tips
- Experiment with different ultrasonic sensor orientations to avoid false readings from trash bag movement.
- Consider adding a deep sleep mode to the ESP32 to conserve battery power and extend deployment time.
- Use a simple web dashboard to visualize bin fill levels and trigger alerts when bins are 80% full.
