I can read Cozir CO2 sensor from direct GPIO but not through Grovepi's GPIO, help!

Dear Karan,

when I connect the Cozir CO2 sensor direclty to the GPIO I have no problem to read the data

but when I do via grovepi it sends me trash,

do you know how can I make it to work? thank you very much

Hi @annlee,

I am not sure where the problem is, Can you please post a picture of your setup with GrovePi, the code that you are using and also the link to the sensor which you are using.

-Shoban

Hi Shoban,

I belong to the annlee’s team and theese are the pictures of the setup with GrovePi. The code that we are using is the follow:

#Python app to run a Cozir Sensor
import serial
import time
ser = serial.Serial("/dev/ttyAMA0")
print “Serial Connected!”
ser.write(“K 2\r\n”)
ser.flushInput()
time.sleep(1)

while True:
ser.write(“Z\r\n”)
time.sleep(.01)
resp = ser.read(10)
resp = resp[:8]
print “”
print “”
fltCo2 = float(resp[2:])
print "Co2 = " + str(fltCo2)
time.sleep(1)

This code works fine when we connect directly to GPIO of Raspberry however, we get trash when we use through GROVEPI. The ports that we are using are: 3.3V, GND, TX and RX.

Thanks.

JuanMa.

Hi @jjurado,

Can you clarify if you are connecting the Co2 sensor with the GrovePi Serial port or the GrovePi RPiSER or the 26 pin header on GrovePi.
Do you have any other device or sensor connected to the Raspberry Pi other than the GrovePi?
Can you also send us a screenshot of the output that you are getting when you are running this code and also the picture of the setup with the Pi connected to GrovePi.

-Shoban

Hi Shoban i have connected the Co2 sensor using the 26 pin header on GrovePi like you can see in the previous image. I dont have any other device or sensor connected to the Raspberry Pi or GrovePi

The error that I get is this
:

This is the connection of the Cozir sensor to GrovePi. The setup with Pi connected to Grovepi is through 26 pin GPIO.

Thanks.

JuanMa

Hi @jjurado,

The issue that you are having in this post is the same as the one discussed here. Since its the same conversation, continue to post there, to help you better. You can look at that post for more information.