crisap94 / MHZ19

MH-Z19 CO2 sensor library for ESP8266 or Arduino
Other
68 stars 24 forks source link

#include <MHZ19_uart.h> or #include <MHZ19.h>? #2

Closed Gettyk closed 5 years ago

Gettyk commented 5 years ago

Hi, I am sorry to bother you but I am just starting with NodeMCU and I have trouble understanding which pins I should use with my NodeMCU. You write:

MH-Z19 Vout to Arduino Vout(5V)
MH-Z19 GND to Arduino GND
MH-Z19 Tx to Arduino Digital Pin (Serial Rx pin)
MH-Z19 Rx to Arduino Digital Pin (Serial Tx pin)
other MH-Z19 pins are not used.

But this is for the Arduino. Which are the 3 pins (all except the Ground) that I should use if I have this pinout:

image

Is it the NodeMCU VIN for the MH-Z19 Vout, the NodeMCU RX (GPIO3) for the MH-Z19 Rx and the NodeMCU RX (GPIO1) for the MH-Z19 Tx. I have seen other sketch using D6 and D7 or D1 and D3, so I am really confused.

Thanks a lot!

muldereric commented 5 years ago

You need the SoftwareSerial library to communicate with the sensor. SoftwareSerial sensor(rxpin, txpin);

Then in the setup loop type: sensor.begin(9600);

Search for it on Google and you’ll see.

crisap94 commented 5 years ago

Example updated and Readme updated. Should work now.