Trash Level Indicator

Introduction: Trash Level Indicator

The Trash Level Indicator uses an ultrasonic sensor with an Arduino to build a simple device that janitors can use to know which trash bin needs to be emptied. The ultrasonic sensor measures the distance of the bottom on the bin from the device, and as trash is filled in, this distance becomes shorter. When the distance is below a certain level, the LED is lit, indicating that the bin is full, ready to be emptied. This saves time for the janitors, they would only need to focus on bins that the indicator is on for.

Step 1: Setup

This device uses:

1. An Arduino or ATMega 328

2. An ultrasonic sensor

3. One LED

4. Wires


The ultrasonic sensor on the breadboard is connected to digital pins 3 (Echo) and 4 (Trig) of the Arduino. The LED on the breadboard is connected to Pin 13 of the Arduino, and to ground.

The device can be set for battery operation.

Step 2: Working

The ultrasonic sensor measures the distance from the device to the level of trash. As trash is filled in, the distance decreases, and when the distance is lower than a threshold level the LED is lit.

Arduino Contest 2019

Participated in the
Arduino Contest 2019

Be the First to Share


    • Anything Goes Contest

      Anything Goes Contest



    Question 3 years ago on Step 1

    Did you program the arduino micro controller? What specific code did you use?


    Answer 3 years ago

    Yes I used Arduino to program an ATmega328 microcontroller.

    Code is below:

    * Distance measurement using Ultrasonic Sensor
    * Ashrit P.
    * Instructbles code
    // define the seonsor and LED pins
    const int trigPin = 4;
    const int echoPin = 3;
    const int LEDPin = 13;
    // defines variables
    long duration;
    int distance;
    void setup() {
    pinMode(trigPin, OUTPUT); // Trig Pin is setup as Output
    pinMode(echoPin, INPUT); // Echopin is setup as Input
    pinMode(LEDPin, OUTPUT); //LED Pin is setup as output
    void loop() {
    // Clears the trigPin
    digitalWrite(trigPin, LOW);
    // Sets the trigPin on HIGH state for 10 micro seconds
    digitalWrite(trigPin, HIGH);
    digitalWrite(trigPin, LOW);
    // Reads the echoPin, returns the sound wave travel time in microseconds
    duration = pulseIn(echoPin, HIGH);
    // Calculating the distance
    distance= duration*0.034/2;
    // Adjust the distance measurement as needed
    if (distance < 12)
    { digitalWrite(LEDPin, HIGH);}
    {digitalWrite(LEDPin, LOW);}