amc:ss2025:group-t:start
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
amc:ss2025:group-t:start [2025/07/29 15:11] – emir-talha.fidan | amc: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 ====== | ||
+ | '' | ||
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_, | + | |
- | * 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 ====== | ||
+ | '' | ||
==== 2.1. Hardware Components ==== | ==== 2.1. Hardware Components ==== | ||
Line 21: | Line 27: | ||
{{: | {{: | ||
+ | |||
+ | ---- | ||
==== 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 ====== | ||
+ | '' | ||
==== 3.1. Breadboard Layout ==== | ==== 3.1. Breadboard Layout ==== | ||
Line 38: | Line 49: | ||
* **VL53L0X**: | * **VL53L0X**: | ||
* **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**/ | ||
+ | * 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. | ||
{{: | {{: | ||
- | ====== 4. Arduino IDE Firmware ====== | + | ---- |
+ | |||
+ | ====== 4. Arduino IDE Firmware ====== | ||
+ | '' | ||
Below is the main sketch. **Please replace** `YOUR_SSID`, | Below is the main sketch. **Please replace** `YOUR_SSID`, | ||
Line 64: | Line 82: | ||
const char* password | const char* password | ||
// Node-RED endpoint | // Node-RED endpoint | ||
- | const char* alert_url | + | const char* alert_url |
// Telegram | // Telegram | ||
Line 150: | Line 168: | ||
// ... (sendWarning, | // ... (sendWarning, | ||
</ | </ | ||
+ | |||
---- | ---- | ||
+ | |||
===== Code Summary ===== | ===== Code Summary ===== | ||
- | | + | 1. **Initialization (setup)** |
- | * Serial debug + < | + | - Serial debug +< |
- | * < | + | - < |
- | * Connect to Wi-Fi (SSID/ | + | - Connect to Wi-Fi (SSID/ |
- | * Initialize HTTPClient & Telegram bot | + | - Initialize HTTPClient & Telegram bot |
- | * On failure (sensor or Wi-Fi), print/ | + | - On failure (sensor or Wi-Fi), print/ |
+ | |||
+ | 2. **Main Loop** | ||
+ | - Ranging measurement via < | ||
+ | - 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 (< | ||
+ | - Delay to regulate loop frequency | ||
- | 2. **Main Loop** | ||
- | * Ranging measurement via < | ||
- | * 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 interval (e.g., 30 s) | ||
- | * Telegram: one-time warning on threshold cross; optional periodic updates | ||
- | * Handle Telegram commands (< | ||
- | * Delay to regulate loop frequency | ||
---- | ---- | ||
- | ====== 5. Node-RED Flow ====== | + | |
- | Our Node-RED instance | + | ====== 5. Node-RED Flow ====== |
+ | '' | ||
+ | Our Node-RED instance handles incoming HTTP POSTs at `/ | ||
* Parses JSON (distance, fill_percentage) | * Parses JSON (distance, fill_percentage) | ||
Line 182: | Line 207: | ||
* Dashboard: updates a gauge node | * Dashboard: updates a gauge node | ||
- | {{ : | + | {{: |
+ | ---- | ||
- | ====== 6. Telegram Bot Configuration ====== | + | ====== 6. Telegram Bot Configuration ====== |
+ | '' | ||
* Create bot with BotFather → get `BOT_TOKEN`. | * Create bot with BotFather → get `BOT_TOKEN`. | ||
* Invite to your group/ | * Invite to your group/ | ||
* Grant it message-reading rights. | * Grant it message-reading rights. | ||
- | * t.me/ | + | * [[http://t.me/ |
- | * t.me/ | + | * [[http://t.me/ |
- | {{ : | + | |
+ | {{: | ||
Line 198: | Line 226: | ||
* /status - Get current bin fill | * /status - Get current bin fill | ||
* /stop - Stop regular update messages | * /stop - Stop regular update messages | ||
- | */ | + | * / |
- | */help - Show this message | + | * /help - Show this message |
- | ====== 7. Results ====== | + | ---- |
+ | |||
+ | ====== 7. Results ====== | ||
+ | '' | ||
* **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%. | ||
Line 222: | Line 253: | ||
* Node-RED receives JSON payload: | * Node-RED receives JSON payload: | ||
< | < | ||
- | | + | * 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. | + | |
+ | ---- | ||
+ | {{ : | ||
+ | {{: | ||
{{: | {{: | ||
- | {{ : | + | ---- |
- | ====== 8. Discussion & Lessons Learned ====== | + | ====== 8. Discussion & Lessons Learned ====== |
+ | '' | ||
* **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**: | * **Connectivity**: | ||
Line 251: | Line 285: | ||
* Deep-sleep between measurements for battery operation. | * Deep-sleep between measurements for battery operation. | ||
- | * **Feature | + | * **Future |
+ | * 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. | * Load cell weight sensor for complementary metrics. | ||
* Audible buzzer for local full-bin alarms. | * Audible buzzer for local full-bin alarms. | ||
* Expanded Node-RED flows: email notifications, | * Expanded Node-RED flows: email notifications, | ||
* Interactive Telegram bot commands for on-demand status. | * Interactive Telegram bot commands for on-demand status. | ||
+ | |||
---- | ---- | ||
- | ====== 9. Conclusion ====== | + | ====== 9. Conclusion ====== |
+ | '' | ||
- | This project provides a low-cost IoT solution for bin monitoring today, solar power, enclosure, and analytics—for robust outdoor deployment tomorrow. | + | Deploying multiple units in smart buildings or campuses enables optimized waste collection scheduling, reduces overflow incidents, and contributes to smarter urban infrastructure by leveraging |
- | ====== 10. References ====== | + | ---- |
+ | |||
+ | ====== 10. References ====== | ||
+ | '' | ||
* **STMicroelectronics VL53L0X Datasheet** | * **STMicroelectronics VL53L0X Datasheet** | ||
* **U8g2 SH1106 OLED driver** – https:// | * **U8g2 SH1106 OLED driver** – https:// | ||
* **UniversalTelegramBot Library** – https:// | * **UniversalTelegramBot Library** – https:// | ||
* **Node-RED Documentation** – https:// | * **Node-RED Documentation** – https:// | ||
+ | |||
+ | |||
+ | {{youtube> | ||
amc/ss2025/group-t/start.1753794689.txt.gz · Last modified: 2025/07/29 15:11 by emir-talha.fidan