Python Code for CO2 Sensor (Mac)

Hi,

I am trying to write a python code for CO2 Sensor CO2-W-TH for my Mac. My MacBook Pro has 4 usb-c ports and I can use either RS485 or Modbus TCP adapter to connect to CO2 sensor. I am using the below python code to auto-detect the usb-c port on which the sensor is connected and then read data from it.

Temco CO2.py (11.3 KB)

My CO2 sensor is set at 192.168.0.3 and my usb-c is set at 192.168.0.1 or 192.168.0.2

I am unable to communicate both on Windows or Mac with this code but the T3000 is able to communicate with the sensor on the Windows. Can anyone provide a python code to communicate with the CO2 sensor as my code is not working

Sounds like a great project, I am going to get one of our developers to help out. Unfortunately the local CNY holiday has just kicked in. I might have one person who can help out during the holiday though, stand by for some news soon.

There are a few things you can confirm in the meantime:

Make sure the communications settings for the Co2 sensor match the settings from your code. Baud rate, parity and network ID all have to match whatever you have set up on the device.

Use a Modbus testing tool (like Modbus Poll or QModMaster) to manually connect to the sensor and attempt to read the registers. This can help determine if the issue is with the sensor or the application.

Use a serial port logging tool to check at the packet level what is going on. You canb connect with T3000 and watch the packets and then compare with your program. We use Docklight for windows for this sort of debugging, I see there’s one called coolterm for Mac: https://freeware.the-meiers.org/