OpenSource Section | SB.Chetak Innovation | Research • Engineering • Responsible Knowledge Sharing

Smart IoT Bin

An Open-Source Arduino-Based Automatic Smart Waste Bin with GSM Alerts and Level Monitoring

IoT • Automation • Smart City • Arduino • GSM

Platform: Arduino Uno Sensor: HC-SR04 Ultrasonic Connectivity: SIM800L GSM Display: I2C LCD 16×2 Open-Source Project

An open-source Arduino-based Smart IoT Bin featuring automatic lid operation via a servo motor, ultrasonic waste-level detection, an I2C LCD for local status display, and a SIM800L GSM module that sends SMS alerts when the bin reaches capacity — making waste management smarter and more efficient.

Abstract

The Smart IoT Bin is an open-source electronics project that automates waste bin management using low-cost, widely available components. An HC-SR04 ultrasonic sensor detects when a person approaches the bin and triggers a servo motor to open the lid automatically.

A second ultrasonic sensor continuously monitors the fill level of the bin. The current fill percentage is displayed on an I2C LCD screen. When the bin exceeds a defined capacity threshold, the SIM800L GSM module sends an SMS alert to a configured phone number, notifying the operator to empty the bin.

Keywords: Smart Bin, IoT, Arduino, GSM, SMS Alert, Servo Motor, Ultrasonic Sensor, Waste Management, Automation, Open Source.

Key Features

🚪 Auto Lid Servo motor opens the lid automatically when proximity is detected
📏 Level Monitor Continuous waste-level monitoring with ultrasonic sensor
📱 GSM Alerts SMS notification sent when bin reaches capacity
🖥️ LCD Display Real-time fill level percentage shown on I2C LCD
⚡ Low Power Efficient design suitable for battery or USB operation
🔧 Open Source Full code and schematics freely available on GitHub

Components Required

  • 🎛️
    Arduino Uno Main microcontroller — processes sensor data and controls all peripherals
  • 📡
    HC-SR04 Ultrasonic Sensor ×2 One for proximity detection (lid trigger), one for waste-level measurement
  • ⚙️
    SG90 Servo Motor Controls the automatic lid — opens and closes based on proximity
  • 📟
    I2C LCD 16×2 Displays current fill level and system status
  • 📱
    SIM800L GSM Module Sends SMS alerts when bin is full — requires a SIM card with data plan
  • 🔋
    Power Supply 5V USB or battery pack — note that SIM800L requires stable 3.7–4.2V at up to 2A

How It Works

  1. The proximity ultrasonic sensor (Sensor 1) continuously scans for objects within a set range (e.g. 20 cm).
  2. When a person approaches the bin, the servo motor rotates to open the lid automatically.
  3. After a configurable delay (e.g. 3 seconds) with no proximity detected, the servo closes the lid.
  4. The waste-level ultrasonic sensor (Sensor 2) measures the distance from the top of the bin to the waste surface.
  5. The system calculates the fill percentage: fill% = (1 - distance / bin_height) × 100.
  6. The fill percentage is displayed on the I2C LCD in real time (e.g. "Fill Level: 72%").
  7. When fill level exceeds the threshold (default 80%), the SIM800L sends an SMS alert to the configured number.
  8. The alert message includes the bin ID and fill level, e.g. "BIN FULL: Bin-01 at 85%. Please empty."
20 cmDefault proximity trigger distance
3 secLid-open hold duration
80%Default SMS alert threshold
SMSAlert delivery via SIM800L GSM

Live Browser Demo

This browser simulation replicates the Smart Bin's behaviour. Use the controls to simulate waste being added or removed, and watch the system respond with lid actions and GSM alerts.

Smart IoT Bin — Browser Simulation Live Demo
0% Full
CLOSED
0%
Standby
Fill Level: 0%
[BOOT] Smart IoT Bin v1.0 — System ready.
[LCD ] Fill Level: 0%
[GSM ] SIM800L initialized. Waiting...

