User Tools

Site Tools


amc:ss2025:group-t:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
amc:ss2025:group-t:start [2025/07/29 14:07] – created emir-talha.fidanamc:ss2025:group-t:start [2025/07/29 21:59] (current) emir-talha.fidan
Line 1: Line 1:
-====== 1. Introduction ======+====== Smart Trash Bin Monitoring System ====== 
 + 
 +**Emir Talha Fidan (32780)** 
 +**Ilker Bakikol (31706)** 
 + 
 +====== 1. Introduction ======   
 +''By 32780''
 Every year, inefficient waste-collection leads to unnecessary pickups, added CO₂ emissions, and overflowing public bins. Our **Smart Trash-Bin Fill-Level Monitoring System** uses a VL53L0X Time-of-Flight sensor mounted inside a 41 × 35 × 60 cm³ bin to measure the fill height, displays the percentage full on an SH1106 OLED, and—when a user-configurable threshold is exceeded—sends alerts via a Telegram bot.   Every year, inefficient waste-collection leads to unnecessary pickups, added CO₂ emissions, and overflowing public bins. Our **Smart Trash-Bin Fill-Level Monitoring System** uses a VL53L0X Time-of-Flight sensor mounted inside a 41 × 35 × 60 cm³ bin to measure the fill height, displays the percentage full on an SH1106 OLED, and—when a user-configurable threshold is exceeded—sends alerts via a Telegram bot.  
  
-_In future iterations_, we plan to support fully outdoor operation by adding: +
-  * A GPS module (for geo-tagged alerts)   +
-  * A solar-rechargeable Li-Po power supply (with charge controller)   +
-  * A weatherproof 3D-printed enclosure  +
  
 This document walks through each step—hardware assembly (breadboard layout), Arduino IDE firmware, Node-RED flow, Telegram-bot config, and ESP32 simulation—so you can reproduce and extend the system today, then evolve it for outdoor use tomorrow. This document walks through each step—hardware assembly (breadboard layout), Arduino IDE firmware, Node-RED flow, Telegram-bot config, and ESP32 simulation—so you can reproduce and extend the system today, then evolve it for outdoor use tomorrow.
  
-====== 2. Materials & System Overview ======+---- 
 + 
 +====== 2. Materials & System Overview ======  
 +''By 32780''
  
 ==== 2.1. Hardware Components ==== ==== 2.1. Hardware Components ====
Line 21: Line 27:
  
 {{:amc:ss2025:group-t:pxl_20250729_115627332.jpg?400|}} {{:amc:ss2025:group-t:pxl_20250729_115627332.jpg?400|}}
 +
 +----
  
 ==== 2.2. Software Components ==== ==== 2.2. Software Components ====
Line 32: Line 40:
   * **Telegram Bot** (“TrashAlertBot”) configured with token `xxxx:YYYY` and chat ID    * **Telegram Bot** (“TrashAlertBot”) configured with token `xxxx:YYYY` and chat ID 
  
-====== 3. Hardware Assembly ======+---- 
 + 
 +====== 3. Hardware Assembly ======  
 +''By 32780''
  
 ==== 3.1. Breadboard Layout ==== ==== 3.1. Breadboard Layout ====
Line 38: Line 49:
   * **VL53L0X**: VCC ← 3.3 V (ESP32 3V3 pin), GND ← GND, SDA/SCL as belove.     * **VL53L0X**: VCC ← 3.3 V (ESP32 3V3 pin), GND ← GND, SDA/SCL as belove.  
   * **OLED (SH1106)**: VCC ← 3.3 V, GND ← GND, SDA/SCL as belove.     * **OLED (SH1106)**: VCC ← 3.3 V, GND ← GND, SDA/SCL as belove.  
