Page mentions Wemos D1 Mini, but the pinout diagram for it was very confusing. Also fixed some typos and added more information.

ThinkPadNL 2018-08-10 17:13:28 +02:00
parent 483771cb17
commit 9d91c065e1
1 changed files with 29 additions and 19 deletions

@ -1,41 +1,51 @@
## MH-Z19B CO2 Sensor (Serial)
## MH-Z19B CO<sub>2</sub> Sensor (Serial)
<img src="https://github.com/arendst/arendst.github.io/blob/master/media/wemos/mhz19b-co2-sensor-front.jpg" align=right width=225>
<img src="https://github.com/arendst/arendst.github.io/blob/master/media/wemos/mhz19b-co2-sensor-back.jpg" align=right width=225>
The MH-Z19 sensor is manufactured by Winsen Lt., China and the measurement method used is based on the non-dispersive infrared (NDIR) principle to detect the existence of CO2 in the air.
The MH-Z19 sensor is manufactured by [Winsen](http://www.winsensor.com/) Lt., China and the measurement method used is based on the non-dispersive infrared ([NDIR](https://en.wikipedia.org/wiki/Nondispersive_infrared_sensor)) principle to detect the existence of CO<sub>2</sub> in the air.
Key features according to the manufacturer are:
- good sensitivity.
- non-oxygen dependent.
- long life.
- built-in temperature compensation.
- UART serial interface and Pulse Width Modulation (PWM) output.
* good sensitivity
* non-oxygen dependent
* long life
* built-in temperature compensation
* UART serial interface and Pulse Width Modulation (PWM) output
Principle of operation:
The main components of an NDIR sensor are an infrared source (lamp), a sample chamber or light tube, a light filter and an infrared detector. The IR light is directed through the sample chamber towards the detector. In parallel there is another chamber with an enclosed reference gas, typically nitrogen. The gas in the sample chamber causes absorption of specific wavelengths according to the BeerñLambert law, and the attenuation of these wavelengths is measured by the detector to determine the gas concentration. The detector has an optical filter in front of it that eliminates all light except the wavelength that the selected gas molecules can absorb.
Buy example: [MH-Z19B-Infrared-CO2-Sensor-for-CO2-Monitor-NDIR-Gas-Sensor-CO2-gas-sensor](https://de.aliexpress.com/item/MH-Z19B-Infrared-CO2-Sensor-for-CO2-Monitor-NDIR-Gas-Sensor-CO2-gas-sensor/32823821163.html?ws_ab_test=searchweb0_0,searchweb201602_4_10320_10152_10321_10065_10709_10151_10344_10068_5722815_10342_10547_10343_10322_10340_10341_10548_5722915_10193_5722615_10696_10194_10084_10083_10618_10304_10307_10710_10302_5722715_10180_5711215_10059_10184_308_100031_10319_10103_10624_10623_10622_10186_5711315_5722515_10621_10620,searchweb201603_25,ppcSwitch_5&algo_expid=7a99f4de-3d10-4a1a-bd67-88f95132b1a4-0&algo_pvid=7a99f4de-3d10-4a1a-bd67-88f95132b1a4&priceBeautifyAB=0)
See also the [datasheet](https://www.winsen-sensor.com/d/files/PDF/Infrared%20Gas%20Sensor/NDIR%20CO2%20SENSOR/MH-Z19%20CO2%20Ver1.0.pdf).
Buy example: [AliExpress.com: MH-Z19B-Infrared-CO2-Sensor-for-CO2-Monitor-NDIR-Gas-Sensor-CO2-gas-sensor](https://www.aliexpress.com/item/MH-Z19B-Infrared-CO2-Sensor-for-CO2-Monitor-NDIR-Gas-Sensor-CO2-gas-sensor/32823821163.html)
Operating current < 18mA average
### Connecting the MHZ19B to a Wemos Mini D1
### Connecting the MH-Z19B to a Wemos D1 mini
| Wemos | MH-Z19B |
| Wemos D1 Mini | MH-Z19B |
|---|---|
|VCC +5V | Vin red|
|GND | GND blk|
|GPIO 1 |RX blue|
|GPIO 3 |TX gn|
|VCC +5V | Vin|
|GND | GND|
|TX |Rx|
|RX |Tx|
### Tasmota Configuration
In the Configuration -> Configure Module page, select the following:
1. **Module Type : 18 Generic or the module you use (here a Sonoff basic)**
2. **GPIO01 : 61 MHZ Rx**
3. **GPIO03 : 60 MHZ Tx**
In the Configuration -> Configure Module page, select the following for Wemos D1 mini:
1. **Module Type:** 18 Generic
2. **TX GPIO1 Serial Out:** 61 MHZ Rx
3. **RX GPIO3 Serial In:** 60 MHZ Tx
![](https://i.imgur.com/nlgI2lM.jpg)
For Sonoff Basic:
1. **Module Type:** 01 Sonoff Basic
2. **GPIO01** 61 MHZ Rx
3. **GPIO03** 60 MHZ Tx
![](https://user-images.githubusercontent.com/24528715/43370428-273fe96c-937f-11e8-9a6c-66144cec5ffc.png)
### Tasmota Main
After reboot of the device the displays the MHZ-19B measurements.
After reboot of the device the MHZ-19B measurements are shown.
<img src="https://github.com/arendst/arendst.github.io/blob/master/media/wemos/wemos_mhz19b_main_marked.jpg" width=300>