-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from kike-canaries/esp32-s3
ESP32S3 T-Display Multivariable-Multisensor example
- Loading branch information
Showing
6 changed files
with
163 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
; CanAirIO Sensors Library | ||
; Author: @hpsaturn | ||
; 20230129 | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
; | ||
; Basic multivariable multisensor example for | ||
; TTGO T-Display S3 (LilyGO board). | ||
; | ||
; https://github.com/kike-canaries/canairio_sensorlib | ||
|
||
[platformio] | ||
src_dir = . | ||
lib_dir = ../.. | ||
extra_configs = ../../unified-lib-deps.ini | ||
|
||
[wifi] | ||
ssid = ${sysenv.PIO_WIFI_SSID} | ||
password = ${sysenv.PIO_WIFI_PASSWORD} | ||
|
||
[env] | ||
framework = arduino | ||
upload_speed = 1500000 | ||
monitor_speed = 115200 | ||
build_flags = | ||
'-DWIFI_SSID="${wifi.ssid}"' | ||
'-DWIFI_PASS="${wifi.password}"' | ||
-D CORE_DEBUG_LEVEL=0 | ||
lib_deps = ${commonlibs.lib_deps} | ||
|
||
[env:esp32s3] | ||
framework = ${env.framework} | ||
upload_speed = ${env.upload_speed} | ||
monitor_speed = ${env.monitor_speed} | ||
platform = espressif32 @ 5.0.0 | ||
board = esp32-s3-devkitc-1 | ||
platform_packages = framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.3 | ||
lib_deps = ${env.lib_deps} | ||
build_flags = | ||
${env.build_flags} | ||
-DBOARD_HAS_PSRAM | ||
-DARDUINO_USB_MODE=1 | ||
-DARDUINO_USB_CDC_ON_BOOT=1 | ||
|
||
board_build.partitions = default_8MB.csv | ||
board_build.arduino.memory_type = qspi_opi | ||
board_build.flash_size = 8MB | ||
board_build.psram_type = opi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* @file main.cpp | ||
* @author Antonio Vanegas @hpsaturn | ||
* @date June 2018 - 2022 | ||
* @brief CanAirIO Sensorslib tests | ||
* @license GPL3 | ||
* | ||
* Full documentation: | ||
* https://github.com/kike-canaries/canairio_sensorlib#canairio-air-quality-sensors-library | ||
* | ||
* Full implementation for WiFi and Bluetooth Air Quality fixed and mobile station: | ||
* https://github.com/kike-canaries/canairio_firmware#canairio-firmware | ||
* | ||
* CanAirIO project documentation: | ||
* https://canair.io/docs | ||
*/ | ||
|
||
#include <Arduino.h> | ||
#include <Sensors.hpp> | ||
|
||
#define PIN_POWER_ON 15 // T-Display S3 Power pin | ||
|
||
void printSensorsDetected() { | ||
uint16_t sensors_count = sensors.getSensorsRegisteredCount(); | ||
uint16_t units_count = sensors.getUnitsRegisteredCount(); | ||
Serial.println("-->[MAIN] Sensors detected count\t: " + String(sensors_count)); | ||
Serial.println("-->[MAIN] Sensors units count \t: " + String(units_count)); | ||
Serial.print( "-->[MAIN] Sensors devices names\t: "); | ||
int i = 0; | ||
while (sensors.getSensorsRegistered()[i++] != 0) { | ||
Serial.print(sensors.getSensorName((SENSORS)sensors.getSensorsRegistered()[i - 1])); | ||
Serial.print(","); | ||
} | ||
Serial.println(); | ||
} | ||
|
||
void printSensorsValues() { | ||
Serial.println("-->[MAIN] Preview sensor values:"); | ||
UNIT unit = sensors.getNextUnit(); | ||
while(unit != UNIT::NUNIT) { | ||
String uName = sensors.getUnitName(unit); | ||
float uValue = sensors.getUnitValue(unit); | ||
String uSymb = sensors.getUnitSymbol(unit); | ||
Serial.printf("-->[MAIN] %s:\t%02.1f\t%s\n", uName.c_str(), uValue, uSymb.c_str()); | ||
unit = sensors.getNextUnit(); | ||
} | ||
} | ||
|
||
void onSensorDataOk() { | ||
Serial.println("======= E X A M P L E T E S T ========="); | ||
printSensorsDetected(); | ||
printSensorsValues(); | ||
} | ||
|
||
void onSensorDataError(const char * msg){ | ||
} | ||
/****************************************************************************** | ||
* M A I N | ||
******************************************************************************/ | ||
|
||
void setup() { | ||
pinMode(PIN_POWER_ON, OUTPUT); | ||
digitalWrite(PIN_POWER_ON, HIGH); | ||
delay(1000); // Wait on T-Display S3 power on | ||
Serial.begin(115200); | ||
delay(5000); // Wait on T-Display S3 power on | ||
Serial.println("\n== Sensor test setup ==\n"); | ||
Serial.println("-->[SETUP] Detecting sensors.."); | ||
|
||
Wire.begin(43,44); // enable i2c for T-Display S3 board | ||
|
||
sensors.setSampleTime(5); // config sensors sample time interval | ||
sensors.setOnDataCallBack(&onSensorDataOk); // all data read callback | ||
sensors.setDebugMode(true); // [optional] debug mode | ||
sensors.detectI2COnly(true); // disable force to only i2c sensors | ||
sensors.init(); // Auto detection to UART and i2c sensors | ||
delay(500); | ||
} | ||
|
||
void loop() { | ||
sensors.loop(); // read sensor data and showed it | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[commonlibs] | ||
lib_deps = | ||
adafruit/Adafruit Unified Sensor @ 1.1.7 | ||
adafruit/Adafruit BME280 Library @ 2.2.2 | ||
adafruit/Adafruit BMP280 Library @ 2.6.6 | ||
adafruit/Adafruit BME680 Library @ 2.0.2 | ||
adafruit/Adafruit SHT31 Library @ 2.2.0 | ||
adafruit/Adafruit SCD30 @ 1.0.9 | ||
adafruit/Adafruit BusIO @ 1.14.1 | ||
robtillaart/AM232X @ 0.4.5 | ||
paulvha/sps30 @ 1.4.16 | ||
wifwaf/MH-Z19 @ 1.5.4 | ||
jcomas/S8_UART @ 1.0.1 | ||
sensirion/Sensirion Core @ 0.6.0 | ||
sensirion/Sensirion I2C SCD4x @ 0.3.1 | ||
https://github.com/enjoyneering/AHTxx.git#eb21571 | ||
https://github.com/hpsaturn/DHT_nonblocking.git#ec6e5b9 | ||
https://github.com/paulvha/SN-GCJA5.git#f261968 | ||
https://github.com/jcomas/CM1106_UART.git#da0eb4e |