This shows you the differences between two versions of the page.
pm:prj2024:vstoica:dragos.coscodan [2024/05/27 02:39] dragos.coscodan [Descrierea codului aplicaţiei:] |
pm:prj2024:vstoica:dragos.coscodan [2024/05/30 23:53] (current) dragos.coscodan [Rezultate Obţinute] |
||
---|---|---|---|
Line 153: | Line 153: | ||
**Biblioteci utilizate:** | **Biblioteci utilizate:** | ||
- | Arduino.h | ||
WiFi.h | WiFi.h | ||
Adafruit_Sensor.h | Adafruit_Sensor.h | ||
Line 161: | Line 160: | ||
addons/TokenHelper.h | addons/TokenHelper.h | ||
IRremote.h | IRremote.h | ||
+ | SPI.h | ||
+ | MFRC522.h | ||
+ | EEPROM.h | ||
</note> | </note> | ||
Line 193: | Line 195: | ||
{ | { | ||
mainBox.light_intensity = fbdo_light_intensity.intData(); | mainBox.light_intensity = fbdo_light_intensity.intData(); | ||
- | } | + | } |
- | | + | |
} | } | ||
Line 218: | Line 219: | ||
== Functie stingere/aprindere lumina batand din palme == | == Functie stingere/aprindere lumina batand din palme == | ||
+ | Functia verifica daca au fost exact 2 batai intr-un anumit interval de timp | ||
+ | | ||
void claps_function(int sensorPin, bool *signalToRelayPin) { | void claps_function(int sensorPin, bool *signalToRelayPin) { | ||
int soundValue = digitalRead(sensorPin); | int soundValue = digitalRead(sensorPin); | ||
Line 239: | Line 241: | ||
} | } | ||
- | == Reading data from IR remote == | + | == Citire date telecomanda IR == |
+ | |||
+ | Primeste comenzi de la telecomanda si in functie de acestea seteaza variabilele necesare | ||
+ | Pentru a nu citi prea rapid comenzi si nu a trimite date prea des la baza de date an facut un delay | ||
+ | pentru fiecare folosind functia millis() | ||
if (IrReceiver.decode()) { | if (IrReceiver.decode()) { | ||
Line 255: | Line 261: | ||
room1.relay2 = !room1.relay2; | room1.relay2 = !room1.relay2; | ||
relayStatus = true; | relayStatus = true; | ||
- | | ||
} | } | ||
// # | // # | ||
Line 274: | Line 279: | ||
update_db_time = millis(); | update_db_time = millis(); | ||
} | } | ||
+ | |||
+ | == Citire si scriere EEPROM pe Arduino Nano == | ||
+ | |||
+ | Parola si cartelele sunt salvate in eeprom pentru a nu pierde informatia la resetare. | ||
+ | |||
+ | |||
+ | if (EEPROM.read(EE_START_ADDR) == KEY_DATA) | ||
+ | { | ||
+ | savedTags = EEPROM.read(EE_START_ADDR + ADDRESS_TAGS); | ||
+ | } // Verify if EEPROM contain key data, clear the memory if not | ||
+ | else | ||
+ | { | ||
+ | for (int i = 0; i < EEPROM.length(); i++) | ||
+ | { | ||
+ | EEPROM.update(i, 0x00); | ||
+ | } | ||
+ | for (int i = 0; i < 6; i++) | ||
+ | { // Writing a default password when first time uploading | ||
+ | EEPROM.update(i + 6, '1'); | ||
+ | } | ||
+ | } | ||
+ | EEPROM.update(EE_START_ADDR, KEY_DATA); | ||
+ | |||
+ | for (int i = 0; i < 6; i++) | ||
+ | { | ||
+ | compPassword[i] = EEPROM.read(i + PASSWORD_ADDRESS); // Reading the password from EEPROM | ||
+ | Serial.print(compPassword[i]); | ||
+ | } | ||
+ | |||
+ | == Stergere/Scriere cartele == | ||
+ | | ||
+ | // Adding and deleting new tag in/from EEPROM | ||
+ | bool saveOrDeleteTag(uint8_t *tag, uint8_t size) | ||
+ | { | ||
+ | int16_t tagAddr = foundTag(tag, size); // search the tag | ||
+ | uint16_t newTagAddr = (savedTags * 8) + EE_START_ADDR + ADDRESS_TAGS; // last tag addres | ||
+ | if (tagAddr >= 0) | ||
+ | { // deleting the tag | ||
+ | for (uint8_t i = 0; i < 8; i++) | ||
+ | { | ||
+ | EEPROM.write(tagAddr + i, 0x00); // deleting old tag | ||
+ | EEPROM.write(tagAddr + i, EEPROM.read((newTagAddr - 8) + i)); // writing new tag | ||
+ | EEPROM.write((newTagAddr - 8) + i, 0x00); | ||
+ | } | ||
+ | EEPROM.write(EE_START_ADDR + 1, savedTags --); // write in EEPROM number of tags | ||
+ | return false; | ||
+ | } | ||
+ | else if (savedTags < MAX_TAGS) | ||
+ | { | ||
+ | for (uint16_t i = 0; i < size; i++) | ||
+ | EEPROM.write(i + newTagAddr, tag[i]); // write new tag | ||
+ | EEPROM.write(EE_START_ADDR + 1, ++savedTags); // write number of tags | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | return false; | ||
+ | } | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | == Poze aplicatie == | ||
+ | |||
+ | |||
+ | {{:pm:prj2024:vstoica:dragos.coscodan_room_2.jpg?400|}} | ||
+ | |||
+ | {{:pm:prj2024:vstoica:dragos.coscodan_power_measure.jpg?400|}} | ||
+ | |||
===== Rezultate Obţinute ===== | ===== Rezultate Obţinute ===== | ||
- | <note tip> | + | **Inchidere Usa:** |
- | Care au fost rezultatele obţinute în urma realizării proiectului vostru. | + | |
- | </note> | + | Introducere parola pe numpad pentru a deschide usa; |
- | + | Apropiere cartela pentru a deschide usa; | |
- | ===== Concluzii ===== | + | Cand usa este deschisa tastare "***" pentru a intra in meniul de setari |
+ | unde putem schimba parola, limba(RO, EN, FR), adauga/sterge cartele; | ||
+ | Usa se incuie automat dupa cateva secunde daca este inchisa. | ||
+ | |||
+ | **Cutie 1 si 2:** | ||
+ | |||
+ | Afisare temperatura, umiditate, calitate aer pe telefon; | ||
+ | Activare/dezactivare becuri, prize, alarma de la telecomanda sau telefon; | ||
+ | Aprinde/stinge luminile, batand de doua ori din palme; | ||
+ | Aprinde lumina daca intensitatea luminii este mai mica de un prag; | ||
+ | Activare/Dezactivare becuri, prize, alarma intrun anumit interval; | ||
+ | Setare intensitate lumina de la telecomanda sau din aplicatie; | ||
+ | Afisare curent consumat in aplicatie; | ||
+ | Activare alarma daca cineva a patruns in casa sau daca calitatea aerului este rea; | ||
+ | Afisare status cutii utilizand ledurile montate. | ||
+ | |||
+ | |||
+ | [[https://youtu.be/betq2JxMFPk?si=Z8a8zUScWK3Z1pHi|Video 1]] | ||
+ | [[https://youtube.com/shorts/bQj4MoAs6Ao?si=cfGHVuRVleRzV3eR|Video 2]] | ||
+ | [[https://youtube.com/shorts/dKRBe61gDRw?si=bTGLbOu1wot8lc-2|Video 3]] | ||
+ | |||
+ | |||
+ | |||
===== Download ===== | ===== Download ===== | ||
- | <note warning> | + | |
- | 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ă ;-). | + | {{:pm:prj2024:vstoica:dragos.coscodan.smart_home.zip|}} |
- | + | ||
- | 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:prj2022:cc:dumitru_alin*. | + | |
- | </note> | + | |
- | + | ||
- | ===== Jurnal ===== | + | |
- | + | ||
- | <note tip> | + | |
- | Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. | + | |
- | </note> | + | |
+ | |||
===== Bibliografie/Resurse ===== | ===== Bibliografie/Resurse ===== | ||
- | <note> | + | |
- | Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe *Resurse Software* şi *Resurse Hardware*. | + | **Resurse Software: |
- | </note> | + | ** |
+ | |||
+ | https://randomnerdtutorials.com/esp32-pwm-arduino-ide/ | ||
+ | |||
+ | https://medium.com/@khantalha7367/uart-communication-on-esp32-28fd3df3b6eb | ||
+ | |||
+ | https://randomnerdtutorials.com/esp32-esp8266-firebase-authentication/ | ||
+ | |||
+ | https://developer.android.com/ | ||
+ | |||
+ | |||
+ | **Resurse Hardware:** | ||
+ | |||
+ | https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ | ||
+ | |||
+ | https://www.instructables.com/AC-PWM-Dimmer-for-Arduino/ | ||
+ | |||
+ | https://diyprojectslab.com/measure-ac-current-using-arduino-and-sct-013/ | ||
<html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | ||