CO2 Telaire T6713 Sensor and Raspberry Pi 3B+

15 Views Asked by At

I have been trying to configure the sensor with RPi but without any success. The output of the code shown below is always 256. The formula for calculating co2 ppm is ppm=256*MSB+LSB. Everything is in the datasheet on page 17 (how to make communication): https://www.amphenol-sensors.com/hubfs/Documents/AAS-916-142A-Telaire-T67xx-CO2-Sensor-022719-web.pdf

The code, which I have written is shown below.

Can someone please help?

from smbus2 import SMBus
import time

# Konstanten
T67XX_SENSOR_ADDRESS = 0x15  # Sensoradresse
I2C_BUS_NUMBER = 1          # I2C Bus Nummer
READ_CO2_COMMAND = [0x04, 0x13, 0x8B, 0x00, 0x01]  # Befehl, um CO2-Messwerte zu lesen

try:
    with SMBus(I2C_BUS_NUMBER) as bus:
        while True:
            try:
                bus.write_i2c_block_data(T67XX_SENSOR_ADDRESS, 0x00, READ_CO2_COMMAND)
                response = bus.read_i2c_block_data(T67XX_SENSOR_ADDRESS, 0x00, 4)
                ppm = response[2] * 256 + response[3]
                print(f"CO2-Konzentration: {ppm} ppm")
            except Exception as e:
                print(f"Fehler bei der Messung: {e}")
            time.sleep(5)
except Exception as e:
    print(f"Fehler beim Initialisieren des I2C-Busses: {e}")
0

There are 0 best solutions below