-  * **LED**: Anode ← GPIO 2 (with 220 Ω resistor), Cathode ← GND.   +  * **LED**: Anode ← GPIO 2 (with 220 Ω resistor), Cathode ← GND.  
 +    *All I²C peripherals (ToF sensor, OLED) share ESP32’s **SDA**/**SCL** pins and 3.3 V/GND rails. 
 +    * Secure ToF sensor at bin’s top interior, facing directly downward without obstruction. 
 +    * Mount OLED on exterior lid for clear visibility. 
 +    * Use onboard LED—no additional external LED wiring. 
 +    * ESP32 uses internal antenna for Wi-Fi; no extra antennas needed.
 {{:amc:ss2025:group-t:wokwi_arduino.png?400|}} {{:amc:ss2025:group-t:wokwi_arduino.png?400|}}
  
-====== 4. Arduino IDE Firmware ======+---- 
 + 
 +====== 4. Arduino IDE Firmware ======  
 +''By 32780''
 Below is the main sketch. **Please replace** `YOUR_SSID`, `YOUR_PASS`, `NODE_RED_URL`, and `BOT_TOKEN` with your actual credentials. Below is the main sketch. **Please replace** `YOUR_SSID`, `YOUR_PASS`, `NODE_RED_URL`, and `BOT_TOKEN` with your actual credentials.
  
Line 151: Line 169:
 </code> </code>
  
-====== 5. Node-RED Flow ====== + 
-Our Node-RED instance (192.168.10.50:1880) handles incoming HTTP POSTs at `/bin-alert` and:+---- 
 + 
 + 
 +===== Code Summary ===== 
 + 
 +1. **Initialization (setup)** 
 +   - Serial debug +<code>Wire.begin()</code>for I²C 
 +   - <code>lox.begin()</code> for ToF sensor and OLED splash 
 +   - Connect to Wi-Fi (SSID/password) 
 +   - Initialize HTTPClient & Telegram bot 
 +   - On failure (sensor or Wi-Fi), print/display error 
 + 
 +2. **Main Loop** 
 +   - Ranging measurement via <code>lox.rangingTest()</code> 
 +   - If valid, calculate   
 +     `fill % = ((BIN_HEIGHT_CM − distance_cm) / BIN_HEIGHT_CM) × 100` 
 +   - Update OLED: distance, fill %, bar graph 
 +   - LED Alert: ON if ≥ 80 %, OFF if below (with hysteresis) 
 +   - HTTP POST to Node-RED every 30 s 
 +   - Telegram: one-time warning on threshold cross; optional periodic updates 
 +   - Handle Telegram commands (<code>/start</code>,<code>/status</code>,<code>/stop</code>, etc.) 
 +   - Delay to regulate loop frequency 
 + 
 + 
 + 
 +---- 
 + 
 + 
 + 
 +====== 5. Node-RED Flow ======  
 +''By 32780'' 
 +Our Node-RED instance handles incoming HTTP POSTs at `/bin-alert` and:
  
   * Parses JSON (distance, fill_percentage)     * Parses JSON (distance, fill_percentage)  
Line 158: Line 207:
   * Dashboard: updates a gauge node     * Dashboard: updates a gauge node  
  
-{{ :amc:ss2025:group-t:screenshot_2025-07-29_132917.png?400 |}} +{{:amc:ss2025:group-t:screenshot_2025-07-29_132917.png?500|}} 
-====== 6. Telegram Bot Configuration ======+ 
 +---- 
 + 
 +====== 6. Telegram Bot Configuration ======  
 +''By 32780''
   * Create bot with BotFather → get `BOT_TOKEN`.     * Create bot with BotFather → get `BOT_TOKEN`.  
   * Invite to your group/channel → note the `chat_id`.     * Invite to your group/channel → note the `chat_id`.  
   * Grant it message-reading rights.     * Grant it message-reading rights.  
 +  * [[http://t.me/Trashbinalertbot|External Link]] Trash Bin alert bot
 +  * [[http://t.me/klajf0239j2390d|External Link]] Trash Bin Channel
 +  
 +{{:amc:ss2025:group-t:telegram_page.png?500|}}
  
-{{ :amc:ss2025:group-t:telegram_page.png?400 |}} 
  
 **Commands**: **Commands**:
Line 170: Line 226:
   * /status - Get current bin fill   * /status - Get current bin fill
   * /stop - Stop regular update messages   * /stop - Stop regular update messages
-  */startupdates - Resume regular updates +  * /startupdates - Resume regular updates 
-  */help - Show this message+  * /help - Show this message
  
