Hi, I got the MH-Z19b sensor, but I can't get it to work. If I have it plugged in, I get "avrdude programmer is not responding" error and can't upload any sketches, if I upload a sketch and then plug it in, the sensor doesn't get recognized. What would the solution be, do I need some driver for the sensor? I'm using UART, GND-GND, VIN-5V TX-RX, RX-TX. Thanks for any advice.
Since you do not include a schematic, code or specify the Arduino board that you use, I am assuming that you are using an Uno and are connecting the sensor to the hardware serial port (pins 0 and 1). That is the reason that upload fails with the sensor connected. Only one thing can be connected to the port at a time and the hardware serial is connected to the serial monitor through the USB to serial converter. A solution is to use a software serial port for the sensor (Uno) or use a board like the Mega with multiple hardware serial ports.
I'm using nano actually. Can I use software serial to communicate with the PC? And why doesn't it work if I upload the sketch, then plug in the sensor? It keeps saying it's warming up.
They specifically use a resistor and capacitor in the circuit - did you do this?
I have one MH-Z19B working well for months now with a pro mini and a second MH-Z19B arrived this week for another node. I have not tried it yet as I need to make a small board to connect it to the required components.
Search google for the data sheet and read it through. Then you may get results, or not, as we don't know what is in your sketch!
Post photos and sketch if the data sheet doesn't help.
Thanks for the answer, I don't see it in the datasheet I found, can you send me a link? Or a description of your circuit if you have it working.
As for sketches, I have the basic examples from MH-Z CO2 Sensors, MH-Z19-master and MH-Z19_uart libraries, but none work (but of course, I'm not entirely clear on what I need to make each of them work). What code are you using?
I was confusing the co2 and dust sensor - there are no additional components for the MH-Z19B, my mistake!
I don't use a library for the MH-Z19B, (only software serial). I just the mysensors sketch as a basis and then modified for display and other sensors attached.
Peet79:
I'm using nano actually. Can I use software serial to communicate with the PC? And why doesn't it work if I upload the sketch, then plug in the sensor? It keeps saying it's warming up.
You still didn't read the sticky, did you?
After upload, do you try to read the Serial monitor from the same Serial port you try to connect the sensor to?