I tried multiple way to connect the MH-Z19B using Mycodo interface. First of all, using the mh-z19 3.1.1 project, I can easily retrieve data from the /dev/ttyS0 over a SSH connection to the pi with sudo python -m mh_z19 --all. That means, the sensor is working.
Now when I configure Mycodo mh-z19b input, there is nothing happening when trying to read the values. I had configured it to use /dev/ttyS0 and I also tried using a UART-USB converter instead of the TX-RX GPIO pins, not much success.
I don’t know what’s happening, but here is the log about the moment when mycodo tries to acquire data.
2022-01-29 10:40:31,407 - INFO - mycodo.controllers.controller_input_bd84bcbf - Activated in 403.7 ms
2022-01-29 10:40:31,407 - DEBUG - mycodo.daemon - Input controller with ID bd84bcbf-2890-45c0-bd69-9d9f0e392c39 activated.
2022-01-29 10:40:32,420 - DEBUG - mycodo.inputs.mh_z19b_bd84bcbf - No response
2022-01-29 10:40:32,456 - DEBUG - mycodo.controllers.controller_input_bd84bcbf - Adding measurements to InfluxDB with ID bd84bcbf-2890-45c0-bd69-9d9f0e392c39: {}
2022-01-29 10:40:37,407 - ERROR - mycodo.controllers.controller_input_670a2d3b - StopIteration raised 3 times. Possibly could not read input. Ensure it’s connected properly and detected.
2022-01-29 10:40:40,998 - ERROR - mycodo.controllers.controller_input_8a9cea18 - Mycodo is attempting to acquire measurement(s) from an Input that has already critically errored. Review the log lines following Input Activation to investigate why this happened.
Also, I did use a 5k resistor between my VCC and Tx, I really don’t know what to do from know since I can get reading through mh_z19.read() over ssh.
Providing just an error is not enough information to replicate your environment or diagnose the issue. You need to provide details about the physical connections as well as the software settings used to be able to investigate the issue.
Also, are you sure you have a MH-Z19B and not a MH-Z19? It looks like it’s failing on ABC, which is only present in the B version.
Physical connections of the hardware, any and all settings you configured in software… all of these are needed to diagnose an issue. None should be assumed.