The Things Uno RX and TX pins for sensor

Bacause of some troubles with a Dragino Uno LoRa shield I ordered the The Things Uno board which works like a charm with the TTN library for the RN2483A as used on the TT-Uno.

As far as I know the TT Uno uses pins 0 and 1 for RX and TX and they are occupied. My sketch also uses pins 0 and 1 so there is a conflict and I need to modify the sketch to use SoftSerial for the RX and TX for my sensor using two other pins like 3 and 4.

I’m not experienced with Leonardo (board used for TT Uno) and do not know how to define other pins for my sensor as TX and RX. Can someone advice me how to do this?

Not all pins on the Leonardo support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

Hi BoRRoZ. Following your advice (link) I have modified my skech (see below) but it still reports the sensor is not available. Can you be more specific?


#include “SdsDustSensor.h”
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX
SdsDustSensor sds(10, 11); // RX, TX

void setup() {
mySerial.begin(9600); // for Nova SDS011
Serial.begin(9600);
sds.begin();

what do you expect to see and how (serial monitor?)

some examples

and

https://revspace.nl/LoraWanDustSensor#Source_code

The sketch below works on the The Things Uno board as long as I do not use the LoRa functions/library, I need to modify this sketch to use other pins for the sensor RX/TX (10/11?) and still use 0/1 for the LoRa part.


#include “SdsDustSensor.h”

SdsDustSensor sds(Serial1);
long interval = 300000;

void setup() {
delay(2000);
Serial.begin(9600);
delay(1000);
sds.begin();
delay(1000);
}

void loop() {
sds.wakeup();
delay(1000);
Serial.println(“Fan ON for 30 seconds”);
delay(30000);
PmResult pm = sds.queryPm();
delay(1000);
if (pm.isOk()) {
Serial.print("PM2.5 = “);
Serial.print(pm.pm25);
Serial.print(”, PM10 = ");
Serial.println(pm.pm10);
} else {
Serial.print("Could not read values from sensor, reason: ");
Serial.println(pm.statusToString());
}
WorkingStateResult state = sds.sleep();
delay(1000);
if (state.isWorking()) {
Serial.println(“Problem with sleeping the sensor.”);
} else {
Serial.print(“Sensor sleeps for “);
Serial.print(interval / 1000);
Serial.println(” seconds”);
delay(interval);
}
}

it’s not only the pins… also the timing I think.

I have a working sketch somewhere will search

Would be great, thanks so far!

found the link


Thanks, this will be to key for the job!