I know that this is probably me just missing something, but I seriously can't seem to work out what it is. I literally have nothing but the SDS powered via an external 5V supply, with TX and RX connected to RX2 and TX2 of my ESP32 and the grounds connected up. The ESP32 is powered via the USB connection to my PC.
Running the HardwareSerial example sketch with the line HardwareSerial port(2) returns nothing - I'm getting an error value when calling my_sds.read(&p25, &p10)
Am I going crazy? I feel like this is the minimal possible setup for this sensor and it doesn't work, so I'm not really sure what else to try. No other SDS libraries seem to work either, but this seems to be the most popular so I thought I'd ask for a hand here!
#include <SDS011.h>
float p10, p25;
int err;
HardwareSerial port(2);
SDS011 my_sds;
void setup() {
Serial.begin(115200);
my_sds.begin(&port);
}
void loop() {
err = my_sds.read(&p25, &p10);
if (!err) {
Serial.println("P2.5: " + String(p25));
Serial.println("P10: " + String(p10));
} else {
Serial.println("Error: " + String(err));
}
delay(100);
}
I know that this is probably me just missing something, but I seriously can't seem to work out what it is. I literally have nothing but the SDS powered via an external 5V supply, with TX and RX connected to RX2 and TX2 of my ESP32 and the grounds connected up. The ESP32 is powered via the USB connection to my PC.
Running the HardwareSerial example sketch with the line
HardwareSerial port(2)returns nothing - I'm getting an error value when callingmy_sds.read(&p25, &p10)Am I going crazy? I feel like this is the minimal possible setup for this sensor and it doesn't work, so I'm not really sure what else to try. No other SDS libraries seem to work either, but this seems to be the most popular so I thought I'd ask for a hand here!