MH-Z19B C02 sensors...
 
Notifications
Clear all

[Solved] MH-Z19B C02 sensors with UART-to-USB adapters  

Page 2 / 2
  RSS

Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 6 years ago
Posts: 275
April 20, 2020 5:57 pm  

Great! Glad to hear. I'll add your info to the USB Persistence section of the manual.

Mycodo Developer


ReplyQuote
carboncycle
(@carboncycle)
Eminent Member
Joined: 9 months ago
Posts: 22
July 22, 2020 9:48 pm  

That's the tool I use to make the boards unique that I offer on Tindie.   The FTDI parts are a PITA and usually the 2102 is plentiful. Beware, the last batch I received are not functional.  The back of the board has "HW" and "hw-199" on the back.  The good parts I've used have no markings besides a white block with no text.


ReplyQuote
carboncycle
(@carboncycle)
Eminent Member
Joined: 9 months ago
Posts: 22
July 28, 2020 11:09 pm  

I've figured out the problem with the adapter boards - actually there are two at least. First is a mistake on the PCB that causes the 3.3v output to be 4.1v or so.  I don't use that output.  The second is the lack of proper polyfuse on the 5v line.  These boards have a zero ohm resistor ( a jumper ) in that position.  That makes it unusable for resale. I only have a few known good boards left - I'm probably going to try AliExpress to find alternates. The problem is pretty well documented and seems to affect most of the boards I see on sale.

 

I just installed the newest release 8.6.4 to test some MH-Z19B sensors and I think there may be a bug introduced when you have more than one MH-Z19 sensor.  The error in the daemon log is:

 

2020-07-28 19:56:41,175 - ERROR - mycodo.inputs.mh_z19b_b6c4f2b0 - get_measurement()
Traceback (most recent call last):
File "/home/pi/Mycodo/mycodo/inputs/mh_z19b.py", line 176, in get_measurement
if resp[0] != 0xff or resp[1] != 0x86:
IndexError: index out of range

 

I'll do more testing, to be sure before I open a bug.


ReplyQuote
carboncycle
(@carboncycle)
Eminent Member
Joined: 9 months ago
Posts: 22
July 28, 2020 11:56 pm  

Was testing the ABC function, that seems to work.  Usually I get detailed test reports with the sensors.  This shipment didn't have that documentation, and as I'm checking I think these are not properly open-air calibrated.  My test rig has a trusty MH-Z16 that can detect levels lower than 400ppm.  Fun fact - the MH-Z19B is not designed to read concentrations lower than 400ppm.   I've seen plenty (~100-150 ppm) drift over months with that sensor.

There are reasons why I suggest MH-Z16.  That model has an ABC function as well IIRC. I have the MH-z14 but haven't tested that one yet.  The design implementation of these various models have interesting quirks.  The actual deployment environment intended is part of the why of that.


ReplyQuote
carboncycle
(@carboncycle)
Eminent Member
Joined: 9 months ago
Posts: 22
August 6, 2020 9:31 pm  

I've been trying to get a Mycodo deploy to work with the MH-Z16 and MH-Z19 sensors.   I saw bug report #804 and think its related.

I haven't opened a bug yet - was thinking to fork again and perhaps help with fixing these.  

