Is there anybody who succeeded to get a sds011 dust sensor working with a cubecell AB01 dev Board.
I tried with platformIo and the use of the SdsDustSensor library
When compiling the code I get an error:
c:/users/peter/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: .pio\build\cubecell_board_plus\lib910\libNova Fitness Sds dust sensors library.a(SdsDustSensor.cpp.o): in function SdsDustSensor::readIntoBytes(unsigned char)': SdsDustSensor.cpp:(.text._ZN13SdsDustSensor13readIntoBytesEh+0x5a): undefined reference to
yield()’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\cubecell_board_plus\firmware.elf] Error 1
Investigating the error I concluded that this library is not suitable for the cubecell development board.
Any suggestion for a working library/example for this sensor on the cubecell developmentboard is welcome
Below here the code I used.
#include <Arduino.h>
#include <softSerial.h>
#include <SdsDustSensor.h>
/* SDS011 Dust Sensor */
const int SDS_RX_PIN = GPIO1; // GPIO1 -> SDS011 TX pin
const int SDS_TX_PIN = GPIO5; // GPIO5 -> SDS011 TX pin
SoftwareSerial softwareSerial(SDS_RX_PIN, SDS_TX_PIN);
SdsDustSensor sds(softwareSerial); // additional parameters: retryDelayMs and maxRetriesNotAvailable
const int MINUTE = 60000;
const int WAKEUP_WORKING_TIME = 30000; // 30 seconds.
const int MEASUREMENT_INTERVAL = 5 * MINUTE;
void setup() {
Serial.begin(115200);
// Vext ON
pinMode(Vext, OUTPUT);
digitalWrite(Vext, LOW);
delay(10);
/* SDS011 Dust Sensor */
Serial.println("SDS011 dust sensor");
delay(500);
sds.begin();
// Prints SDS011 firmware version:
Serial.print("SDS011 ");
Serial.println(sds.queryFirmwareVersion().toString());
// Ensures SDS011 is in 'query' reporting mode:
Serial.println(sds.setQueryReportingMode().toString());
}
void loop() {
// Wake up SDS011
sds.wakeup();
delay(WAKEUP_WORKING_TIME);
// Get data from SDS011
PmResult pm = sds.queryPm();
if (pm.isOk()) {
Serial.print("PM2.5 = ");
Serial.print(pm.pm25); // float, μg/m3
Serial.print(", PM10 = ");
Serial.println(pm.pm10);
} else {
Serial.print("Could not read values from sensor, reason: ");
Serial.println(pm.statusToString());
}
// Put SDS011 back to sleep
WorkingStateResult state = sds.sleep();
if (state.isWorking()) {
Serial.println("Problem with sleeping the SDS011 sensor.");
} else {
Serial.println("SDS011 sensor is sleeping");
delay(MEASUREMENT_INTERVAL);
}
}