Community project

Soot Trap Monitoring System

Photo of Soot Trap Monitoring System
Generated with AI

REYANSH SATISH BALTE

Published November 20, 2026

The Soot Trap Monitoring System tracks the fill level of a soot collection bin using an ultrasonic distance sensor and alerts when the trap is full. Built around an ESP32 microcontroller, the system displays real-time fill percentage on a small OLED screen and sounds a piezo buzzer alarm when the bin reaches capacity.

This guide provides a complete wiring diagram, parts list, and step-by-step assembly instructions to mount the distance sensor above the bin and connect all components to the ESP32. The included firmware handles distance measurement, fill calculation, display updates, and alarm triggering, making it ready to deploy as a maintenance alert system.

Wiring diagram

Wiring diagram for Soot Trap Monitoring System
Loading diagram…

Gather all the parts

QtyComponent
1

SSD1306 OLED

0.96-inch 128 x 64 white monochrome OLED display module driven by an SSD1306 controller over I2C (address 0x3C). It runs from 3 V to 5 V and connects through a 4-pin 2.54 mm header (GND, VCC, SCL, SDA); the self-emitting pixels need no backlight.

1

HC-SR04

HC-SR04 ultrasonic distance sensor module with separate 40 kHz transmitter and receiver transducers, measuring 2 to 400 cm. A 10 us pulse on TRIG starts a measurement and ECHO stays high for the echo's round-trip time. This HC-SR04+ board runs from 3.3 V or 5 V.

1

Resistor

2.2 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

3.3 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Piezo Buzzer

Small passive piezo buzzer (TDK PS1240) for beeps, tones and alerts. It has no built-in oscillator, so drive one lead with a 3-30 V square wave from a microcontroller pin using tone() or PWM and connect the other lead to ground. It is loudest around 4 kHz and works from about 2 to 10 kHz; driving both leads in antiphase roughly doubles the volume.

Assemble it in 4 steps

1. Connect the 0.96-inch 128x64 OLED with USB unplugged

Connect VCC to 3V3, GND to GND, SDA to GPIO21 (data), and SCL to GPIO22 (clock). Follow the labels on your display.

2. Connect the distance sensor

Connect VCC to the board's USB-powered VIN (5 V), GND to GND, and TRIG to GPIO23. Put the 2.2 kΩ resistor between ECHO and GPIO18. Put the 3.3 kΩ resistor between GPIO18 and GND.

  • Never wire the 5 V ECHO output straight to GPIO18.

3. Connect the passive piezo

Connect its signal lead to GPIO14 and its other lead to GND. Use a passive piezo, not a 5 V active buzzer or speaker.

4. Mount the sensor above the bin

Point the sensor straight down and keep it clear of the sides. Measure from the sensor face. Aim for 14 cm to the empty bottom and 3.5 cm to the full surface. Test with a flat target before relying on irregular contents.

Review all connections

1. Connections between "oled" and "ESP32"

FunctionoledESP32
powerVCC3V3
groundGNDGND
i2cSDAGPIO 21
i2cSCLGPIO 22

2. Connections between "sonar" and "ESP32"

FunctionsonarESP32
powerVCCVIN
groundGNDGND
digitalTRIGGPIO 23
digitalECHO → Resistor P1EXT

3. Connections between "upper" and "ESP32"

FunctionupperESP32
digitalP2GPIO 18

4. Connections between "lower" and "ESP32"

FunctionlowerESP32
digitalP1 → Resistor P2EXT
groundP2GND

5. Connections between "piezo" and "ESP32"

FunctionpiezoESP32
pwmSIGGPIO 14
groundGNDGND

Deploy the firmware

#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128,64,&Wire,-1);
constexpr int trig=23, echo=18, buzzer=14;
bool screen, fullAlarm=false, sounding=false;
int shown=-2;
uint32_t sampled=0, alarmStart=0;
void setup(){
  pinMode(trig,OUTPUT); digitalWrite(trig,LOW);
  pinMode(echo,INPUT); pinMode(buzzer,OUTPUT);
  Wire.begin(21,22);
  Wire.beginTransmission(0x3C);
  const uint8_t address=Wire.endTransmission()==0 ? 0x3C : 0x3D;
  screen=oled.begin(SSD1306_SWITCHCAPVCC,address,false,false);
}
void loop(){
  uint32_t now=millis();
  if(now-sampled>=150){
    sampled=now;
    digitalWrite(trig,HIGH); delayMicroseconds(12); digitalWrite(trig,LOW);
    auto us=pulseIn(echo,HIGH,25000);
    float cm=us*0.01715f;
    float fill=constrain((14.0f-cm)*100.0f/10.5f,0.0f,100.0f);
    int percent=us && cm>=2 ? int(fill + (fill > 99.95f ? 0.05f : 0.0f)) : -1;
    bool full=percent>=0 && fill>=95;
    if(full && !fullAlarm) alarmStart=millis();
    fullAlarm=full;
    if(screen && shown!=percent){
      shown=percent;
      oled.clearDisplay(); oled.setTextColor(SSD1306_WHITE);
      oled.setTextSize(1); oled.setCursor(0,0); oled.print(F("CARBO-TRAP"));
      oled.setCursor(0,18);
      if(percent<0) oled.print(F("No valid echo"));
      else { oled.setTextSize(3); oled.print(percent); oled.print('%');
        if(full){oled.setTextSize(1); oled.setCursor(0,47); oled.print(F("FULL!"));} }
      oled.display();
    }
  }
  bool beep=fullAlarm && (millis()-alarmStart)%800<160;
  if(beep!=sounding){sounding=beep; if(beep) tone(buzzer,4000); else noTone(buzzer);}
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik