AWS Builder Center
Building NudgeBin: An Event-Driven IoT Smart Bin using AWS Serverless & SageMaker

Building NudgeBin: An Event-Driven IoT Smart Bin using AWS Serverless & SageMaker

Learn how I built NudgeBin, an enterprise-grade IoT platform that uses behavioral audio nudges at the edge to improve recycling habits, combined with an AWS serverless backend to optimize municipal waste collection routes and forecast biogas energy yields.

Full Stack Developer |System Design, REST APIs, SQL | 4x Hackathon Winner
Traditional municipal solid waste management is incredibly inefficient. Collection trucks operate on static routes, dispatching massive diesel vehicles to collect bins that are often only 10% full. This wastes millions of liters of fuel annually and generates unnecessary CO₂ emissions.
To solve this for a recent hackathon, I built NudgeBin—a platform that merges behavioral psychology at the edge with predictive cloud logistics on AWS.

The Edge: Behavioral Nudges

On the ground, NudgeBin utilizes an ESP32 microcontroller paired with an HC-SR04 ultrasonic sensor. When citizens approach the bin, it triggers a DFPlayer Mini to play localized audio nudges. Positive reinforcement ("Thank you for keeping our city clean!") encourages continuous usage, while negative limits ("This bin is at capacity, please use the next one") prevent overflowing.
Once an interaction occurs, the ESP32 wakes from deep sleep and pushes a JSON payload containing the  bin_id ,  fill_level , and  battery_voltage  to the cloud.

The Cloud: 100% Serverless Architecture

I wanted the backend to be highly scalable and event-driven, computing only when a sensor pings it.
  1. Ingestion: The ESP32 pushes an HTTP POST payload to Amazon API Gateway, which acts as a secure front door without requiring heavy hardware-side authentication.
  1. Processing: The gateway triggers an AWS Lambda function (written in Python using Boto3). Lambda validates the payload, stamps it with an epoch timestamp, and calculates real-time climate metrics (like diesel conserved by skipping this bin on a route).
  1. Storage: The time-series telemetry is stored in Amazon DynamoDB, utilizing the  bin_id  as the Partition Key and the  timestamp  as the Sort Key for rapid querying.
  1. Event-Driven Dispatch: If Lambda detects a  fill_level >= 85% , it invokes Amazon SNS to instantly publish an email alert to the municipal logistics team to dynamically re-route a collection truck.

Predictive Analytics with Amazon SageMaker

To move from reactive to proactive logistics, I utilized Amazon SageMaker. By training a  RandomForestRegressor  on historical synthetic data, the platform analyzes current fill levels, hour-of-the-day, and foot traffic multipliers to predict the exact hours remaining until a bin reaches capacity. It also forecasts the weekly Biogas (kWh) yield based on the organic matter collected.

The Enterprise Dashboard (AWS Amplify)

To visualize this pipeline, I built a React + Vite dashboard featuring a custom Glassmorphism UI and Chart.js analytics.
Because judges couldn't physically interact with the smart bin, I built a "Digital Twin" tab that simulates the ESP32 ping latency and logs the MP3 files being played at the edge. The entire frontend is deployed via AWS Amplify for seamless CI/CD directly from my GitHub repository.

Conclusion

Building NudgeBin taught me how to securely chain AWS services together using IAM least-privilege roles and structure NoSQL data for IoT time-series querying. By bridging edge hardware with cloud machine learning, we can actively change citizen behavior while turning reactive logistics into a predictive, energy-saving engine.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article