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 20:31]
cosmin.iliescu
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 46: Line 46:
 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:​ 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-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 connections ​to wireless access points ​to send predictive data over. This, in turn, requires use of flash memory via the [[https://​docs.espressif.com/​projects/​esp-idf/​en/​stable/​esp32/​api-reference/​storage/​nvs_flash.html|non-volatile storage library]] for persistent storage of Wi-Fi credentials. 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-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 checksum. Of these, only bytes 5 through ​10 are of use, covering PM2.5 and PM10 readings.+  * [[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 checksum. Of 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.   * [[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.
  
Line 61: Line 61:
   - The device waits for 30 seconds, while the PMS5003 sensor warms up (in accordance with its specifications)   - 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 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 features ​buffer of size 24. +  - 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 ​hour 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 the features ​buffer ​may fill.+  - 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.
  
 ===== Results ===== ===== Results =====
Line 82: Line 82:
   * 30th of May: device demonstration at PM fair   * 30th of May: device demonstration at PM fair
  
-===== Bibliografie/​Resurse ​=====+===== Bibliography ​=====
  
-<​note>​ +  * [[https://​www.youtube.com/​watch?​v=QiPEXCb9jAk&​t=370s|LCD2004 pin summary]] 
-Listă cu documente, ​datasheet-uri, resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**. +  * [[https://​cdn-shop.adafruit.com/​product-files/​3686/​plantower-pms5003-manual_v2-3.pdf|PMS5003 ​datasheet]] 
-</note>+  * [[https://​docs.espressif.com/​projects/​esp-idf/​en/​stable/​esp32|ESP-IDF programming guide]] 
 +  ​[[https://​components.espressif.com/​components/​espressif/​bme280|BME280 I2C driver usage examples]] 
 +  ​[[https://​www.calitateaer.ro/​public/​home-page|AQI dataset source]] 
 +  * [[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]]
  
 <​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.1748280687.txt.gz · Last modified: 2025/05/26 20:31 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