Arduino Source Code (Core Logic)

⬇️ Download Code (.ino)

The following is the core Arduino sketch. Install the LiquidCrystal_I2C and Servo libraries before uploading.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
#include <SoftwareSerial.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);
Servo lidServo;
SoftwareSerial gsm(10, 11); // RX, TX for SIM800L

// Pin definitions
const int TRIG_PROX  = 3;  // Proximity sensor TRIG
const int ECHO_PROX  = 4;  // Proximity sensor ECHO
const int TRIG_LEVEL = 5;  // Level sensor TRIG
const int ECHO_LEVEL = 6;  // Level sensor ECHO
const int SERVO_PIN  = 9;  // Servo motor

const float BIN_HEIGHT_CM   = 30.0; // Physical bin height
const float PROX_THRESHOLD  = 20.0; // cm — lid trigger distance
const int   ALERT_THRESHOLD = 80;   // % — SMS alert level
const int   LID_OPEN_MS     = 3000; // lid hold-open duration

bool alertSent = false;

long measureDistance(int trigPin, int echoPin) {
    digitalWrite(trigPin, LOW); delayMicroseconds(2);
    digitalWrite(trigPin, HIGH); delayMicroseconds(10);
    digitalWrite(trigPin, LOW);
    long duration = pulseIn(echoPin, HIGH, 30000);
    return duration * 0.034 / 2;
}

void sendSMS(String msg) {
    gsm.println("AT+CMGF=1");
    delay(500);
    gsm.println("AT+CMGS=\"+91XXXXXXXXXX\""); // Replace with number
    delay(500);
    gsm.print(msg);
    gsm.write(26); // Ctrl+Z
    delay(2000);
}

void setup() {
    lcd.init(); lcd.backlight();
    lidServo.attach(SERVO_PIN);
    lidServo.write(0); // Closed
    pinMode(TRIG_PROX, OUTPUT); pinMode(ECHO_PROX, INPUT);
    pinMode(TRIG_LEVEL, OUTPUT); pinMode(ECHO_LEVEL, INPUT);
    gsm.begin(9600);
    lcd.setCursor(0, 0); lcd.print("Smart IoT Bin");
    lcd.setCursor(0, 1); lcd.print("Initialising...");
    delay(2000); lcd.clear();
}

void loop() {
    long proxDist = measureDistance(TRIG_PROX, ECHO_PROX);
    if (proxDist < PROX_THRESHOLD) {
        lidServo.write(90); // Open lid
        delay(LID_OPEN_MS);
        lidServo.write(0);  // Close lid
    }

    long levelDist  = measureDistance(TRIG_LEVEL, ECHO_LEVEL);
    int  fillPercent = max(0, min(100, (int)((1.0 - (float)levelDist / BIN_HEIGHT_CM) * 100)));

    lcd.setCursor(0, 0); lcd.print("Fill Level:     ");
    lcd.setCursor(0, 1); lcd.print(String(fillPercent) + "%           ");

    if (fillPercent >= ALERT_THRESHOLD && !alertSent) {
        sendSMS("BIN FULL: Bin-01 at " + String(fillPercent) + "%. Please empty.");
        alertSent = true;
    }

    if (fillPercent < 20) alertSent = false;

    delay(1000);
}
                    

Open-Source Resources

Freely Available for Study and Reproduction

The Smart IoT Bin project is fully open source. The complete Arduino sketch, wiring schematic, component list and assembly guide are freely available. You may study, reproduce and modify this project for personal, educational or research use.

Arduino Sketch (.ino)
Wiring Schematic
Component List
Assembly Guide

OpenSource Section — SB.Chetak Innovation

This project is released for educational and research purposes. You may study, reproduce and modify it for personal or educational use. Attribution to the original author (Saswata Bag / SB.Chetak Innovation) is appreciated.