mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2024-10-05 20:47:50 -04:00
Compare commits
31 Commits
eeb4762cd7
...
49d9bf02d7
Author | SHA1 | Date | |
---|---|---|---|
49d9bf02d7 | |||
1e7023aa3d | |||
201f614057 | |||
ed6c69498b | |||
c321bf28e0 | |||
396444c3da | |||
8326aaf28e | |||
3a5b0c82fb | |||
be3c53fdd7 | |||
32b813f0a6 | |||
e1fad509c8 | |||
680278da6b | |||
f505fec33e | |||
8595907173 | |||
b77d4d592e | |||
4ad30915c1 | |||
30c68f9b44 | |||
23ff5b4ec5 | |||
7d9c8d890a | |||
e9a688beb2 | |||
55522c696a | |||
b2ac8ce6c6 | |||
2e54a28f8e | |||
3bd30a3c33 | |||
21ad5e3814 | |||
cff7a46dca | |||
420982670e | |||
31cd94a797 | |||
956fbd90f2 | |||
fff9498683 | |||
7d113661fa |
5
ESP32-BME280/.gitignore
vendored
Normal file
5
ESP32-BME280/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
10
ESP32-BME280/.vscode/extensions.json
vendored
Normal file
10
ESP32-BME280/.vscode/extensions.json
vendored
Normal file
@ -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"
|
||||
]
|
||||
}
|
39
ESP32-BME280/include/README
Normal file
39
ESP32-BME280/include/README
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
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 usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
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
|
46
ESP32-BME280/lib/README
Normal file
46
ESP32-BME280/lib/README
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, 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
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
21
ESP32-BME280/platformio.ini
Normal file
21
ESP32-BME280/platformio.ini
Normal file
@ -0,0 +1,21 @@
|
||||
; 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:esp32dev]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
;lib_deps =
|
||||
; adafruit/Adafruit BME280 Library@^2.2.2
|
||||
; adafruit/Adafruit BMP280 Library@^2.6.8
|
||||
|
||||
[platformio]
|
||||
description = ESP32 Sensors node
|
81
ESP32-BME280/src/main.cpp
Normal file
81
ESP32-BME280/src/main.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
|
||||
//#include <Adafruit_BME280.h>
|
||||
//#include <Adafruit_BMP280.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
|
||||
//#define BME280
|
||||
|
||||
struct {
|
||||
float humidity = 0.0;
|
||||
float pressure = 0.0;
|
||||
float temperature = 0.0;
|
||||
} sensors_values;
|
||||
|
||||
void setup() {
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial.println();
|
||||
Serial.println("Running setup ...");
|
||||
sensors_values.humidity = 0.0;
|
||||
sensors_values.pressure = 0.0;
|
||||
sensors_values.temperature = 0.0;
|
||||
|
||||
byte error;
|
||||
uint8_t address;
|
||||
int dev = 0;
|
||||
for (address = 0x1; address < 0x127; address++) {
|
||||
Wire.begin(address);
|
||||
Wire.beginTransmission(address);
|
||||
error = Wire.endTransmission(address);
|
||||
Wire.end();
|
||||
if (error == 0) {
|
||||
Serial.print("I2C device found at address 0x");
|
||||
Serial.println(address, HEX);
|
||||
dev++;
|
||||
}
|
||||
else if (error == 4) {
|
||||
Serial.print("Unknown error at address 0x");
|
||||
Serial.println(address, HEX);
|
||||
}
|
||||
delay(500);
|
||||
}
|
||||
|
||||
/*#ifdef BME280
|
||||
Adafruit_BME280 bme;
|
||||
unsigned status = bme.begin(0x76); // I2C slave address 0x76 (SDO set to GND)
|
||||
if (!status) {
|
||||
Serial.println("Could not find a valid BME/BMP280 sensor, check wiring!");
|
||||
Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(), 16);
|
||||
Serial.print(" ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
|
||||
Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n");
|
||||
Serial.print(" ID of 0x60 represents a BME 280.\n");
|
||||
Serial.print(" ID of 0x61 represents a BME 680.\n");
|
||||
while (1) delay(10);
|
||||
}
|
||||
else {
|
||||
sensors_values.humidity = bme.readHumidity();
|
||||
sensors_values.pressure = bme.readPressure() / 100.0F;
|
||||
sensors_values.temperature = bme.readTemperature();
|
||||
}
|
||||
#endif
|
||||
#ifdef BMP280
|
||||
Adafruit_BMP280 bmp;
|
||||
unsigned status = bmp.begin(0x76);
|
||||
if (!status) {
|
||||
Serial.println("Could not find a valid BME/BMP280 sensor, check wiring!");
|
||||
Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(), 16);
|
||||
Serial.print(" ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
|
||||
Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n");
|
||||
Serial.print(" ID of 0x60 represents a BME 280.\n");
|
||||
Serial.print(" ID of 0x61 represents a BME 680.\n");
|
||||
while (1) delay(10);
|
||||
}
|
||||
else {}
|
||||
#endif*/
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
}
|
11
ESP32-BME280/test/README
Normal file
11
ESP32-BME280/test/README
Normal file
@ -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
|
5
ESP32-Bootstraps/.gitignore
vendored
Normal file
5
ESP32-Bootstraps/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
10
ESP32-Bootstraps/.vscode/extensions.json
vendored
Normal file
10
ESP32-Bootstraps/.vscode/extensions.json
vendored
Normal file
@ -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"
|
||||
]
|
||||
}
|
39
ESP32-Bootstraps/include/README
Normal file
39
ESP32-Bootstraps/include/README
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
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 usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
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
|
46
ESP32-Bootstraps/lib/README
Normal file
46
ESP32-Bootstraps/lib/README
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in a an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, 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
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
14
ESP32-Bootstraps/platformio.ini
Normal file
14
ESP32-Bootstraps/platformio.ini
Normal file
@ -0,0 +1,14 @@
|
||||
; 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:esp32dev]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
framework = arduino
|
18
ESP32-Bootstraps/src/main.cpp
Normal file
18
ESP32-Bootstraps/src/main.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
// put function declarations here:
|
||||
int myFunction(int, int);
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
int result = myFunction(2, 3);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
}
|
||||
|
||||
// put function definitions here:
|
||||
int myFunction(int x, int y) {
|
||||
return x + y;
|
||||
}
|
11
ESP32-Bootstraps/test/README
Normal file
11
ESP32-Bootstraps/test/README
Normal file
@ -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
|
27
README.md
27
README.md
@ -7,10 +7,10 @@ Eco-system of ESP32s Nodes and ATtiny85 peripherals with different functionaliti
|
||||
|
||||
<p><i>ESP32-Node Features:</i></p>
|
||||
|
||||
- ESP32-WROOM-32D Module [^1]
|
||||
- Uses bare-bones ESP32-WROOM-32D Module [^1]
|
||||
- Direct connections to all GPIOs
|
||||
- Miniature in size, only 35.7mm x 35.7mm
|
||||
- Built-in 3V3 voltage regulator (15V input max) and reversed supply voltage polarity protection
|
||||
- Miniature in size; only 35.7mm x 35.7mm
|
||||
- Built-in 3V3 voltage regulator (V<sub>max</sub>=15V) and reversed supply voltage polarity protection
|
||||
- Pre-wired strapping pins for ensuring proper booting on power-on
|
||||
- blue power-on LED
|
||||
- two programmable LEDs
|
||||
@ -46,7 +46,9 @@ Eco-system of ESP32s Nodes and ATtiny85 peripherals with different functionaliti
|
||||
[^1]: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
|
||||
|
||||
|
||||
### UART
|
||||
### Programming via UART
|
||||
|
||||
Bare-bones ESP32 module can be programmed via UART interface (`GPIO03` and `GPIO01`) using USB to UART adapter.
|
||||
|
||||
## Temperature Node Key Elements and Components
|
||||
|
||||
@ -54,17 +56,26 @@ The **Temperature Node** broadcasts the air temperature, atmospheric pressure an
|
||||
|
||||
### I2C Air Temperature, Pressure and Humidity Sensor Board (BME280)
|
||||
|
||||
The sensor board is 13mm by 10.5mm in size that provides the air temperature, pressure and humidity values over I2C protocol. Sensor board uses **BME280** IC.
|
||||
BME280 is combined temperature, humidity and pressure sensor. The unit combines high linearity and high accuracy sensors and is perfectly feasible for low current consumption, long-term stability and high EMC robustness. The humidity sensor offers an extremely fast response time and therefore supports performance requirements for emerging applications such as context awareness, and high accuracy over a wide temperature range.[^2]
|
||||
|
||||
<img alt="ESP32-Node Pinout" src="https://github.com/alexandrebobkov/ESP-Nodes/blob/main/assets/BME280.jpg" width="200px"/>
|
||||
|
||||
> [!IMPORTANT]
|
||||
> BM**E**280[^2] and BM**P**280[^3] look almost identical. However, BME280 sensor has a square form, while BMP280 has a rectangular form. In addition, the two sensor boards have different I2C addresses.
|
||||
> BM**E**280[^2] and BM**P**280[^3] look almost identical. However, BME280 sensor has a square form, while BMP280 has a rectangular form. In addition, the two sensor boards can have different I<sup>2</sup>C addresses.
|
||||
>
|
||||
> <img alt="ESP32-Node Pinout" src="https://github.com/alexandrebobkov/ESP-Nodes/blob/main/assets/BME280-BMP280.jpg" width="100px"/>
|
||||
|
||||
**4-pin variant**
|
||||
|
||||
The BME280 sensor board interface uses 4 pins and is 13mm by 10.5mm in size. The four pins are `VIN`, `GND`, `SCL` and `SDA`. The measured values are sent via I<sup>2</sup>C protocol. The I<sup>2</sup>C slave address is pre-defined and can take value either 0x76 or 0x77 (BME280 Datasheet, page 32)[^4].
|
||||
|
||||
### Wiring
|
||||
|
||||
[^2]: https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp280/
|
||||
[^3]: https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp280/
|
||||
| Pin | ESP32 GPIO |
|
||||
| --- | --- |
|
||||
| `SCL` | `GPIO22` |
|
||||
| `SDA ` | `GPIO21` |
|
||||
|
||||
[^2]: https://www.bosch-sensortec.com/products/environmental-sensors/humidity-sensors-bme280/
|
||||
[^3]: https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp280/
|
||||
[^4]: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf
|
Loading…
Reference in New Issue
Block a user