MH-Z19B C02 sensors...
 
Notifications
Clear all

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

Page 3 / 3
  RSS

carboncycle
(@carboncycle)
Eminent Member
Joined: 11 months ago
Posts: 27
September 28, 2020 7:14 pm  

The one thing to check for when you see sensors misbehave is the power rail used.   Things like mechanical relays present an inductive load - and if they are missing a clamping diode on the coil - they will surely trash up the power rails.  If this is on USB devices only - you can perhaps isolate the problem with a powered USB hub.  See if that stabilizes the issue.   Once you get past a few low current sensors - you can really stress the Pi power supply - look for the red LED flashing if it detects a problem.  The Pi3 and Pi4 really need a stiff 5.1v to properly regulate the 5v rail.


ReplyQuote
joe_sullivan
(@joe_sullivan)
Eminent Member
Joined: 7 months ago
Posts: 30
September 29, 2020 10:29 am  

Have you disconnected all hardware except for each sensor in order to isolate if there are any hardware conflicts occurring? If each piece of hardware works fine when only it is connected, it would indicate the issue lies with the combination of hardware you have when connected together.

@kylegabriel it appears that when I have only one MH-Z19B connected, it runs without issues.

 

 


ReplyQuote
joe_sullivan
(@joe_sullivan)
Eminent Member
Joined: 7 months ago
Posts: 30
September 29, 2020 10:36 am  

@carboncycle Here's a link to the USB adapters I am using to connect to my MH-Z19B's: https://www.amazon.com/gp/product/B07D9R5JFK/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&psc=1

It's only my USB devices that are acting up (sensors connected via the Pi's pins work fine) so I will look into a powered USB hub.


ReplyQuote
carboncycle
(@carboncycle)
Eminent Member
Joined: 11 months ago
Posts: 27
September 29, 2020 2:23 pm  

I think I see the problem.  The device you reference is not CP2102.   That cable uses a PL2303TA and is not programmable for a unique serial number, if I'm not mistaken.  They may have some utility on their support site to modify them in some way to be unique.

They have a warning about counterfeits of their devices on the product page.

 


ReplyQuote
joe_sullivan
(@joe_sullivan)
Eminent Member
Joined: 7 months ago
Posts: 30
September 29, 2020 2:34 pm  

@carboncycle I don't think that's the issue, since I am identifying the serial devices using "by-path" (ex. "/dev/serial/by-path/platform-3f980000.usb-usb-0:1.3:1.0-port0") and just remembering not to change which USB ports they are plugged into.  FWIW, I was previously using a different USB adapter (link below) but switched up after I seemed to keep running into issues.

https://www.amazon.com/gp/product/B00LODGRV8/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1


ReplyQuote
carboncycle
(@carboncycle)
Eminent Member
Joined: 11 months ago
Posts: 27
September 29, 2020 9:33 pm  

Check the output of 'dmesg' after something odd happens.  The driver registers there and should report any reconfig.  Those new adapters should be programmable, but I haven't tested that specific module.   I've found sourcing the usb modules to be sometimes problematic.  I have 20 modules that would need rework to be usable, and that isn't cost effective.  I just find a different vendor and module source.

I've been testing three modules at a time, using an un-powered hub.   The modules pull ~100ma when taking a sample.  I use the Mycodo 8.6.4 code to calibrate the devices.

This post was modified 4 weeks ago by carboncycle

ReplyQuote
joe_sullivan
(@joe_sullivan)
Eminent Member
Joined: 7 months ago
Posts: 30
October 7, 2020 11:08 am  

@carboncycle Attached here is a screenshot of output from dmesg when one of the sensors isn't working. Those last 4 lines seem relevant but I'm not sure what they mean.

I tried attaching my MH-Z19B's to the Pi using a USB hub (connected to a separate power source). Still, it seems that I can't connect all three MH-Z19B's without one of them failing within a few hours, sometimes much sooner.


ReplyQuote
carboncycle
(@carboncycle)
Eminent Member
Joined: 11 months ago
Posts: 27
October 8, 2020 1:45 pm  

 

That is from the pl2303 USB driver. 

This is a pointer to the source code ( for reference )

https://docs.huihoo.com/doxygen/linux/kernel/3.7/pl2303_8c_source.html

 

This problem has been documented on the interwebs:

https://www.electrondepot.com/rpi/pl2303-get-line-request-failed-32-15383-.htm

https://www.raspberrypi.org/forums/viewtopic.php?t=190555

https://raspberrypi.stackexchange.com/questions/116109/usb-device-turns-off-relay-switch-does-not-restart-it-unplugging-and-re-plug

 

I've actively avoided using this particular chip - I've had good results with FTDI and SiliconLabs parts.

 

Here is more information on Pi USB port specifics and troubleshooting:

https://www.raspberrypi.org/documentation/hardware/raspberrypi/usb/

This post was modified 3 weeks ago by carboncycle

ReplyQuote
Page 3 / 3