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

switch sds library to SdsDustSensor.h #133

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
24 changes: 10 additions & 14 deletions templates/homev2_ethernet_feinstaub.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "model":"homeV2EthernetFeinstaub", "board": "senseBox:samd:sb"}
/*
senseBox:home - Citizen Sensingplatform
Version: ethernetv2_1.6.0
Version: ethernetv2_1.6.1
Date: 2022-03-04
Homepage: https://www.sensebox.de https://www.opensensemap.org
Author: Reedu GmbH & Co. KG
Expand All @@ -22,7 +22,7 @@
#include <Adafruit_BME680.h>
#include <Adafruit_HDC1000.h>
#include <VEML6070.h>
#include <SDS011-select-serial.h>
#include <SdsDustSensor.h>
#include <SparkFun_SCD30_Arduino_Library.h>
#include <LTR329.h>
#include <ArduinoBearSSL.h>
Expand Down Expand Up @@ -119,7 +119,7 @@ IPAddress mySubnet(255, 255, 255, 0);
VEML6070 VEML;
#endif
#ifdef SDS011_CONNECTED
SDS011 SDS(SDS_UART_PORT);
SdsDustSensor sds(SDS_UART_PORT);
#endif
#ifdef SMT50_CONNECTED
#define SOILTEMPPIN @@SOIL_DIGITAL_PORT|digitalPortToPortNumber@@
Expand Down Expand Up @@ -372,7 +372,8 @@ void setup() {
BME.setIIRFilterSize(BME680_FILTER_SIZE_3);
#endif
#ifdef SDS011_CONNECTED
SDS_UART_PORT.begin(9600);
sds.begin();
sds.setQueryReportingMode();
#endif
#ifdef SCD30_CONNECTED
Wire.begin();
Expand Down Expand Up @@ -424,17 +425,12 @@ void loop() {

//-----PM-----//
#ifdef SDS011_CONNECTED
uint8_t attempt = 0;
PmResult pm = sds.queryPm();
float pm10, pm25;
while (attempt < 5) {
bool error = SDS.read(&pm25, &pm10);
if (!error) {
addMeasurement(SDS011_PM10SENSOR_ID, pm10);
addMeasurement(SDS011_PM25SENSOR_ID, pm25);
break;
}
attempt++;
}
pm10 = pm.pm10;
pm25 = pm.pm25;
addMeasurement(SDS011_PM10SENSOR_ID, pm10);
addMeasurement(SDS011_PM25SENSOR_ID, pm25);
#endif

//-----Soil Temperature & Moisture-----//
Expand Down
33 changes: 14 additions & 19 deletions templates/homev2_lora.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <Adafruit_BMP280.h>
#include <Adafruit_BME680.h>
#include <VEML6070.h>
#include <SDS011-select-serial.h>
#include <SdsDustSensor.h>
#include <SparkFun_SCD30_Arduino_Library.h>
#include <LTR329.h>
#include <Adafruit_DPS310.h> // http://librarymanager/All#Adafruit_DPS310
Expand Down Expand Up @@ -86,9 +86,7 @@
uint16_t uv;
#endif
#ifdef SDS011_CONNECTED
SDS011 SDS(SDS_UART_PORT);
float pm10 = 0;
float pm25 = 0;
SdsDustSensor sds(SDS_UART_PORT);
#endif
#ifdef SMT50_CONNECTED
#define SOILTEMPPIN @@SOIL_DIGITAL_PORT|digitalPortToPortNumber@@
Expand Down Expand Up @@ -283,20 +281,16 @@ void do_send(osjob_t* j){

//-----PM-----//
#ifdef SDS011_CONNECTED
uint8_t attempt = 0;
while (attempt < 5) {
bool error = SDS.read(&pm25, &pm10);
if (!error) {
DEBUG(F("PM10: "));
DEBUG(pm10);
message.addUint16(pm10 * 10);
DEBUG(F("PM2.5: "));
DEBUG(pm25);
message.addUint16(pm25 * 10);
break;
}
attempt++;
}
PmResult pm = sds.queryPm();
float pm10, pm25;
pm10 = pm.pm10;
pm25 = pm.pm25;
DEBUG(F("PM10: "));
DEBUG(pm10);
message.addUint16(pm10 * 10);
DEBUG(F("PM2.5: "));
DEBUG(pm25);
message.addUint16(pm25 * 10);
#endif

//-----Soil Temperature & Moisture-----//
Expand Down Expand Up @@ -572,7 +566,8 @@ void setup() {
Lightsensor_begin();
#endif
#ifdef SDS011_CONNECTED
SDS_UART_PORT.begin(9600);
sds.begin();
sds.setQueryReportingMode();
#endif
#ifdef BME680_CONNECTED
BME.begin(0x76);
Expand Down
22 changes: 9 additions & 13 deletions templates/homev2_wifi_feinstaub.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <Adafruit_BMP280.h>
#include <Adafruit_BME680.h>
#include <VEML6070.h>
#include <SDS011-select-serial.h>
#include <SdsDustSensor.h>
#include <SparkFun_SCD30_Arduino_Library.h>
#include <LTR329.h>
#include <ArduinoBearSSL.h>
Expand Down Expand Up @@ -116,7 +116,7 @@ unsigned long getTime() {
VEML6070 VEML;
#endif
#ifdef SDS011_CONNECTED
SDS011 SDS(SDS_UART_PORT);
SdsDustSensor sds(SDS_UART_PORT);
#endif
#ifdef SMT50_CONNECTED
#define SOILTEMPPIN @@SOIL_DIGITAL_PORT|digitalPortToPortNumber@@
Expand Down Expand Up @@ -418,7 +418,8 @@ void setup() {
BME.setIIRFilterSize(BME680_FILTER_SIZE_3);
#endif
#ifdef SDS011_CONNECTED
SDS_UART_PORT.begin(9600);
sds.begin();
sds.setQueryReportingMode();
#endif
#ifdef SCD30_CONNECTED
Wire.begin();
Expand Down Expand Up @@ -484,17 +485,12 @@ void loop() {

//-----PM-----//
#ifdef SDS011_CONNECTED
uint8_t attempt = 0;
PmResult pm = sds.queryPm();
float pm10, pm25;
while (attempt < 5) {
bool error = SDS.read(&pm25, &pm10);
if (!error) {
addMeasurement(SDS011_PM10SENSOR_ID, pm10);
addMeasurement(SDS011_PM25SENSOR_ID, pm25);
break;
}
attempt++;
}
pm10 = pm.pm10;
pm25 = pm.pm25;
addMeasurement(SDS011_PM10SENSOR_ID, pm10);
addMeasurement(SDS011_PM25SENSOR_ID, pm25);
#endif

//-----Soil Temperature & Moisture-----//
Expand Down