Browse Source

try SDS011

split_files
Hendrik Langer 6 years ago
parent
commit
2a1bf60861
  1. 14
      README.md
  2. 1
      platformio.ini
  3. 18
      src/main.cpp

14
README.md

@ -36,6 +36,20 @@ SDA | IO21 |
SDO | nc | SPI only
CS | nc | SPI only
### SDS011
Serial (HardwareSerial2)
SDS011 pin | ESP32 pin | Notes
-----------|-----------|----------
TXD | IO16 |
RXD | IO17 |
GND | GND |
25µm | nc |
5V | VUSB |
1µm | nc |
NC | nc |
## Build & Install
```bash

1
platformio.ini

@ -34,6 +34,7 @@ lib_deps =
Adafruit GFX Library
Adafruit BME280 Library
Adafruit Unified Sensor
SDS011 sensor Library
; ArduinoJSON
monitor_speed = 115200

18
src/main.cpp

@ -19,6 +19,8 @@
#include <Adafruit_Sensor.h>
#include "Adafruit_BME280.h"
#include <SDS011.h>
#include "XD0OTA.h"
#include "XD0MQTT.h"
@ -27,6 +29,8 @@ static const char* TAG = "MAIN";
WiFiMulti wifiMulti;
GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=SS*/ TFT_CS, /*DC=*/ TFT_DC, /*RST=*/ TFT_RST, /*BUSY=*/ -1)); // GDEH0213B72
Adafruit_BME280 bme; // I2C (also available: hardware SPI
SDS011 my_sds;
HardwareSerial serialport(2);
XD0MQTT mqtt;
@ -113,6 +117,9 @@ void setup()
bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
bme.setGasHeater(320, 150); // 320*C for 150 ms
*/
my_sds.begin(&serialport);
wifiMulti.addAP(WIFI_SSID, WIFI_PASSWD);
wifiMulti.addAP(WIFI_SSID2, WIFI_PASSWD2);
@ -153,6 +160,17 @@ void loop()
Serial.print("Gas = "); Serial.print(bme.gas_resistance / 1000.0); Serial.println(" KOhms");
display.print("Gas: "); display.print(bme.gas_resistance / 1000.0); display.println(" KOhms");
*/
float p10, p25;
int error;
error = my_sds.read(&p25, &p10);
if (!error) {
Serial.println("P.2.5: " + String(p25));
Serial.println("P10: " + String(p10));
}
printValues();
if(wifiMulti.run() != WL_CONNECTED) {

Loading…
Cancel
Save