Introduction
In this article, we will explain how to create a Smart Dustbin using a few components like a 16×2 LCD, an ultrasonic sensor, a Sim800l module, a NEO-6m module, and the ESP8266 microcontroller.
This integration of hardware and software will enable us to monitor the status of the dustbin, Find out the Level of waste management, and provide real-time data for efficient collection and disposal.
Components Needed
- ESP8266 Controller
- GSM Module
- 16×2 LCD Display with I2C
- GPS Module
- Ultrasonic Sensor
- Wire
- Zero PCB
- 5V power supply
Component
ESP8266
-
- VCC: Connected to the 5V power supply
- GND: Connected to the ground (GND)
LCD Display
-
- SDA: Connected to the SDA pin of the ESP8266 (D2)
- SCL: Connected to the SCL pin of the ESP8266 (D1)
- VCC: Connected to the 5V power supply (Vin)
- GND: Connected to the ground (GND)
Ultrasonic Sensor
-
- Trig: Connected to a digital pin (D6) of the ESP8266
- Echo: Connected to a digital pin (D5) of the ESP8266
- VCC: Connected to the 5V power supply
- GND: Connected to the ground (GND)
GSM Module
-
- RX: Connected to the TX pin (D4) of the ESP8266
- TX: Connected to the RX pin (D3) of the ESP8266
- VCC: Connected to the 5V power supply
- GND: Connected to the ground (GND)
Circuit Diagram
Source Code
LiquidCrystal_I2C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
#include <Wire.h> #include <LiquidCrystal_I2C.h> #include <SoftwareSerial.h> LiquidCrystal_I2C lcd(0x27, 16, 2); SoftwareSerial gsmSerial(D4, D3); const int trigPin = D6; const int echoPin = D5; const int threshold = 75; String phoneNumber = "+9188305848xx"; void setup() { lcd.begin(16, 2); lcd.backlight(); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); gsmSerial.begin(9600); delay(1000); lcd.clear(); lcd.print("Smart Dustbin"); lcd.setCursor(0, 1); lcd.print("Initializing..."); delay(2000); } void loop() { long duration, distance; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration / 2) / 29.1; int fillLevel = map(distance, 0, 100, 100, 0); lcd.clear(); lcd.print("Fill Level: "); lcd.print(fillLevel); lcd.print("%"); if (fillLevel >= threshold) { sendSMSAlert(); } delay(2000); } void sendSMSAlert() { lcd.clear(); lcd.print("Sending Alert..."); gsmSerial.println("AT+CPIN=<SIM_PIN>"); delay(2000); gsmSerial.println("AT+CMGF=1"); delay(1000); gsmSerial.print("AT+CMGS=\""); gsmSerial.print(phoneNumber); gsmSerial.println("\""); delay(1000); String message = "Dustbin Full! Please Empty."; gsmSerial.print(message); delay(1000); gsmSerial.write(0x1A); delay(2000); lcd.clear(); lcd.print("Alert Sent!"); delay(2000); } |
Video
Conclusion
This smart solution allows for real-time monitoring of the dustbin’s fill level, sends alerts to the appropriate authorities, and provides location data for efficient waste management.
More Project
Great work boss. I really love the article
.please the GPS was not included in the code