Differences

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

Link to this comparison view

pm:prj2025:avaduva:cosmin.iliescu [2025/05/26 00:06]
cosmin.iliescu [Rezultate Obţinute]
pm:prj2025:avaduva:cosmin.iliescu [2025/05/30 08:33] (current)
cosmin.iliescu [Software Design]
Line 7: Line 7:
 ===== General description ===== ===== General description =====
  
-The device actively polls for air quality data from its sensors and displays it on its LCD screen. It stores ​the hourly sensor data and makes a prediction of air quality for the day every morning. The prediction is made using a model used and trained using the Edge Impulse API. The predicted data is sent off to a Telegram bot for the user to see.+The device actively polls for air quality data from its sensors and displays it on its LCD screen. It stores hourly sensor data for up to 24 hours and makes a prediction of air quality for the following ​day on request. The predictive analysis ​is accessible ​to the user via an HTTP server.
  
 {{:​pm:​prj2025:​avaduva:​schema-block-cosmin.iliescu.jpg?​nolink|}} {{:​pm:​prj2025:​avaduva:​schema-block-cosmin.iliescu.jpg?​nolink|}}
Line 44: Line 44:
 ===== Software Design ===== ===== Software Design =====
  
-The program running on the microcontroller was developed using ESP-IDF - Espressif’s official IoT Development Framework for the ESP32. ​After an initial warm-up time of 30 seconds (as per PMS5003'​s specification), ​the device makes predictions every 60 seconds (as per BME280'​s specification) ​and displays them on the LCD. Every hour, the particulate matter ​measurements are converted to an AQI, which is placed ​in a features bufferAt the initialization ​of the deviceit attempts to connect to a wireless access point via Wi-Fi and starts an HTTP serverAny HTTP GET request ​to said server receives a response containing an AQI prediction ​for the next hour. This prediction is made using the features from the aforementioned features buffer.+The program running on the microcontroller was developed ​and uploaded ​using ESP-IDF - Espressif’s official IoT Development Framework for the ESP32. ​The framework provides wrappers and abstractions for various features supported by the ESP32 family of microcontrollers. These streamline development ​and translate focus onto actual functionality. The following abstractions were used during development:​ 
 +  * [[https://​docs.espressif.com/​projects/​esp-idf/​en/​stable/​esp32/​api-reference/​peripherals/​ledc.html|LED Control]]: peripheral library for PWM control targeted towards, but not limited to LEDs. This is used for contrast control ​on the LCD display, as the hardware design does not feature a potentiometer for this use case. 
 +  * [[https://​docs.espressif.com/​projects/​esp-idf/​en/​stable/​esp32/​api-guides/​wifi.html|Wi-Fi driver]] for establishing wireless connections to send predictive data over. Additionally, the [[https://​docs.espressif.com/​projects/​esp-idf/​en/​v5.0/​esp32/​api-guides/​event-handling.html|event handling library]] was used to gracefully handle connection establishment. 
 +  * [[https://​docs.espressif.com/​projects/​esp-idf/​en/​stable/​esp32/​api-reference/​peripherals/​uart.html|UART library]] for interfacing with the PMS5003 ​particulate matter ​sensor. The driver for this sensor ​is self-written, ​in accordance with its [[https://​cdn-shop.adafruit.com/​product-files/​3686/​plantower-pms5003-manual_v2-3.pdf|datasheet]]The payload regularly sent by the sensor consists ​of 32 bytes - 2 start bytes (0x42 and 0x4D), 2 bytes for the data length (0x00 and 0x1C if not tructated)26 bytes of measured data and 2 last bytes for the payload'​s checksumOf these, only bytes 10 through 15 are of use, covering PM2.5 and PM10 readings. 
 +  * [[https://​docs.espressif.com/​projects/​esp-idf/​en/​stable/​esp32/​api-reference/​protocols/​esp_http_server.html|HTTP Server]] implementation,​ which responds ​to GET requests with predictive ​AQI data for the next hour.
  
-External ​libraries+Aside from the libraries ​available inside ​ESP-IDF, the following third-party libraries were used for peripheral communication:​ 
-  * ESP-IDF ​and its various wrappers and drivers +  * [[https://components.espressif.com/components/espressif/bme280|BME280 I2C driver]] easily integrated into the project via the ESP Component Registry. It streamlines use of I2C and BME280 sensor readings. 
-  * Edge Impulse ​for training and deploying a regression model +  * [[https://github.com/UncleRus/esp-idf-lib/tree/​master/​components/​hd44780|HD44780 ​driver]] ​plucked from its parent library. This controller is compatible with various character display controllers,​ including the one present in the LCD2004.
-  * HD44780-compatible LCD controller driver implemented in this [[https://github.com/UncleRus/esp-idf-lib/tree/master|library]] +
-  * [[https://components.espressif.com/components/espressif/bme280|BME280 I2C driver]]+
  
-<note tip> +Predictions of AQI are made using a highly accurate [[https://studio.edgeimpulse.com/studio/​704867|regression model]] trained and deployed using the Edge Impulse platform. Edge Impulse provides tools and APIs for training and deploying machine learning models specifically on edge devices, including embedded systems. The model was trained on two years' worth of hourly readings of PM2.5 and PM10, starting from 2023 and ending in 2024. The readings were translated into an AQI following this [[https://​document.airnow.gov/​technical-assistance-document-for-the-reporting-of-daily-air-quailty.pdf|US Environmental Protection Agency paper]]. The dataset was split into samples covering 24 hours, each labled as the AQI reading of hour 25. The readings are publicly available on www.calitateaer.ro.
-Descrierea codului aplicaţiei (firmware): +
-  * librării şi surse 3rd-party (e.gProcyon AVRlib) +
-  * algoritmi şi structuri pe care plănuiţi să le implementaţi +
-  * (etapa 3) surse şi funcţii implementate +
-</note>+
  
-===== Rezultate Obţinute =====+All the previous components interact as follows: 
 +  - A connection is established via Wi-Fi and the HTTP server is started. 
 +  - The two sensors are the LCD are initialized. 
 +  - The device waits for 30 seconds, while the PMS5003 sensor warms up (in accordance with its specifications) 
 +  - Every minute, data is read from the sensors and displayed on the LCD. The BME280 should be read at least every 60 seconds, according to its specification. 
 +  - Every hour, the data read from the PMS5003 sensor is turned into an AQI and saved in a buffer of size 24. 
 +  - Upon receiving a GET request, the HTTP server responds with the AQI for the following 24 hours predicted using the regression model uploaded onto the microcontroller. The device should ideally run for at least 24 hours before a prediction is requested, so 24 hours of predictive data may be available in the buffer.
  
-https://​github.com/​Cosminovici22/​pm_project+===== Results =====
  
-https://www.youtube.com/watch?​v=M_NCdVkCw58+A demonstration of the device is available at https://youtu.be/Bxe3qhWADMU.
  
-===== Concluzii ​=====+===== Conclusions ​=====
  
 ===== Download ===== ===== Download =====
  
-<note warning>​ +The software implementation is available at https://github.com/​Cosminovici22/​pm_project.
-O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectuluisurse, scheme, etcUn 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**. +===== Journal =====
-</​note>​+
  
-===== Jurnal =====+  * 13th to 16th of May: arrival of components 
 +  * 17th and 18th of May: assembly of device components 
 +  * 23th to 25th of May: development of device software 
 +  * 28th and 29th of May: refinement and packaging of device 
 +  * 30th of May: device demonstration at PM fair
  
-<note tip> +===== Bibliography =====
-Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. +
-</​note>​+
  
-  * 13 - 16 of Mayarrival of components +  * [[https://​www.youtube.com/​watch?​v=QiPEXCb9jAk&​t=370s|LCD2004 pin summary]] 
-  * 17 18 of Mayassembly of device +  * [[https://​cdn-shop.adafruit.com/​product-files/​3686/​plantower-pms5003-manual_v2-3.pdf|PMS5003 datasheet]] 
- +  * [[https://​docs.espressif.com/​projects/​esp-idf/​en/​stable/​esp32|ESP-IDF programming guide]] 
-===== Bibliografie/Resurse ===== +  * [[https://​components.espressif.com/​components/​espressif/​bme280|BME280 I2C driver usage examples]] 
- +  [[https://​www.calitateaer.ro/​public/​home-page|AQI dataset source]] 
-<​note>​ +  * [[https://​document.airnow.gov/​technical-assistance-document-for-the-reporting-of-daily-air-quailty.pdf|US Environmental Protection Agency technical assistance document for the reporting of daily air quality]]
-Listă cu documente, datasheet-uri,​ resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**. +
-</note>+
  
 <​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>​
  
pm/prj2025/avaduva/cosmin.iliescu.1748207164.txt.gz · Last modified: 2025/05/26 00:06 by cosmin.iliescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0