diff --git a/README.md b/README.md index 8bbda44..2afc21c 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,21 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | +# ESP Air Monitor -# Hello World Example +Skeletal idea for an esp based air monitor. -Starts a FreeRTOS task to print "Hello World". +## Hardware -(See the README.md file in the upper level 'examples' directory for more information about examples.) +I have used the following: -## How to use example +* ESP32-S3 (although as far as I know, I'm not using any special features... and should work on any esp) +* DHT22 +* PMS5003 -Follow detailed instructions provided specifically for this example. +I am thinking about also adding the following too: -Select the instructions depending on Espressif chip installed on your development board: +* Senseair S8 NDIR CO2 -- [ESP32 Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/stable/get-started/index.html) -- [ESP32-S2 Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html) +Honestly... it might not look overly different from this sort of product (but I made this myself): https://www.airgradient.com/ +## License -## Example folder contents - -The project **hello_world** contains one source file in C language [hello_world_main.c](main/hello_world_main.c). The file is located in folder [main](main). - -ESP-IDF projects are built using CMake. The project build configuration is contained in `CMakeLists.txt` files that provide set of directives and instructions describing the project's source files and targets (executable, library, or both). - -Below is short explanation of remaining files in the project folder. - -``` -├── CMakeLists.txt -├── pytest_hello_world.py Python script used for automated testing -├── main -│ ├── CMakeLists.txt -│ └── hello_world_main.c -└── README.md This is the file you are currently reading -``` - -For more information on structure and contents of ESP-IDF projects, please refer to Section [Build System](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html) of the ESP-IDF Programming Guide. - -## Troubleshooting - -* Program upload failure - - * Hardware connection is not correct: run `idf.py -p PORT monitor`, and reboot your board to see if there are any output logs. - * The baud rate for downloading is too high: lower your baud rate in the `menuconfig` menu, and try again. - -## Technical support and feedback - -Please use the following feedback channels: - -* For technical queries, go to the [esp32.com](https://esp32.com/) forum -* For a feature request or bug report, create a [GitHub issue](https://github.com/espressif/esp-idf/issues) - -We will get back to you as soon as possible. +GPLv3 diff --git a/components/dht22/CMakeLists.txt b/components/dht22/CMakeLists.txt new file mode 100644 index 0000000..9efdacd --- /dev/null +++ b/components/dht22/CMakeLists.txt @@ -0,0 +1,3 @@ +idf_component_register(SRCS "dht22.c" + INCLUDE_DIRS "." + REQUIRES driver) diff --git a/components/dht22/Kconfig.projbuild b/components/dht22/Kconfig.projbuild new file mode 100644 index 0000000..cb50db1 --- /dev/null +++ b/components/dht22/Kconfig.projbuild @@ -0,0 +1,6 @@ +menu "DHT22" + config DHT22_DATA_GPIO + int "DHT22 Data GPIO Pin" + default -1 + +endmenu \ No newline at end of file diff --git a/components/dht22/dht22.c b/components/dht22/dht22.c new file mode 100644 index 0000000..7581f24 --- /dev/null +++ b/components/dht22/dht22.c @@ -0,0 +1,15 @@ +#include "dht22.h" + +#define DATA_GPIO CONFIG_DHT22_DATA_GPIO + +#if DATA_GPIO == -1 +#error "Please define your DHT22 GPIO Data Pin" +#endif /* CONFIG_DHT22_DATA_GPIO == -1 */ + +dht22_error dht_read() { + return DHT_OK; +} + +int dht_temperature() { + return DATA_GPIO; +} diff --git a/components/dht22/dht22.h b/components/dht22/dht22.h new file mode 100644 index 0000000..2752291 --- /dev/null +++ b/components/dht22/dht22.h @@ -0,0 +1,10 @@ +#pragma once + +typedef enum { + DHT_OK +} dht22_error; + +int dht_temperature(); +dht22_error dht_read(); + + diff --git a/main/main.c b/main/main.c index e46faa4..ed8e535 100644 --- a/main/main.c +++ b/main/main.c @@ -5,19 +5,19 @@ */ #include -#include -//#include "sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "dht22.h" void app_main(void) { - printf("Hello world!\n"); - for (int i = 10; i >= 0; i--) { - printf("Restarting in %d seconds...\n", i); - vTaskDelay(1000 / portTICK_PERIOD_MS); - } - printf("Restarting now.\n"); - fflush(stdout); - esp_restart(); + int ret = dht_read(); + printf("Hello world! - dhtRet: %i\n", ret); + for (int i = 10; i >= 0; i--) { + printf("Restarting in %d seconds...\n", i); + vTaskDelay(1000 / portTICK_PERIOD_MS); + } + printf("Restarting now.\n"); + fflush(stdout); + esp_restart(); }