Temp, Humidity CO2 sensor and library.

yes it displayed this

ÿÿ

I have connected sensor RX -> with Arduino pin#3
and sensor TX _> with pin #2

I added Serial.println("test");

it displayed this text on monitor...
strangely I have to re insert the wire connecting the sensor's RX with microcontroller pin#3 in order to display the text on the serial monitor.

ajaved200:
yes it displayed this

ÿÿ

I have connected sensor RX -> with Arduino pin#3
and sensor TX _> with pin #2

that means you have made a hard wired connection between the hardware Serial and the software serial.
The if statement in the code should do the copying but only if there is data available on the SW serial.
the yy indicates there is nothing to read() (In fact it is ASCII char 255 or -1)

#include <SoftwareSerial.h>

SoftwareSerial nss(3,2);

void setup()
{
  Serial.begin(9600); 
  nss.begin(9600);
  delay(3000);
  nss.println("z")
}

void loop()
{
  if (nss.available() > 0) 
  {
    Serial.write(nss.read());
  }
}

slightly different, added a "z" to tickle the sensor, and an explicit >0 test
can you try?

I tried this as well.. still showing "ÿ"

robtillaart:

#include <SoftwareSerial.h>

SoftwareSerial nss(3,2);

void setup()
{
  Serial.begin(9600);
  nss.begin(9600);
  delay(3000);
  nss.println("z")
}

void loop()
{
  if (nss.available() > 0)
  {
    Serial.write(nss.read());
  }
}




slightly different, added a "z" to tickle the sensor, and an explicit >0 test 
can you try?

Which version of the IDE are you using?
Which board? UNO/MEGA?
The COZIR is connected to pin 2 and 3 I assumed....Right?

I am using audrino UNO and yess cozir is connected with pin 2 and pin 3

i tried with audrino v 1.0.5 and v 1.0.3 as well

I'm out of options now, as said before I do not have such sensor to replicate your project, sorry

I can understand. Thanks a lot for your help.

I posted the Cozir library to github for convenience (and a project that I was working on).

For anyone is using a Pinoccio (https://pinocc.io), which uses the ATmega2560 chip:

I used SCK as pin 11 and MISO as pin 12

SoftwareSerial nss(11,12);

Interestingly as soon as I take a reading in my loop:

lcd.setCursor(0,0);lcd.print("CO2 : "); lcd.print(czr.CO2());

My ads1115 running on the i2c bus stops taking readings!

If I rem this line out, it works fine??

The CO2 reading works fine anyway.

nterestingly as soon as I take a reading in my loop:
lcd.setCursor(0,0);lcd.print("CO2 : "); lcd.print(czr.CO2());
My ads1115 running on the i2c bus stops taking readings!
If I rem this line out, it works fine??
The CO2 reading works fine anyway.

The I2C communication might be corrupted by the LCD communication. How is the LCD connected?

do you have pull ups on the I2C lines?

Wow, you are a great help to the community!

Yes I am using an i2c LCD but like I say, it works fine if I remark out any lines that read the cozir, but as soon as I take a reading from the cozir, the communication with the adc on the i2c bus stops!

My sketch takes a reading from the adc first, this works and is displayed on the lcd (and the serial monitor), then a CO2 which works fine, on the next loop (as a CO2 reading has now been taken) the adc (ads1115) returns nothing!

Very strange.

I thought the pullup resistors are internal to the atmega, I am using an Uno.

Should I disable them? I think they are software turn offable.

I am no EE but IIRC the internal pullups are not the right size.
the longer the wires the lower the pullups should be.

Interestingly, if I pull the LCD out completely, no change (as I half expected)

If I pull the CO2 out of pins 2 & 3, the ADS1115 works fine (as I also half expected)

If I try the softwareserial on pins 10&11, I accidentally plugged in back to front, the ADC worked fine, as soon as I turned the CO2 round the right way, the ADC stopped reading.

Must be a conflict in the code?

I will try the alternative sample code maybe?

Can it be that all the devices together draw to much current, thereby corrupting signals.??

No as the lcd is 40ma and when I unplug that, it still plays up yet I can even run a TIP120 or other devices. The USB is 500ma and so I am not sure.

I appreciate your help.

I am a bit stuck.