Annabel MathewABDUL HADI PGokul RAbhinav S R
Published

Odour-free smart compost bin for urban flats

Smart Compost Bin: A compact, odour-free bin for urban flats that automatically composts kitchen waste and sends real-time alerts.

BeginnerFull instructions provided86
Odour-free smart compost bin for urban flats

Things used in this project

Hardware components

ESP32-WROOM-32
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
MQ 135 Air Quality/Gas Detector Sensor Module
×1
12V DC Water Pump
Seeed Studio 12V DC Water Pump
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
Geared DC Motor, 12 V
Geared DC Motor, 12 V
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×3
Exhaust fan(5V)
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
12V POWER ADAPTER
×1

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit diagram simulated in Wokwi

Circuit Diagram Description
The Smart Compost Bin circuit is built around an ESP32 Dev Board that controls all sensors and actuators:

Sensors

DHT22 measures temperature and humidity of the composting chamber (Data → GPIO 4).

MQ2 Gas Sensor detects VOC/gas buildup (Analog → GPIO 34).

Potentiometer simulates the soil/moisture sensor for testing (Analog → GPIO 39).

Actuators

3 Servo Motors (GPIO 15, 13, 14) control lids for transferring waste between layers.

Mixer Motor, Exhaust Fan, and Relay Output are simulated using LEDs:

LED on GPIO 25 → Mixer Motor ON/OFF

LED on GPIO 27 → Exhaust Fan (always ON in code)

LED on GPIO 32 → Relay Signal (simulates auxiliary control)

Power Connections

ESP32 VIN/5V → Red rail (Powers servos, MQ2, DHT, and LEDs)

ESP32 GND → Black rail (Common ground for all components)

Potentiometer powered from 3.3 V for stable analog input

Simulation Note

LEDs are used in place of DC motors, exhaust fan, and relay module since Wokwi does not support these components.

In real hardware:

GPIO 25 drives Mixer Motor via L298N

GPIO 27 drives Exhaust Fan via L298N

GPIO 32 controls Relay Module

Code

Code uploaded to ESP-32

Arduino
 #include <ESP32Servo.h>
 #include <DHT.h>
 #define SERVO1_PIN 15
 #define SERVO2_PIN 13
 #define SERVO3_PIN 14
 #define MIXER_IN1 25
 #define MIXER_IN2 26
 #define FAN_IN3 27
 #define FAN_IN4 33
 #define RELAY_PIN 32
 #define DHTPIN 4
 #define DHTTYPE DHT11
 #define GAS_SENSOR_PIN 34
 #define MOQ_SENSOR_PIN 39
 Servo servo1, servo2, servo3;
 DHT dht(DHTPIN, DHTTYPE);
 void setup() {
  Serial.begin(115200);
  dht.begin();
  servo1.attach(SERVO1_PIN);
  servo2.attach(SERVO2_PIN);
  servo3.attach(SERVO3_PIN);
  servo1.write(0); servo2.write(0); servo3.write(0);
  pinMode(MIXER_IN1, OUTPUT);
  pinMode(MIXER_IN2, OUTPUT);
  digitalWrite(MIXER_IN1, LOW);
  digitalWrite(MIXER_IN2, LOW);
  pinMode(FAN_IN3, OUTPUT);
  pinMode(FAN_IN4, OUTPUT);
  digitalWrite(FAN_IN3, HIGH);
  digitalWrite(FAN_IN4, LOW);
  pinMode(RELAY_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, HIGH);
  Serial.println("Booting..."); delay(3000);
  servo1.write(180); delay(3000); servo1.write(0); delay(3000);
  servo2.write(90); delay(5000); servo2.write(0);
  digitalWrite(MIXER_IN1, HIGH); digitalWrite(MIXER_IN2, LOW);
  delay(5000);
  digitalWrite(MIXER_IN1, LOW); digitalWrite(MIXER_IN2, LOW);
  servo3.write(90); delay(5000); servo3.write(0);
 }
 void loop() {
  float temp = dht.readTemperature();
  float hum = dht.readHumidity();
  int gas = analogRead(GAS_SENSOR_PIN);
  int moisture = analogRead(MOQ_SENSOR_PIN);
  Serial.print("Temp: "); Serial.print(temp);
  Serial.print(" C | Hum: "); Serial.print(hum);
  Serial.print(" % | Gas: "); Serial.print(gas);
  Serial.print(" | Moisture: "); Serial.println(moisture);
  delay(3000);
 }

Credits

Annabel Mathew
1 project • 0 followers
ABDUL HADI P
1 project • 0 followers
Gokul R
1 project • 0 followers
Abhinav S R
1 project • 0 followers

Comments