Grove CO2 Sensor with Electron


#1

I am trying to interface a Grove CO2 Sensor with my Electron. I followed the tutorial here by @peekay123 and am running into the following issues:

1. Serial1 unavailable:
In setup, I’ve added a check to see if communication between the Electron and the sensor has been established using a
while(!Serial1.available()){ Serial.println("Waiting for connection");} Serial.println("Connected!");
Serial1 remains unavailable forever until I touch (barely nudge) the TX-RX wires between the sensor and the Electron. I am certain there are no loose connections. I know this because once the Serial1 becomes available after nudging the connection wires, it goes back to “Unavailable” when I merely reset the board without disturbing anything. I’m having to do this each time!

2. Checksum Fails:
According to the datasheet for the grove CO2 sensor:

In code,
(1 + (0xFF ^ (byte)(data[1] + data[2] + data[3] + data[4] + data[5] + data[6] + data[7]))) != data[8]) - This check is always failing!

Here is the output I get:

3. Wrong CO2 Values:
I’m guessing this is due to obvious reasons ( 1 & 2).

Setup Background:

  • Electron is connected to my Laptop and a 3.7V LiPo
  • Sensor - Electron mapping: Vcc -> Vin (>=4.5V) , GND -> GND, RX -> TX, TX -> RX
  • For gas and calibration: const unsigned char cmd_get_sensor[] = { 0xff, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79};
  • Serial.begin(9600); Serial1.begin(9600); [ tried Serial.begin(115200); too - no change in result]

Much appreciate the help!


#2

Hoping to get some help on this… any thoughts? Thank you!

@KyleG ?


#3

Let me ping someone that might be able to help, @rickkas7 are you able to assist?

Kyle