2020-08-06 17:54:36,916 - INFO - mycodo.daemon - Mycodo daemon started in 1.725 seconds
2020-08-06 17:54:37,214 - INFO - mycodo.daemon - 38.53 MB RAM in use
2020-08-06 17:57:45,584 - INFO - mycodo.controllers.controller_input_7e3de6b3 - Activated in 306.2 ms
2020-08-06 17:58:02,590 - ERROR - mycodo.inputs.mh_z16_7e3de6b3 - Cannot set a value of None. Must be a float or string representing a float. Check the sensor and Input module is working correctly.
2020-08-06 17:58:17,543 - ERROR - mycodo.inputs.mh_z16_7e3de6b3 - Cannot set a value of None. Must be a float or string representing a float. Check the sensor and Input module is working correctly.
2020-08-06 17:58:32,596 - ERROR - mycodo.inputs.mh_z16_7e3de6b3 - Cannot set a value of None. Must be a float or string representing a float. Check the sensor and Input module is working correctly.
2020-08-06 17:58:47,543 - ERROR - mycodo.inputs.mh_z16_7e3de6b3 - Cannot set a value of None. Must be a float or string representing a float. Check the sensor and Input module is working correctly.
2020-08-06 17:58:56,561 - INFO - mycodo.controllers.controller_input_4d4df21b - Activated in 414.6 ms
2020-08-06 17:58:57,580 - ERROR - mycodo.inputs.mh_z19b_4d4df21b - get_measurement()
Traceback (most recent call last):
  File "/home/pi/Mycodo/mycodo/inputs/mh_z19b.py", line 176, in get_measurement
    if resp[0] != 0xff or resp[1] != 0x86:
IndexError: index out of range
2020-08-06 17:58:57,604 - DEBUG - mycodo.controllers.controller_input_4d4df21b - Adding measurements to InfluxDB with ID 4d4df21b-348c-4a4f-8dc3-45ce26e2b7e4: {}
2020-08-06 17:59:02,516 - ERROR - mycodo.inputs.mh_z16_7e3de6b3 - Cannot set a value of None. Must be a float or string representing a float. Check the sensor and Input module is working correctly.
2020-08-06 17:59:12,445 - ERROR - mycodo.inputs.mh_z19b_4d4df21b - get_measurement()
Traceback (most recent call last):
  File "/home/pi/Mycodo/mycodo/inputs/mh_z19b.py", line 176, in get_measurement
    if resp[0] != 0xff or resp[1] != 0x86:
IndexError: index out of range
2020-08-06 17:59:12,459 - DEBUG - mycodo.controllers.controller_input_4d4df21b - Adding measurements to InfluxDB with ID 4d4df21b-348c-4a4f-8dc3-45ce26e2b7e4: {}
2020-08-06 17:59:17,576 - ERROR - mycodo.inputs.mh_z16_7e3de6b3 - Cannot set a value of None. Must be a float or string representing a float. Check the sensor and Input module is working correctly.
2020-08-06 17:59:27,398 - ERROR - mycodo.inputs.mh_z19b_4d4df21b - get_measurement()
Traceback (most recent call last):
  File "/home/pi/Mycodo/mycodo/inputs/mh_z19b.py", line 176, in get_measurement
    if resp[0] != 0xff or resp[1] != 0x86:
IndexError: index out of range
2020-08-06 17:59:27,412 - DEBUG - mycodo.controllers.controller_input_4d4df21b - Adding measurements to InfluxDB with ID 4d4df21b-348c-4a4f-8dc3-45ce26e2b7e4: {}
2020-08-06 17:59:32,528 - ERROR - mycodo.inputs.mh_z16_7e3de6b3 - Cannot set a value of None. Must be a float or string representing a float. Check the sensor and Input module is working correctly.

 

I'm trying to get a MH-Z19B tested and calibrated to ship - gonna try the fork I already have and then come back to work on this.

 


ReplyQuote
Kyle Gabriel
(@kylegabriel)
Member Admin
Joined: 6 years ago
Posts: 275
August 7, 2020 9:19 am  

That's strange. It looks like your MH-Z19B Input is throwing errors straight after activation. I have mine connected and don't experience that. I'll take a closer look this afternoon. 

This post was modified 5 days ago by Kyle Gabriel

Mycodo Developer


ReplyQuote
carboncycle
(@carboncycle)
Eminent Member
Joined: 9 months ago
Posts: 22
August 8, 2020 12:07 pm  

@kylegabriel  My bad. Turned out to be a hardware problem.   I'm using 8.6.4 master as I had problems with the release.  Somehow Werkzeug didn't get installed properly.


ReplyQuote
Page 2 / 2