This shows you the differences between two versions of the page.
|
iothings:proiecte:2022:magneticauth [2023/06/02 19:56] carol.bontas |
iothings:proiecte:2022:magneticauth [2023/06/02 20:09] (current) carol.bontas |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Autor: Carol-Sebastian Bontas SRIC1 | Autor: Carol-Sebastian Bontas SRIC1 | ||
| - | ===== Project Description ===== | + | ===== Descriere proiect ===== |
| Magnetic Authentication este o forma de autentificare folosind un magnet ce interactioneaza cu senzorul Hall integrat in ESP32. Fiecare utilizator are un id unic introdus de la tastatura si citit de ESP32. | Magnetic Authentication este o forma de autentificare folosind un magnet ce interactioneaza cu senzorul Hall integrat in ESP32. Fiecare utilizator are un id unic introdus de la tastatura si citit de ESP32. | ||
| Line 43: | Line 43: | ||
| {{:iothings:proiecte:2022:sumstable_joined_mapped.jpg?750|}} | {{:iothings:proiecte:2022:sumstable_joined_mapped.jpg?750|}} | ||
| - | 5. Facem suma fiecarei coloane de patrate si produse (exemplu din poza ar fi un tabel ce contine suma sumelor partiale) | + | 5. Facem suma fiecarei coloane de patrate si produse (exemplu din poza ar fi un tabel ce contine suma patratelor sumelor partiale) |
| {{:iothings:proiecte:2022:one_join_table.jpg?750|}} | {{:iothings:proiecte:2022:one_join_table.jpg?750|}} | ||
| + | |||
| + | 6. Repetam pasul 5 pentru toate coloanele din tabelul de la pasul 4. | ||
| + | |||
| + | 7. Facem un inner-join cu toate tabelele de la pasul 6. Am obtinut un tabel cu toti parametrii necesari ca sa calculam coeficientul. | ||
| + | |||
| + | {{:iothings:proiecte:2022:pearson_components.jpg?750|}} | ||
| - | ===== Hardware Description ===== | + | ===== Descriere hardware ===== |
| Componente necesare: | Componente necesare: | ||
| Line 58: | Line 64: | ||
| - | ===== Software Description ===== | + | ===== Descriere software ===== |
| Pentru stocarea, procesarea si afisarea datelor folosim InfluxDB. | Pentru stocarea, procesarea si afisarea datelor folosim InfluxDB. | ||
| Line 87: | Line 93: | ||
| Concret pentru a citi inregistrati de la senzorul Hall se apeleaza astfel <code> doUntilSerialInput(sampleHallSensor, NULL) </code> | Concret pentru a citi inregistrati de la senzorul Hall se apeleaza astfel <code> doUntilSerialInput(sampleHallSensor, NULL) </code> | ||
| + | 2. [[https://github.com/CSBonLaboratory/MagneticAuth/blob/main/magnetic_influx.cpp | magnetic_influx.cpp]] este o componenta auxiliara ce se ocupa exolicit cu interactiunea cu InfluxDB. | ||
| + | |||
| + | partea centrala este reprezentata de construirea query-ului de Flux care sa verifice daca id-ul dat apare sau nu in bucket-ul "Signatures". | ||
| + | |||
| + | Prezinta urmatorea interfata: | ||
| + | <code>int userExists(int id){ | ||
| + | String existQuery = String("from(bucket: \"") + String(BUCKET_USERS) + String("\")"); | ||
| + | existQuery += String("|> range(start: 2021-05-22T23:30:00Z)"); | ||
| + | existQuery += String("|> filter(fn: (r) => r._measurement == \"") + String(MEASUREMENT) + String("\" and r.id == \"") + String(id) + String("\")"); | ||
| + | existQuery += String("|> count()"); | ||
| + | |||
| + | Serial.println(existQuery); | ||
| + | int userFound = 0; | ||
| + | FluxQueryResult result = clients[USERS_INDEX].query(existQuery); | ||
| + | |||
| + | while(result.next()){ | ||
| + | if(result.getValueByName("_value").getLong() > 0){ | ||
| + | Serial.println("User was registered in the past"); | ||
| + | userFound = 1; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if(result.getError() != ""){ | ||
| + | Serial.print("Query result error: "); | ||
| + | Serial.println(result.getError()); | ||
| + | return -1; | ||
| + | } | ||
| + | |||
| + | Serial.print("User id"); | ||
| + | Serial.println(id); | ||
| + | Serial.println(" is available."); | ||
| + | result.close(); | ||
| + | return userFound; | ||
| + | |||
| + | } | ||
| + | </code> | ||
| - | ===== InfluxDB ===== | ||
| - | {{:iothings:proiecte:2022sric:screenshot_5.png?800|}} | ||
| - | ===== Grafana ===== | ||
| - | {{:iothings:proiecte:2022sric:screenshot_4.png?800|}} | ||
| ===== Bibliografie ===== | ===== Bibliografie ===== | ||
| - | * https://randomnerdtutorials.com/esp32-influxdb/ | + | * https://www.wallstreetmojo.com/pearson-correlation-coefficient/ |
| - | * https://randomnerdtutorials.com/esp32-web-server-with-bme280-mini-weather-station/ | + | * https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino |
| - | * https://megma.ma/wp-content/uploads/2021/08/Wemos-ESP32-Lolin32-Board-BOOK-ENGLISH.pdf | + | |
| - | * https://www.mischianti.org/wp-content/uploads/2020/11/ESP32-WeMos-LOLIN32-pinout-mischianti.png | + | |