Problem reading serial data from COZIR sensor

Hi everyone.
First project here. Trying to read data from a COZIR Temp/Humidity/CO2 sensor:

TX is hooked up to RX(14) on the Boron. + to +3.3 , and Ground common.

I have flashed the following code to try to verify that I am receiving data:

void setup() {

    Serial.begin();
    Serial1.begin(9600);
    while(!Serial.isConnected()) Particle.process();
    Serial.println("Test Serial Output..");
}

void loop() {

  while(Serial1.available()) {
      Serial.println("data : ");
      Serial.println(Serial1.read());
      }
  
}

All i get in my terminal is “Test Serial Output…” and then nothing.
What am I missing?

Have you got another device to test the code with? (another transmitter or a selftest by bridging RX<->TX and have the Boron Serial1.print() to its own RX toSerial1.read() that back).
Can you try also connecting Boron TX to sensor RX?
Can you check whether the sensor is actually sending data (e.g. with an oscilloscope)?

You could also just have a jumper wire to D7 and use the onboard LED to visualise whether the sensor actually sends data.
But due to some device OS quirk you’d need to set pinMode(D7, INPUT); since currently it’s set to OUTPUT by default (that will be fixed soon).

Its sending data now.
I checked with an LED.
It was a bad row on the breadboard?! tried a different bb … and it receives data now.
Thanks !

1 Like