I have built a circuit board that includes a BLE module and an oxygen sensor that has a UART. Writing arbitrary data to the BLE works fine, but for some reason every configuration of SoftwareSerial I can think of will not pick up anything from the oxygen sensor TX. It simply never has any bytes available.

Here's the code:

#include <SoftwareSerial.h>

const int HM10_TX = 8;
const int HM10_RX = 9;
const int LOXO2_TX = A6;
const int LOXO2_RX = A7;

SoftwareSerial BLE(HM10_RX, HM10_TX);
SoftwareSerial oxygen(LOXO2_RX, LOXO2_TX);

void setup() {      

void loop() {
  if (oxygen.available() > 0) {

Meanwhile, I uploaded a short serial passthrough sketch to an Uno, connected probes between it and directly to the pins on the Nano that are used for the O2 sensor TX/RX, and I can see the expected bytes being received in my serial monitor. So I'm 99% sure the problem isn't with the sensor. Maybe the circuit, but so far I don't seem to have evidence of that.

I've been under the impression that any pin on the Nano can be used with SoftwareSerial. All the reading I've done hasn't yielded any useful information as to why nothing is being read when clearly there are voltage changes on the pin that are being picked up by the Uno.

The reason I'm not using hardware serial is I will be using multiple sensors and the hardware serial pins need to be available for USB.

Am I doing something wrong? The passthrough code I write for the Uno really isn't that different from the above code except it's of course using the hardware serial so I can observe the serial output on my laptop.

  • which oxygen sensor are you using? ... how is everything connected? ... please draw a connection diagram
    – jsotola
    Nov 1 '21 at 1:08
  • 2
    A6 and A7 are analog input only and not available on Uno.
    – Juraj
    Nov 1 '21 at 5:15
  • @Juraj I think you meant the Nano? This is really disappointing to learn. I did a lot of reading before building my PCB, and nothing I found said there were any particular pins on the Nano or Uno that couldn't be used for SoftwareSerial. Fortunately I designed extra holes on my PCB for the only few digital pins I have left, so I can add jumpers that should make my project feasible. Thanks for the help!
    – user10800
    Nov 1 '21 at 14:05
  • Uno doesn't have A6 and A7 so your sketch can't work on Uno as it is
    – Juraj
    Nov 1 '21 at 18:21