This shows you the differences between two versions of the page.
|
pm:prj2025:avaduva:cosmin.iliescu [2025/05/30 08:22] cosmin.iliescu |
pm:prj2025:avaduva:cosmin.iliescu [2025/05/30 08:33] (current) cosmin.iliescu [Software Design] |
||
|---|---|---|---|
| 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 10 through 15 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 ===== | ||