top of page

IoT Canvas Gauge based Garbage Monitor using OLED and Ultrasonic sensor

Updated: Jul 2, 2021

Here to make an IoT based garbage bin level monitoring system. In this level monitoring using canvas gauge in HTML page and OLED. The real time garbage fill level can be monitored via internet. The IOT system uses non-contact method (ultrasonic sensor based) for measuring garbage level and it can detect solid, semi-solid and liquid waste level up to 20cm and capable of 400cm.


Circuit diagram


Components required

NodeMCU ESP826612E

Ultrasonic Distance Sensor HC-SR04

OLED SSD1306 - 4 PIN I2C 128X64 Display Module 0.96

Jumper wires


HC-SR04

This is the HC-SR04 ultrasonic distance sensor. This economical sensor provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit.

There are only four pins that you need to worry about on the HC-SR04:

VCC (Power) to NodeMCU VinPin

Trig (Trigger) to NodeMCU D5 Pin

Echo (Receive) to NodeMCU D6 Pin

GND (Ground) to NodeMCU GND Pin.

OLED SSD1306-I2C 128X64 Display Module 0.96 inch

This is a 0.96 inch Blue-Yellow OLED display module. The display module can be interfaced with any microcontroller using SPI/IIC protocols. It is having a resolution of 128x64. The package includes display board,display, 4 pin male header presoldered to board.

OLED (Organic Light-Emitting Diode) is a self light-emitting technology composed of a thin, multi-layered organic film placed between an anode and cathode. In contrast to LCD technology, OLED does not require a backlight. OLED possesses high application potential for virtually all types of displays and is regarded as the ultimate technology for the next generation of flat-panel displays.


Specifications :

Viewing angle : greater than 160 degrees

Supported platforms : for arduino, 51 series, MSP430 series, STIM32 / 2, SCR chips

Low power consumption : 0.04W during normal operation

Support wide voltage : 3.3V-5V DC

Driver IC : SSD1306

Communication : IIC, only two I / O ports

No font : The software takes word modulo

Backlight : OLED self light, no backlight

Interface: VCC: 3.3-5V GND: Ground SCL: Serial Clock SDA: Serial


Installing the ESP8266 Arduino Library

Installing SSD1306 OLED Library – ESP8266

There are several libraries available to control the OLED display with the ESP8266. In this tutorial we’ll use two Adafruit libraries:

Adafruit_SSD1306 library Download

Adafruit_GFX library. Download

Subscribe and Download code.


Follow the next steps to install those libraries.

1. Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open.

2. Type “SSD1306” in the search box and install the Adafruit SSD1306 library version 1.2.9 library from Adafruit.

3. After installing the SSD1306 library from Adafruit GFX version 1.4.13 in the search box and install the library.

4. After installing the libraries, restart your Arduino IDE.

After installing the required libraries, copy the following code to your Arduino IDE.


Arduino Code

Subscribe and Download code.



313 views0 comments
bottom of page