-====== 7. Results ======+ 
 +---- 
 + 
 +====== 7. Results ======  
 +''By 31706''
   * **OLED display**: real-time distance & fill bar (tested up to 85%).     * **OLED display**: real-time distance & fill bar (tested up to 85%).  
   * **LED**: lights when fill ≥ 80%.     * **LED**: lights when fill ≥ 80%.  
   * **Telegram**: immediate alert with bin status.     * **Telegram**: immediate alert with bin status.  
   * **Node-RED dashboard**: gauge plotting fill percentage.     * **Node-RED dashboard**: gauge plotting fill percentage.  
 +
 +
 +
 +
 +  * **Distance & Fill Readout**  
 +    - OLED updates in real time:  
 +      * “Distance: 21.8 cm”  
 +      * “Fill: 63 %”  
 +    - Fill percentage = ((60 cm − measured_distance) / 60 cm) × 100 %.
 +
 +  * **Visual & Remote Alerts**  
 +    - At ≥ 80 % capacity (trash within ~12 cm of lid):  
 +      * Onboard LED lights (e.g., red).  
 +      * Node-RED receives JSON payload:  
 +        <code>{"bin":"Kitchen","fill":85,"status":"Nearly Full"}</code>  
 +       * Telegram message: “⚠ Alert: The kitchen trash bin is 85 % full. Please empty it soon.”  
 +     - Regular status updates (e.g., every 30 s) are also sent.  
 +     - On sensor error, OLED shows “Sensor error” and that cycle’s data is skipped; an error flag can be forwarded.
 +
 +
 +----
 +{{ :amc:ss2025:group-t:screenshot_2025-07-29_160455.png?200|}}
 +{{:amc:ss2025:group-t:pxl_20250729_093131148.jpg?200 |}}
 {{:amc:ss2025:group-t:pxl_20250729_093110023.jpg?200|}} {{:amc:ss2025:group-t:pxl_20250729_093110023.jpg?200|}}
-{{ :amc:ss2025:group-t:pxl_20250729_093131148.jpg?200|}}+----
  
-====== 8. Discussion & Lessons Learned ======+====== 8. Discussion & Lessons Learned ======  
 +''By 31706''
   * **Portable power**: using a USB powerbank delivers ~8 hrs runtime; for longer operation, a solar-powered Li-Po pack is recommended.     * **Portable power**: using a USB powerbank delivers ~8 hrs runtime; for longer operation, a solar-powered Li-Po pack is recommended.  
   * **Connectivity**: outdoors Wi-Fi drops; consider fallback via GSM/LTE or LoRaWAN.     * **Connectivity**: outdoors Wi-Fi drops; consider fallback via GSM/LTE or LoRaWAN.  
Line 191: Line 275:
   * **Scalability**: mesh-network multiple bins to central server for fleet management.     * **Scalability**: mesh-network multiple bins to central server for fleet management.  
  
-====== 9Conclusion ====== +* **Limitations**   
-This project provides a low-cost IoT solution for bin monitoring today, and a clear roadmap—GPS, solar power, enclosure, analytics—for robust outdoor deployment tomorrow.+    * Single-point ToF measurement may miss uneven trash piles  
 +    * Reliance on Wi-Fi: network outages disrupt remote updates.   
 +    * Continuous power requirement; no battery or power-saving implemented.
  
-====== 10. References ======+  * **Improvements**   
 +    * Multiple sensors or servo-mounted scanning for holistic fill measurement.   
 +    * Offline data buffering and reconnection logic for network resilience.   
 +    * Deep-sleep between measurements for battery operation. 
 + 
 +  * **Future Enhancements**   
 +    * A GPS module (for geo-tagged alerts)   
 +    * A solar-rechargeable Li-Po power supply (with charge controller)   
 +    * A weatherproof 3D-printed enclosure    
 +    * Load cell weight sensor for complementary metrics.   
 +    * Audible buzzer for local full-bin alarms.   
 +    * Expanded Node-RED flows: email notifications, historical logging/analytics.   
 +    * Interactive Telegram bot commands for on-demand status. 
 + 
 +---- 
 + 
 +====== 9. Conclusion ======  
 +''By 31706'' 
 + 
 +Deploying multiple units in smart buildings or campuses enables optimized waste collection scheduling, reduces overflow incidents, and contributes to smarter urban infrastructure by leveraging low-cost sensors and Wi-Fi connectivity. This project demonstrates a practical IoT solution for everyday problems, with clear pathways for scaling and enhancement. 
 + 
 +---- 
 + 
 +====== 10. References ======  
 +''By 31706''
   * **STMicroelectronics VL53L0X Datasheet**     * **STMicroelectronics VL53L0X Datasheet**  
   * **U8g2 SH1106 OLED driver** – https://github.com/olikraus/u8g2     * **U8g2 SH1106 OLED driver** – https://github.com/olikraus/u8g2  
   * **UniversalTelegramBot Library** – https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot     * **UniversalTelegramBot Library** – https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot  
   * **Node-RED Documentation** – https://nodered.org/docs/     * **Node-RED Documentation** – https://nodered.org/docs/  
 +
 +
 +{{youtube>2MH0t_iPs9k?}}
  
amc/ss2025/group-t/start.1753790876.txt.gz · Last modified: 2025/07/29 14:07 by emir-talha.fidan