This shows you the differences between two versions of the page.
pm:prj2025:ajipa:denis.iurciuc [2025/05/25 17:20] denis.iurciuc [Concluzii] |
pm:prj2025:ajipa:denis.iurciuc [2025/05/30 08:13] (current) denis.iurciuc [Hardware Design] |
||
---|---|---|---|
Line 19: | Line 19: | ||
3 bătăi → mod schimbare culoare | Alte bătăi → schimbă culoarea | 3 bătăi → mod schimbare culoare | Alte bătăi → schimbă culoarea | ||
- | **LCD:** Afișează ora și temperatura | + | **LCD:** Afișează ora și luminozitatea lampei |
- | + | ||
- | ** Animații de culoare: ** | + | |
- | Vor fi implementate diferite animații pentru lampă, acestea vor schimbate prin intermediul a două bătăi consecutive din palme | + | |
+ | **Aprindere automată pe bază de lumină:** | ||
+ | Lampa se aprinde automat când fotorezistorul detectează întuneric. | ||
===== Hardware Design ===== | ===== Hardware Design ===== | ||
Line 52: | Line 50: | ||
- **Fire Mama-Mama, Tata-Tata, Mama-Tata** – Pentru conectarea componentelor | - **Fire Mama-Mama, Tata-Tata, Mama-Tata** – Pentru conectarea componentelor | ||
+ | |||
+ | - **Fotorezistor** – Lampa se aprinde automat cand e intuneric | ||
=== Schema === | === Schema === | ||
Line 66: | Line 66: | ||
| D6 | WS2812B LED Strip | Semnal de control LED-uri | | | D6 | WS2812B LED Strip | Semnal de control LED-uri | | ||
| D5 | KY-038 | Semnal sunet | | | D5 | KY-038 | Semnal sunet | | ||
- | | A1 | LM35D | Temperatură | | + | | A1 | Fotorezistor | Analiza sursa lumina | |
| A4 (SDA) | LCD I2C | Comunicare date LCD | | | A4 (SDA) | LCD I2C | Comunicare date LCD | | ||
| A5 (SCL) | LCD I2C | Comunicare ceas LCD | | | A5 (SCL) | LCD I2C | Comunicare ceas LCD | | ||
| 5V, GND | Toate modulele | Alimentare | | | 5V, GND | Toate modulele | Alimentare | | ||
- | |||
- | |||
- | === BOM === | ||
- | | Componentă | Datasheet | Link cumpărare | | ||
- | | **HC-SR04** | https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf | https://sigmanortec.ro/Senzor-ultrasunete-HC-SR04-p125423514 | | ||
- | | **KY-038 Microfon** | https://sensorkit.joy-it.net/en/sensors/ky-038 | https://sigmanortec.ro/Modul-microfon-senzor-sunet-p126025149 | | ||
- | | **LM35D** | https://www.ti.com/lit/ds/symlink/lm35.pdf | https://www.optimusdigital.ro/ro/senzori/1469-senzor-de-temperatura-analogic-lm35d-to-92.html?search_query=LM35D&results=1 | | ||
- | | **DS1302 RTC** | https://www.analog.com/media/en/technical-documentation/data-sheets/ds1302.pdf | https://www.optimusdigital.ro/ro/toate-produsele/12988-modul-ceas-in-timp-real-ds1302-fara-baterie.html?search_query=ds1302&results=1 | | ||
- | | **Banda LED WS2812** | https://cdn-shop.adafruit.com/datasheets/WS2812.pdf | https://sigmanortec.ro/Banda-LED-adresabila-RGB-WS2812-60led-m-IP67-10cm-p166125661 | | ||
- | | ** LCD 1602 + I2C Module** | https://www.waveshare.com/datasheet/LCD_en_PDF/LCD1602.pdf | https://www.waveshare.com/datasheet/LCD_en_PDF/LCD1602.pdf | | ||
- | | **Arduino Nano (ATmega328)**| https://docs.arduino.cc/resources/datasheets/A000005-datasheet.pdf | https://sigmanortec.ro/placa-dezvoltare-compatibila-arduino-nano-v30-atmega328p-au-ft232 | | ||
- | | **Rezistență 330Ω** | https://www.vishay.com/docs/20035/dcrcwe3.pdf | https://sigmanortec.ro/kit-rezistori-30-valori-20-bucati | | ||
- | | **Sursă alimentare 5V 2A** | https://www.farnell.com/datasheets/1701294.pdf | - | | ||
- | | **Breadboard 400** | https://www.farnell.com/datasheets/2622308.pdf | https://sigmanortec.ro/Breadboard-400-puncte-p129872825 | | ||
- | | **Fire Mama-Tata etc.** | - | https://www.optimusdigital.ro/ro/fire-fire-mufate/92-fire-colorate-mama-tata-40p.html?search_query=fire+&results=428 | | ||
=== Consum energie === | === Consum energie === | ||
Line 98: | Line 83: | ||
* **HC-SR04** (senzor ultrasonic): ~15 mA | * **HC-SR04** (senzor ultrasonic): ~15 mA | ||
* **KY-038** (microfon): ~3–5 mA | * **KY-038** (microfon): ~3–5 mA | ||
- | * **LM35D** (senzor temperatură): ~0.1–0.2 mA | + | * **Fotorezistor**: ~0.1–0.2 mA |
* **DS1302** (ceas RTC): ~1–2 mA (alimentat cu baterie CR2032) | * **DS1302** (ceas RTC): ~1–2 mA (alimentat cu baterie CR2032) | ||
* **LCD 1602 cu I2C**: ~20 mA | * **LCD 1602 cu I2C**: ~20 mA | ||
Line 110: | Line 95: | ||
- | {{:pm:prj2025:ajipa:5271496422656700834_1_.jpg?500|}} | + | === BOM === |
+ | | Componentă | Datasheet | Link cumpărare | | ||
+ | | **HC-SR04** | https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf | https://sigmanortec.ro/Senzor-ultrasunete-HC-SR04-p125423514 | | ||
+ | | **KY-038 Microfon** | https://sensorkit.joy-it.net/en/sensors/ky-038 | https://sigmanortec.ro/Modul-microfon-senzor-sunet-p126025149 | | ||
+ | | **LM35D** | https://www.ti.com/lit/ds/symlink/lm35.pdf | https://www.optimusdigital.ro/ro/senzori/1469-senzor-de-temperatura-analogic-lm35d-to-92.html?search_query=LM35D&results=1 | | ||
+ | | **DS1302 RTC** | https://www.analog.com/media/en/technical-documentation/data-sheets/ds1302.pdf | https://www.optimusdigital.ro/ro/toate-produsele/12988-modul-ceas-in-timp-real-ds1302-fara-baterie.html?search_query=ds1302&results=1 | | ||
+ | | **Banda LED WS2812** | https://cdn-shop.adafruit.com/datasheets/WS2812.pdf | https://sigmanortec.ro/Banda-LED-adresabila-RGB-WS2812-60led-m-IP67-10cm-p166125661 | | ||
+ | | ** LCD 1602 + I2C Module** | https://www.waveshare.com/datasheet/LCD_en_PDF/LCD1602.pdf | https://www.waveshare.com/datasheet/LCD_en_PDF/LCD1602.pdf | | ||
+ | | **Arduino Nano (ATmega328)**| https://docs.arduino.cc/resources/datasheets/A000005-datasheet.pdf | https://sigmanortec.ro/placa-dezvoltare-compatibila-arduino-nano-v30-atmega328p-au-ft232 | | ||
+ | | **Rezistență 330Ω** | https://www.vishay.com/docs/20035/dcrcwe3.pdf | https://sigmanortec.ro/kit-rezistori-30-valori-20-bucati | | ||
+ | | **Sursă alimentare 5V 2A** | https://www.farnell.com/datasheets/1701294.pdf | - | | ||
+ | | **Breadboard 400** | https://www.farnell.com/datasheets/2622308.pdf | https://sigmanortec.ro/Breadboard-400-puncte-p129872825 | | ||
+ | | **Fire Mama-Tata etc.** | - | https://www.optimusdigital.ro/ro/fire-fire-mufate/92-fire-colorate-mama-tata-40p.html?search_query=fire+&results=428 | | ||
+ | |||
+ | |||
+ | {{:pm:prj2025:ajipa:5271496422656700834_1_.jpg?400|}} | ||
+ | {{:pm:prj2025:ajipa:smart_lamp33.jpeg?400|}} | ||
===== Software Design ===== | ===== Software Design ===== | ||
Line 156: | Line 157: | ||
| Timere hardware (Lab 3) | Timer1 în CTC ⇒ timeout color-mode (+ PWM fade) | | | Timere hardware (Lab 3) | Timer1 în CTC ⇒ timeout color-mode (+ PWM fade) | | ||
| Întreruperi externe | PCINT2 pe microfon ⇒ detectare front sunet | | | Întreruperi externe | PCINT2 pe microfon ⇒ detectare front sunet | | ||
- | | ADC + senzori analogici | LM35D pe A1 | | + | | ADC + senzori analogici | FOtorezistor pe A1 | |
| I²C | LCD pe bus comun, adresare multi-device | | | I²C | LCD pe bus comun, adresare multi-device | | ||
| GPIO (digital I/O) | HC-SR04, KY-038, WS2812B, DS1302| | | GPIO (digital I/O) | HC-SR04, KY-038, WS2812B, DS1302| | ||
Line 163: | Line 164: | ||
^ Senzor ^ Metodă calibrare ^ Precizie obținută / Observații ^ | ^ Senzor ^ Metodă calibrare ^ Precizie obținută / Observații ^ | ||
| **HC-SR04** | • Ignor semnalele > 40 cm ⇒ domeniu de lucru 5–40 cm stabil. | ±0.5 cm între 5 cm și 40 cm | | | **HC-SR04** | • Ignor semnalele > 40 cm ⇒ domeniu de lucru 5–40 cm stabil. | ±0.5 cm între 5 cm și 40 cm | | ||
- | | **LM35D** | • Conversie ADC (Vref = 5 V) → 10 mV / °C | eroare tipic ±1…2 °C (15–35 °C) | | ||
| **KY-038** | • Prag hardware reglat cu şurubelniţa pe trimerul modulului până la ≈3× nivel zgomot ambiental. | false-positive ≈ 0 în cameră liniștită; clapuri detectate de la ~1 m | | | **KY-038** | • Prag hardware reglat cu şurubelniţa pe trimerul modulului până la ≈3× nivel zgomot ambiental. | false-positive ≈ 0 în cameră liniștită; clapuri detectate de la ~1 m | | ||
Line 208: | Line 208: | ||
* **Timer hardware** pentru inactivitate în loc de `millis()` ⇒ încărcare CPU redusă. | * **Timer hardware** pentru inactivitate în loc de `millis()` ⇒ încărcare CPU redusă. | ||
- | * **SmoothSetBrightness()** – tranziţie PWM în paşi mici, fără flicker vizibil. | + | * **SmoothSetBrightness()** – tranziţie în paşi mici, fără flicker vizibil. |
==== Schelet ==== | ==== Schelet ==== | ||
Line 226: | Line 226: | ||
* **Control gesturi** perfect funcțional: timp mediu de reacție ≈ 120 ms. | * **Control gesturi** perfect funcțional: timp mediu de reacție ≈ 120 ms. | ||
* **Detectare clapuri** robustă: 0 declanșări false în test 10 min / cameră liniștită; clap detectat la ≈1 m. | * **Detectare clapuri** robustă: 0 declanșări false în test 10 min / cameră liniștită; clap detectat la ≈1 m. | ||
- | * **Reglare luminozitate** lină 0–255 fără flicker vizibil. | + | * **Reglare luminozitate** 10–255 fără flicker vizibil. |
- | * **Mod ciclu culori**: 7 palete parcurse în 35 s; schimb instant la o singură bătaie. | + | * **Mod ciclu culori**: 7 culori; schimb instant la o singură bătaie. |
* **Afișaj LCD** actualizat la 1 s fără glitch-uri. | * **Afișaj LCD** actualizat la 1 s fără glitch-uri. | ||
* Consumul total la **white full-bright**: ~1.68 A; idle (LED off) ~12 mA. | * Consumul total la **white full-bright**: ~1.68 A; idle (LED off) ~12 mA. | ||
Line 246: | Line 246: | ||
===== Download ===== | ===== Download ===== | ||
- | <note warning> | + | * [[https://github.com/Trelow/Smart_Lamp|GitHub – Cod sursă Smart Lamp]] |
- | O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectului: surse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-). | + | |
- | + | ||
- | Fişierele se încarcă pe wiki folosind facilitatea **Add Images or other files**. Namespace-ul în care se încarcă fişierele este de tipul **:pm:prj20??:c?** sau **:pm:prj20??:c?:nume_student** (dacă este cazul). **Exemplu:** Dumitru Alin, 331CC -> **:pm:prj2009:cc:dumitru_alin**. | + | |
- | </note> | + | |
===== Jurnal ===== | ===== Jurnal ===== | ||
Line 260: | Line 255: | ||
| 12 mai | Integrare FastLED + reglare luminozitate | ✅ | | | 12 mai | Integrare FastLED + reglare luminozitate | ✅ | | ||
| 16 mai | Afișaj LCD + RTC (ora + temperatură) | ✅ | | | 16 mai | Afișaj LCD + RTC (ora + temperatură) | ✅ | | ||
- | | 24 mai | Lucrarea la animații pentru lampa + efecte fade | ✅ | | + | | 29 mai | Adaugare fotorezistor | ✅ | |
===== Bibliografie/Resurse ===== | ===== Bibliografie/Resurse ===== | ||
- | * [[https://github.com/Trelow/Smart_Lamp|GitHub – Cod sursă Smart Lamp]] | ||
* [[https://www.youtube.com/watch?v=rxGVqdD0l4w|YouTube video – Demo Smart Lamp]] | * [[https://www.youtube.com/watch?v=rxGVqdD0l4w|YouTube video – Demo Smart Lamp]] | ||