Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32S3 T-Display Multivariable-Multisensor example #162

Merged
merged 6 commits into from
Jan 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ jobs:
python -m pip install --upgrade pip
pip install -U platformio
pio pkg update
- name: Submitted library code tests
- name: Basic Arduino IDE example test
run: |
pio run
- name: PlatformIO registry test (M5CoreInk example)
cd examples/advanced_sensirion
pio run -s
- name: PlatformIO registry test (M5CoreInk project)
run: |
git clone https://github.com/hpsaturn/co2_m5coreink.git
cd co2_m5coreink
pio run
- name: Arduino IDE example test
pio run -s
- name: All archictures tests
run: |
cd examples/advanced_sensirion
pio run

22 changes: 2 additions & 20 deletions examples/advanced_sensirion/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[platformio]
src_dir = .
lib_dir = ../..
extra_configs = ../../unified-lib-deps.ini

[wifi]
ssid = ${sysenv.PIO_WIFI_SSID}
Expand All @@ -24,26 +25,7 @@ build_flags =
'-DWIFI_SSID="${wifi.ssid}"'
'-DWIFI_PASS="${wifi.password}"'
-D CORE_DEBUG_LEVEL=0
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


lib_deps = ${commonlibs.lib_deps}

[env:esp32dev]
platform = espressif32
Expand Down
50 changes: 50 additions & 0 deletions examples/ttgo_tdisplay_s3/platformio.ini
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


82 changes: 82 additions & 0 deletions examples/ttgo_tdisplay_s3/src/main.cpp
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
}
23 changes: 3 additions & 20 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[platformio]
src_dir = ./examples/
lib_dir = ./
extra_configs = unified-lib-deps.ini

[env]
framework = arduino
Expand All @@ -17,29 +18,11 @@ build_flags =
; -D DHT11_ENABLED=1 // Deprecated, please change this old sensor
; -D DHT_SENSOR_TYPE=2
; -D DHT_SENSOR_PIN=19
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
lib_deps = ${commonlibs.lib_deps}

[common]
framework = ${env.framework}
; upload_speed = ${env.upload_speed}
upload_speed = ${env.upload_speed}
monitor_speed = ${env.monitor_speed}
build_flags = ${env.build_flags}
lib_deps = ${env.lib_deps}
Expand Down
19 changes: 19 additions & 0 deletions unified-lib-deps.ini
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