From 481c5a4ad668b3ce1c1925e301a1b84912d5d617 Mon Sep 17 00:00:00 2001 From: OrestPaja1738 Date: Thu, 23 Jul 2026 14:46:56 +0200 Subject: [PATCH] Add IoT_Carrier_Platformio which contains all skeleton platformio projects --- .../IoT_Carrier_Starter_C3/.gitignore | 5 ++ .../.vscode/extensions.json | 10 ++++ .../IoT_Carrier_Starter_C3/include/README | 37 ++++++++++++++ .../include/battery_interfacing.h | 20 ++++++++ .../include/dust_sensor_pinout.h | 14 +++++ .../include/i2c_pinout.h | 17 +++++++ .../include/noise_sensor_pinout.h | 13 +++++ .../IoT_Carrier_Starter_C3/lib/README | 46 +++++++++++++++++ .../IoT_Carrier_Starter_C3/platformio.ini | 17 +++++++ .../IoT_Carrier_Starter_C3/src/main.cpp | 51 +++++++++++++++++++ .../IoT_Carrier_Starter_C3/test/README | 11 ++++ .../IoT_Carrier_Starter_DEVKIT V1/.gitignore | 5 ++ .../.vscode/extensions.json | 10 ++++ .../include/README | 37 ++++++++++++++ .../include/battery_interfacing.h | 20 ++++++++ .../include/dust_sensor_pinout.h | 14 +++++ .../include/i2c_pinout.h | 17 +++++++ .../include/noise_sensor_pinout.h | 13 +++++ .../IoT_Carrier_Starter_DEVKIT V1/lib/README | 46 +++++++++++++++++ .../platformio.ini | 17 +++++++ .../src/main.cpp | 51 +++++++++++++++++++ .../IoT_Carrier_Starter_DEVKIT V1/test/README | 11 ++++ .../IoT_Carrier_Starter_NODE/.gitignore | 5 ++ .../.vscode/extensions.json | 10 ++++ .../IoT_Carrier_Starter_NODE/include/README | 37 ++++++++++++++ .../include/battery_interfacing.h | 20 ++++++++ .../include/dust_sensor_pinout.h | 14 +++++ .../include/i2c_pinout.h | 17 +++++++ .../include/noise_sensor_pinout.h | 13 +++++ .../IoT_Carrier_Starter_NODE/lib/README | 46 +++++++++++++++++ .../IoT_Carrier_Starter_NODE/platformio.ini | 17 +++++++ .../IoT_Carrier_Starter_NODE/src/main.cpp | 51 +++++++++++++++++++ .../IoT_Carrier_Starter_NODE/test/README | 11 ++++ 33 files changed, 723 insertions(+) create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.gitignore create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.vscode/extensions.json create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/README create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/battery_interfacing.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/dust_sensor_pinout.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/i2c_pinout.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/noise_sensor_pinout.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/lib/README create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/platformio.ini create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/src/main.cpp create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/test/README create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.gitignore create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.vscode/extensions.json create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/README create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/battery_interfacing.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/dust_sensor_pinout.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/i2c_pinout.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/noise_sensor_pinout.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/lib/README create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/platformio.ini create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/src/main.cpp create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/test/README create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.gitignore create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.vscode/extensions.json create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/README create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/battery_interfacing.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/dust_sensor_pinout.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/i2c_pinout.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/noise_sensor_pinout.h create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/lib/README create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/platformio.ini create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/src/main.cpp create mode 100644 IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/test/README diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.gitignore b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.vscode/extensions.json b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/README b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/README new file mode 100644 index 0000000..49819c0 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/README @@ -0,0 +1,37 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the convention is to give header files names that end with `.h'. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/battery_interfacing.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/battery_interfacing.h new file mode 100644 index 0000000..d190096 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/battery_interfacing.h @@ -0,0 +1,20 @@ +#ifndef battery_interfacing_H +#define battery_interfacing_H + +/* + PINOUT DEFINITIONS FOR USING THE BOARD's MECHANISMS + FOR MONITORING BATTERY LEVEL VIA ADC (USING VOLTAGE DIVIDER SUBCIRCUIT) + BY TOGGLING THE FET SWITCHES PRESENT ON THE IoT Carrier + + ADDITIONALLY PROVIDED A CONSTANT,BASED ON BOARD's COMPONENT VALUES + THIS CONSTANT IS TO BE USED WHEN CALCULATING BATTERY LEVEL + + DO NOT CHANGE PIN AND CONSTANT DEFINITIONS +*/ + +#define BAT_EN_PIN 5//FET enable pin, to drive the NMOS switch to close,in order to close the PMOS switch as well,which allows reading the battery voltage +#define BAT_ADC_PIN 1//ADC input pin,whose function is to gauge battery level via the voltage divider on the PCB + +#define ADC_DIVIDER_GAIN 1.5f//V_ADC = VBAT * (R15 / R14 + R15), therefore VBAT = V_ADC * ((R14 + R15)/ R15). The latter is the formula to be used to get the battery level by using the ADC input. The resistor ratio is 1.5 + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/dust_sensor_pinout.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/dust_sensor_pinout.h new file mode 100644 index 0000000..5ff595f --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/dust_sensor_pinout.h @@ -0,0 +1,14 @@ +#ifndef dust_sensor_pinout_H +#define dust_sensor_pinout_H + +/* + PINOUT DEFINITIONS FOR ESP32 C3-DevKitM-1 BOARD ON + IoT Carrier Board FOR USING GP2Y1010AU0F DUST SENSOR. + + DO NOT CHANGE PIN DEFINITIONS +*/ + +#define DUST_ADC_PIN 2//the ESP32 pin (GPIO2) to be used as ADC input for the dust sensor data +#define DUST_LED_PIN 6//the ESP32 pin (GPIO6) to be used as digital output to drive the sensor led + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/i2c_pinout.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/i2c_pinout.h new file mode 100644 index 0000000..203ed39 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/i2c_pinout.h @@ -0,0 +1,17 @@ +#ifndef i2c_pinout_H +#define i2c_pinout_H + +/* + I2C COMMUNICATION PINOUT DEFINITIONS FOR ESP32 C3-DevKitM-1 + BOARD ON IoT Carrier Board WHICH USE GPIO21 AND GPIO 20 + + I2C IS NECESSARY FOR USING THE SCD30 SENSOR OR ANY OTHER + (3V3) SENSOR INTERFACED VIA QWICC CONNECTORS + + DO NOT CHANGE PIN DEFINITIONS +*/ + +#define I2C_SCL_PIN 21 +#define I2C_SDA_PIN 20 + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/noise_sensor_pinout.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/noise_sensor_pinout.h new file mode 100644 index 0000000..c2b5185 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/include/noise_sensor_pinout.h @@ -0,0 +1,13 @@ +#ifndef noise_sensor_pinout_H +#define noise_sensor_pinout_H + +/* + PINOUT DEFINITIONS FOR ESP32 C3-DevKitM-1 BOARD ON + IoT Carrier Board FOR USING LMV324 NOISE SENSOR. + + DO NOT CHANGE PIN DEFINITIONS +*/ + +#define NOISE_ADC_PIN 0//the ESP32 pin (GPIO0) to be used as ADC input for the noise sensor data + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/lib/README b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/lib/README new file mode 100644 index 0000000..9379397 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into the executable file. + +The source code of each library should be placed in a separate directory +("lib/your_library_name/[Code]"). + +For example, see the structure of the following example libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +Example contents of `src/main.c` using Foo and Bar: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +The PlatformIO Library Dependency Finder will find automatically dependent +libraries by scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/platformio.ini b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/platformio.ini new file mode 100644 index 0000000..d2f998a --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/platformio.ini @@ -0,0 +1,17 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32-c3-devkitm-1] +platform = espressif32 +board = esp32-c3-devkitm-1 +framework = arduino + +lib_deps = + sensirion/Sensirion I2C SCD30 diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/src/main.cpp b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/src/main.cpp new file mode 100644 index 0000000..b404c85 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/src/main.cpp @@ -0,0 +1,51 @@ +/* + THE FOLLOWING IS A PROJECT SKELETON FOR IoT Carrier AND + ESP32 C3-DevKitM-1 BOARD. IT CONTAINS THE BARE NECESSITIES FOR + STARTING ANY PROJECT THAT USES THE CARRIER BOARD's FUNCTIONALITIES + + PRESENT ARE HEADER FILES THAT LIST THE RESPECTIVE PRECONFIGURED PINOUTS: + dust_sensor_pinout.h -- GP2Y1010AU0F DUST SENSOR + noise_sensor_pinout.h -- LMV324 NOISE SENSOR + battery_interfacing.h -- PINOUT FOR BATTERY MONITORING MECHANISM + i2c_pinout.h -- I2C COMMUNICATION PINOUT + + ADDITIONALLY, FOR SCD30 SENSOR WHICH REQUIRES A LIBRARY, IT IS ALREADY CONFIGURED + TO USE JUST REMOVE THE COMMENT FROM : #include + (the external library is already configured in platformio.ini file) + + TO USE ANY OF THE HEADERS OR LIBRARY, SIMPLY REMOVE THE COMMENTS +*/ + +#include +//#include "dust_sensor_pinout.h" +//#include "noise_sensor_pinout.h" +//#include "battery_interfacing.h" +//#include "i2c_pinout.h" +//#include + +//PUT FUNCTION DECLARATIONS BELOW: +/* +void foo(args); +*/ + +void setup() { + /* + ENTER ALL THE ONE TIME DEFINITIONS AND INITIALIZATIONS + WITHIN THIS FUNCTION SCOPE,SUCH AS COMMUNICATION AND SENSOR + SETUPS AND PIN ROLE INITIALIZATIONS + */ +} + +void loop() { + /* + ENTER THE MAIN CODE HERE TO RUN REPEATEDLY FOR ALL THE + PLANNED TASKS + */ +} + +//PUT FUNCTION DEFINITIONS (USED IN SETUP OR LOOP) BELOW: +/* +void foo(variable_type args){ + ~function body +} +*/ diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/test/README b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/test/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_C3/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.gitignore b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.vscode/extensions.json b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/README b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/README new file mode 100644 index 0000000..49819c0 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/README @@ -0,0 +1,37 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the convention is to give header files names that end with `.h'. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/battery_interfacing.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/battery_interfacing.h new file mode 100644 index 0000000..9c7627d --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/battery_interfacing.h @@ -0,0 +1,20 @@ +#ifndef battery_interfacing_H +#define battery_interfacing_H + +/* + PINOUT DEFINITIONS FOR USING THE BOARD's MECHANISMS + FOR MONITORING BATTERY LEVEL VIA ADC (USING VOLTAGE DIVIDER SUBCIRCUIT) + BY TOGGLING THE FET SWITCHES PRESENT ON THE IoT Carrier + + ADDITIONALLY PROVIDED A CONSTANT,BASED ON BOARD's COMPONENT VALUES + THIS CONSTANT IS TO BE USED WHEN CALCULATING BATTERY LEVEL + + DO NOT CHANGE PIN AND CONSTANT DEFINITIONS +*/ + +#define BAT_EN_PIN 18//FET enable pin, to drive the NMOS switch to close,in order to close the PMOS switch as well,which allows reading the battery voltage +#define BAT_ADC_PIN 33//ADC input pin,whose function is to gauge battery level via the voltage divider on the PCB + +#define ADC_DIVIDER_GAIN 1.5f//V_ADC = VBAT * (R15 / R14 + R15), therefore VBAT = V_ADC * ((R14 + R15)/ R15). The latter is the formula to be used to get the battery level by using the ADC input. The resistor ratio is 1.5 + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/dust_sensor_pinout.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/dust_sensor_pinout.h new file mode 100644 index 0000000..f2de6cc --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/dust_sensor_pinout.h @@ -0,0 +1,14 @@ +#ifndef dust_sensor_pinout_H +#define dust_sensor_pinout_H + +/* + PINOUT DEFINITIONS FOR DOIT ESP32 DEVKIT V1 BOARD ON + IoT Carrier Board FOR USING GP2Y1010AU0F DUST SENSOR. + + DO NOT CHANGE PIN DEFINITIONS +*/ + +#define DUST_ADC_PIN 36//the ESP32 pin (GPIO36) to be used as ADC input for the dust sensor data +#define DUST_LED_PIN 19//the ESP32 pin (GPIO19) to be used as digital output to drive the sensor led + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/i2c_pinout.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/i2c_pinout.h new file mode 100644 index 0000000..5a34028 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/i2c_pinout.h @@ -0,0 +1,17 @@ +#ifndef i2c_pinout_H +#define i2c_pinout_H + +/* + I2C COMMUNICATION PINOUT DEFINITIONS FOR DOIT ESP32 DEVKIT V1 + BOARD ON IoT Carrier Board WHICH USE GPIO22 and GPIO21 + + I2C IS NECESSARY FOR USING THE SCD30 SENSOR OR ANY OTHER + (3V3) SENSOR INTERFACED VIA QWICC CONNECTORS + + DO NOT CHANGE PIN DEFINITIONS +*/ + +#define I2C_SCL_PIN 22 +#define I2C_SDA_PIN 21 + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/noise_sensor_pinout.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/noise_sensor_pinout.h new file mode 100644 index 0000000..d659cb2 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/include/noise_sensor_pinout.h @@ -0,0 +1,13 @@ +#ifndef noise_sensor_pinout_H +#define noise_sensor_pinout_H + +/* + PINOUT DEFINITIONS FOR DOIT ESP32 DEVKIT V1 BOARD ON + IoT Carrier Board FOR USING LMV324 NOISE SENSOR. + + DO NOT CHANGE PIN DEFINITIONS +*/ + +#define NOISE_ADC_PIN 32//the ESP32 pin (GPIO32) to be used as ADC input for the noise sensor data + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/lib/README b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/lib/README new file mode 100644 index 0000000..9379397 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into the executable file. + +The source code of each library should be placed in a separate directory +("lib/your_library_name/[Code]"). + +For example, see the structure of the following example libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +Example contents of `src/main.c` using Foo and Bar: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +The PlatformIO Library Dependency Finder will find automatically dependent +libraries by scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/platformio.ini b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/platformio.ini new file mode 100644 index 0000000..4d3e2d3 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/platformio.ini @@ -0,0 +1,17 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32doit-devkit-v1] +platform = espressif32 +board = esp32doit-devkit-v1 +framework = arduino + +lib_deps = + sensirion/Sensirion I2C SCD30 \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/src/main.cpp b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/src/main.cpp new file mode 100644 index 0000000..1923194 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/src/main.cpp @@ -0,0 +1,51 @@ +/* + THE FOLLOWING IS A PROJECT SKELETON FOR IoT Carrier AND + DOIT ESP32 DEVKIT V1 BOARD. IT CONTAINS THE BARE NECESSITIES FOR + STARTING ANY PROJECT THAT USES THE CARRIER BOARD's FUNCTIONALITIES + + PRESENT ARE HEADER FILES THAT LIST THE RESPECTIVE PRECONFIGURED PINOUTS: + dust_sensor_pinout.h -- GP2Y1010AU0F DUST SENSOR + noise_sensor_pinout.h -- LMV324 NOISE SENSOR + battery_interfacing.h -- PINOUT FOR BATTERY MONITORING MECHANISM + i2c_pinout.h -- I2C COMMUNICATION PINOUT + + ADDITIONALLY, FOR SCD30 SENSOR WHICH REQUIRES A LIBRARY, IT IS ALREADY CONFIGURED + TO USE JUST REMOVE THE COMMENT FROM : #include + (the external library is already configured in platformio.ini file) + + TO USE ANY OF THE HEADERS OR LIBRARY, SIMPLY REMOVE THE COMMENTS +*/ + +#include +//#include "dust_sensor_pinout.h" +//#include "noise_sensor_pinout.h" +//#include "battery_interfacing.h" +//#include "i2c_pinout.h" +//#include + +//PUT FUNCTION DECLARATIONS BELOW: +/* +void foo(args); +*/ + +void setup() { + /* + ENTER ALL THE ONE TIME DEFINITIONS AND INITIALIZATIONS + WITHIN THIS FUNCTION SCOPE,SUCH AS COMMUNICATION AND SENSOR + SETUPS AND PIN ROLE INITIALIZATIONS + */ +} + +void loop() { + /* + ENTER THE MAIN CODE HERE TO RUN REPEATEDLY FOR ALL THE + PLANNED TASKS + */ +} + +//PUT FUNCTION DEFINITIONS (USED IN SETUP OR LOOP) BELOW: +/* +void foo(variable_type args){ + ~function body +} +*/ diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/test/README b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/test/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_DEVKIT V1/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.gitignore b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.vscode/extensions.json b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/README b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/README new file mode 100644 index 0000000..49819c0 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/README @@ -0,0 +1,37 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the convention is to give header files names that end with `.h'. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/battery_interfacing.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/battery_interfacing.h new file mode 100644 index 0000000..9c7627d --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/battery_interfacing.h @@ -0,0 +1,20 @@ +#ifndef battery_interfacing_H +#define battery_interfacing_H + +/* + PINOUT DEFINITIONS FOR USING THE BOARD's MECHANISMS + FOR MONITORING BATTERY LEVEL VIA ADC (USING VOLTAGE DIVIDER SUBCIRCUIT) + BY TOGGLING THE FET SWITCHES PRESENT ON THE IoT Carrier + + ADDITIONALLY PROVIDED A CONSTANT,BASED ON BOARD's COMPONENT VALUES + THIS CONSTANT IS TO BE USED WHEN CALCULATING BATTERY LEVEL + + DO NOT CHANGE PIN AND CONSTANT DEFINITIONS +*/ + +#define BAT_EN_PIN 18//FET enable pin, to drive the NMOS switch to close,in order to close the PMOS switch as well,which allows reading the battery voltage +#define BAT_ADC_PIN 33//ADC input pin,whose function is to gauge battery level via the voltage divider on the PCB + +#define ADC_DIVIDER_GAIN 1.5f//V_ADC = VBAT * (R15 / R14 + R15), therefore VBAT = V_ADC * ((R14 + R15)/ R15). The latter is the formula to be used to get the battery level by using the ADC input. The resistor ratio is 1.5 + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/dust_sensor_pinout.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/dust_sensor_pinout.h new file mode 100644 index 0000000..9f505e6 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/dust_sensor_pinout.h @@ -0,0 +1,14 @@ +#ifndef dust_sensor_pinout_H +#define dust_sensor_pinout_H + +/* + PINOUT DEFINITIONS FOR ESP32 NodeMCU-32S BOARD ON + IoT Carrier Board FOR USING GP2Y1010AU0F DUST SENSOR. + + DO NOT CHANGE PIN DEFINITIONS +*/ + +#define DUST_ADC_PIN 36//the ESP32 pin (GPIO36) to be used as ADC input for the dust sensor data +#define DUST_LED_PIN 19//the ESP32 pin (GPIO19) to be used as digital output to drive the sensor led + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/i2c_pinout.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/i2c_pinout.h new file mode 100644 index 0000000..5e80e2e --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/i2c_pinout.h @@ -0,0 +1,17 @@ +#ifndef i2c_pinout_H +#define i2c_pinout_H + +/* + I2C COMMUNICATION PINOUT DEFINITIONS FOR ESP32 NodeMCU-32S + BOARD ON IoT Carrier Board WHICH USE GPIO22 AND GPIO 21 + + I2C IS NECESSARY FOR USING THE SCD30 SENSOR OR ANY OTHER + (3V3) SENSOR INTERFACED VIA QWICC CONNECTORS + + DO NOT CHANGE PIN DEFINITIONS +*/ + +#define I2C_SCL_PIN 22 +#define I2C_SDA_PIN 21 + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/noise_sensor_pinout.h b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/noise_sensor_pinout.h new file mode 100644 index 0000000..69b44e3 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/include/noise_sensor_pinout.h @@ -0,0 +1,13 @@ +#ifndef noise_sensor_pinout_H +#define noise_sensor_pinout_H + +/* + PINOUT DEFINITIONS FOR ESP32 NodeMCU-32S BOARD ON + IoT Carrier Board FOR USING LMV324 NOISE SENSOR. + + DO NOT CHANGE PIN DEFINITIONS +*/ + +#define NOISE_ADC_PIN 32//the ESP32 pin (GPIO32) to be used as ADC input for the noise sensor data + +#endif \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/lib/README b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/lib/README new file mode 100644 index 0000000..9379397 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into the executable file. + +The source code of each library should be placed in a separate directory +("lib/your_library_name/[Code]"). + +For example, see the structure of the following example libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +Example contents of `src/main.c` using Foo and Bar: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +The PlatformIO Library Dependency Finder will find automatically dependent +libraries by scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/platformio.ini b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/platformio.ini new file mode 100644 index 0000000..a9f5ed0 --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/platformio.ini @@ -0,0 +1,17 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:nodemcu-32s] +platform = espressif32 +board = nodemcu-32s +framework = arduino + +lib_deps = + sensirion/Sensirion I2C SCD30 \ No newline at end of file diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/src/main.cpp b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/src/main.cpp new file mode 100644 index 0000000..df616cf --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/src/main.cpp @@ -0,0 +1,51 @@ +/* + THE FOLLOWING IS A PROJECT SKELETON FOR IoT Carrier AND + ESP32 NodeMCU-32S BOARD. IT CONTAINS THE BARE NECESSITIES FOR + STARTING ANY PROJECT THAT USES THE CARRIER BOARD's FUNCTIONALITIES + + PRESENT ARE HEADER FILES THAT LIST THE RESPECTIVE PRECONFIGURED PINOUTS: + dust_sensor_pinout.h -- GP2Y1010AU0F DUST SENSOR + noise_sensor_pinout.h -- LMV324 NOISE SENSOR + battery_interfacing.h -- PINOUT FOR BATTERY MONITORING MECHANISM + i2c_pinout.h -- I2C COMMUNICATION PINOUT + + ADDITIONALLY, FOR SCD30 SENSOR WHICH REQUIRES A LIBRARY, IT IS ALREADY CONFIGURED + TO USE JUST REMOVE THE COMMENT FROM : #include + (the external library is already configured in platformio.ini file) + + TO USE ANY OF THE HEADERS OR LIBRARY, SIMPLY REMOVE THE COMMENTS +*/ + +#include +//#include "dust_sensor_pinout.h" +//#include "noise_sensor_pinout.h" +//#include "battery_interfacing.h" +//#include "i2c_pinout.h" +//#include + +//PUT FUNCTION DECLARATIONS BELOW: +/* +void foo(args); +*/ + +void setup() { + /* + ENTER ALL THE ONE TIME DEFINITIONS AND INITIALIZATIONS + WITHIN THIS FUNCTION SCOPE,SUCH AS COMMUNICATION AND SENSOR + SETUPS AND PIN ROLE INITIALIZATIONS + */ +} + +void loop() { + /* + ENTER THE MAIN CODE HERE TO RUN REPEATEDLY FOR ALL THE + PLANNED TASKS + */ +} + +//PUT FUNCTION DEFINITIONS (USED IN SETUP OR LOOP) BELOW: +/* +void foo(variable_type args){ + ~function body +} +*/ diff --git a/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/test/README b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/test/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/IoT_Carrier_Platformio/IoT_Carrier_Starter_NODE/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html