Skip to content

Commit

Permalink
Merge pull request #8 from /issues/7
Browse files Browse the repository at this point in the history
Update documentation MH-Z19C
  • Loading branch information
Erriez authored Mar 5, 2023
2 parents be7b4f8 + 9f11a31 commit 6a27877
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .auto-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# MIT License
#
# Copyright (c) 2020-2022 Erriez
# Copyright (c) 2020-2023 Erriez
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2022 Erriez
Copyright (c) 2020-2023 Erriez

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
48 changes: 34 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,33 @@ compensation to measure CO2 concentration in air.

### Pins

WARNING: The pins between MH-Z19B and MH-Z19C are different. See tables below:

```c++
// MH-Z19B front connector
// __ _______
// +------------------+
// | |
// | . . . . . . . |
// | 1 2 3 4 5 6 7 |
// +------------------+
//
// Pin 1: Yellow None
// Pin 2: Green UART (TXD) TTL Level Data Output -> TO RXD
// Pin 3: Blue UART(RXD) TTL Level Data Input -> TO TXD
// Pin 4: Red Positive Power Supply (Vin +5V)
// Pin 5: Black Negative Power Supply (GND)
// Pin 6: White None
// Pin 7: Brown Analog Output Vo (Not used)
// MH-Z19B front connector:
// Pin 1: Yellow None
// Pin 2: Green UART (TXD) TTL Level Data Output -> TO RXD
// Pin 3: Blue UART (RXD) TTL Level Data Input -> TO TXD
// Pin 4: Red Positive Power Supply (Vin +5V)
// Pin 5: Black Negative Power Supply (GND)
// Pin 6: White None
// Pin 7: Brown Analog Output Vo (Not used)
//
// MH-Z19C front connector:
// Pin 1: PWM
// Pin 2: UART (TXD) TTL Level data output -> TO RXD
// Pin 3: UART (RXD) TTL Level data input -> TO TXD
// Pin 4: Positive Power Supply (Vin +5V)
// Pin 5: Negative Power Supply (GND)
// Pin 6: Analog Output Vo
// Pin 7: HD (Hand-operated calibration)
//
// The following ESP8266 pins are reserved:
// TX/RX: Serial (in use)
Expand Down Expand Up @@ -80,7 +91,8 @@ The following targets are supported and tested:

- [Online HTML](https://erriez.github.io/ErriezMHZ19B)
- [Doxygen PDF](https://github.com/Erriez/ErriezMHZ19B/blob/gh-pages/ErriezMHZ19B.pdf)
- [Datasheet PDF](https://github.com/Erriez/ErriezMHZ19B/blob/master/extras/mh-z19b-co2-ver1_0.pdf)
- [MH-Z19B datasheet PDF](https://github.com/Erriez/ErriezMHZ19B/blob/master/extras/mh-z19b-co2-ver1_0.pdf)
- [MH-Z19C datasheet PDF](https://github.com/Erriez/ErriezMHZ19B/blob/master/extras/mh-z19c-co2-ver1_21.pdf)


## CO2 Concentrations
Expand Down Expand Up @@ -131,7 +143,7 @@ The status can be read with function `getAutoCalibration()`.
For simplicity, this library uses the terminology `Automatic Calibration` which is identical to the
`ABC (Automatic Baseline Correction) logic on/off` mentioned in the datasheet.

### 2. Manual Calibration (400ppm)
### 2. Manual ZERO Calibration (400ppm)

Procedure for manual calibration at 400ppm:

Expand All @@ -144,13 +156,21 @@ Procedure for manual calibration at 400ppm:

Now the sensor is calibrated. Repeat the sequence more often for higher accuracy.

### 3. Manual Calibration (SPAN)
### 3. MH-Z19B only: Manual SPAN Calibration

The SPAN point calibration procedure is not implemented in this library as it requires special
calibration equipment. This functionality is not available in MH-Z19C.

The datasheet also mentions a command `0x88 Span Point Calibration`. The calibration procedure is
not clear and therefore not implemented in this library.
### 4. MH-Z19C only: Hand-operated calibration

Procedure according to the MH-Z19C datasheet:
- Connect module’s HD pin to low level(0V), lasting for 7 seconds at least.
- Before calibrating the zero point, please ensure that the sensor is stable for more than 20
minutes at 400ppm ambient environment.
- The application is responsible to control the external MH-Z19C HD pin and is not available on
the MH-Z19B.

## MH-Z19B API
## MH-Z19B/C API

**Initialization Software Serial**

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2020-2022 Erriez
* Copyright (c) 2020-2023 Erriez
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2020-2022 Erriez
* Copyright (c) 2020-2023 Erriez
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2020-2022 Erriez
* Copyright (c) 2020-2023 Erriez
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2020-2022 Erriez
* Copyright (c) 2020-2023 Erriez
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
Binary file added extras/mh-z19c-co2-ver1_21.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/ErriezMHZ19B.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2020-2022 Erriez
* Copyright (c) 2020-2023 Erriez
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions src/ErriezMHZ19B.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2020-2022 Erriez
* Copyright (c) 2020-2023 Erriez
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -57,7 +57,7 @@
#define MHZ19B_CMD_SET_AUTO_CAL 0x79 //!< Command set auto calibration on/off
#define MHZ19B_CMD_READ_CO2 0x86 //!< Command read CO2 concentration
#define MHZ19B_CMD_CAL_ZERO_POINT 0x87 //!< Command calibrate zero point at 400ppm
#define MHZ19B_CMD_CAL_SPAN_PIONT 0x88 //!< Command calibrate span point (NOT IMPLEMENTED)
#define MHZ19B_CMD_CAL_SPAN_POINT 0x88 //!< Command calibrate span point (NOT IMPLEMENTED)
#define MHZ19B_CMD_SET_RANGE 0x99 //!< Command set detection range

// Not documented commands
Expand Down

0 comments on commit 6a27877

Please sign in to comment.