The Smart Samaj Paricharak is an IoT-based waste management solution that leverages advanced technologies to help municipalities maintain cleanliness. This system uses an ESP8266 Module, an IR sensor, an ultrasonic sensor, and a servo motor, all integrated with Blynk 2.0 for efficient monitoring and control.
Components Required:
- ESP8266 (Node MCU) – 1
- IR Sensor – 1
- Ultrasonic Sensor (HC-SR04) – 1
- Servo Motor – 1
- Resistor (10kΩ) – 1
- USB Cable – 1
- Breadboard and Jumper wires
Components and it’s function
- ESP8266: A Wi-Fi-enabled brain that facilitates wireless communication with Blynk 2.0.
- Ultrasonic Sensor: Measures the distance to the waste in the bin, determining the fill level.
- IR Sensor: Detects the presence and distance of waste to confirm disposal events.
- Servo Motor: Control movements, such as opening and closing the bin lid based on sensor inputs.
Pin Connections
- ESP8266 (Node MCU) Pins:
- D2: Servo motor control pin
- D5: Ultrasonic sensor echo pin
- D6: Ultrasonic sensor trig pin
- D7: IR sensor output pin
- IR Sensor:
- VCC: Connect to 3.3V on ESP8266
- GND: Connect to GND on ESP8266
- Output: Connect to D7 on ESP8266
- Ultrasonic Sensor (HC-SR04):
- VCC: Connect to 5V (Node MCU provides a 5V pin)
- GND: Connect to GND on ESP8266
- Trig: Connect to D6 on ESP8266
- Echo: Connect to D5 on ESP8266
- Servo Motor:
- Signal: Connect to D2 on ESP8266
- VCC: Connect to 5V
- GND: Connect to GND
Blynk 2.0 Features:
Blynk 2.0 offers enhanced features for creating and managing IoT projects. Here’s how to create templates for the Smart Samaj Paricharak:
Creating Templates on Blynk 2.0
- Template for Ultrasonic Sensor (Bin Level)
- Create a New Template: Log into your Blynk 2.0 account and create a new template named “Bin Level Monitor.”
- Add Data Streams: Add a data stream for the ultrasonic sensor. Set the data stream type to Integer and unit to cm to measure the fill level.
- Widgets: Add a Gauge widget to display the bin level in real-time. Link this widget to the ultrasonic sensor data stream.
- Template for IR Sensor (Waste Detection)
- Create a New Template: Create another template named “Waste Detection Monitor.”
- Add Data Streams: Add a data stream for the IR sensor. Set the data stream type to Integer and unit to cm for distance measurement.
- Widgets: Add a Value Display widget to show the IR sensor readings. Link this widget to the IR sensor data stream.
- Template for Servo Motor (Angle Control)
- Create a New Template: Create a third template named “Servo Angle Control.”
- Add Data Streams: Add a data stream for the servo motor. Set the data stream type to Integer and unit to degrees to control the servo angle.
- Widgets: Add a Slider widget to adjust the servo motor angle. Link this widget to the servo motor data stream.
Working:
- Monitoring: The ultrasonic sensor continuously measures the bin’s fill level and updates the Blynk cloud.
- Detection: The IR sensor detects waste presence and distance, for accurate monitoring.
- Control: The servo motor’s angle can be controlled through the Blynk app, managing bin lid operations.
- Alerts: When the bin is full, the ultrasonic sensor send an alert in the Blynk app, notifying the municipal team to empty the bin.
Benefits for Municipalities:
- Real-time Monitoring: Municipal workers can monitor bin levels and waste detection in real-time via the Blynk app.
- Remote Control: Adjust the servo motor and manage bin operations from anywhere.
- Efficient Waste Collection: Timely alerts ensure bins are emptied before they overflow, maintaining public cleanliness.
- Data Analysis: Historical data helps optimize waste collection schedules and routes.
The Smart Samaj Paricharak, integrated with Blynk 2.0, offers a comprehensive solution for smart waste management, enhancing operational efficiency and cleanliness in urban areas.
#define BLYNK_TEMPLATE_ID "Template ID"
#define BLYNK_TEMPLATE_NAME "Template ID"
#define BLYNK_AUTH_TOKEN "Auth Token"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "**********";
char pass[] = "**********";
BlynkTimer timer;
#define echoPin D5
#define trigPin D6
#include<Servo.h>
Servo servo;
long duration;
int distance;
int binLevel=0;
void SMESensor()
{
int ir=digitalRead(D7);
if(ir==HIGH)
{
servo.write(90);
for(int i=0; i<50; i++)
{
Blynk.virtualWrite(V2, 90);
ultrasonic();
delay(100);
}
servo.write(0);
Blynk.virtualWrite(V2, 0);
}
if(ir==LOW)
{
ultrasonic();
delay(200);
}
}
void ultrasonic()
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2; //formula to calculate the distance for ultrasonic sensor
binLevel=map(distance, 21, 0, 0,100); // ADJUST BIN HEIGHT HERE
Blynk.virtualWrite(V0, distance);
Blynk.virtualWrite(V1, binLevel);
}
void setup()
{
Serial.begin(9600);
servo.attach(D2);
pinMode(D7, INPUT);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Blynk.begin(auth, ssid, pass);
delay(2000);
timer.setInterval(1000L, SMESensor);
}
void loop()
{
Blynk.run();
timer.run();
}