Project Files of MH-Z19B CO2 Sensor Library for Proteus V1.0: NDIR, UART and PWM
mh-z19b-tep-v1-0-05017fec3c05478599fab2f2d01485b6.zip

MH-Z19B CO2 Sensor Library for Proteus V1.0
MH-Z19B CO2 Sensor Library for Proteus V1.0 comes as a ZIP archive of 10 files (1.2 MB, 2.7 MB unpacked) holding Proteus library files, simulation model DLLs, a Proteus simulation, an Arduino sketch and compiled HEX firmware.
- LIBProteus library
- DLLProteus model
- DSNProteus simulation
- INOArduino sketch
- HEXHEX firmware
Description
Looking for the files of MH-Z19B CO2 Sensor Library for Proteus V1.0: NDIR, UART and PWM? MH-Z19B CO2 Sensor Library for Proteus V1.0 is the ZIP package (1.2 MB) you need. It holds the Proteus library files (LIB and IDX), the simulation model (DLL), a ready Proteus simulation, an Arduino sketch and the compiled HEX firmware. Below are the file structure, the README and the installation steps, so you can go from download to a working Proteus simulation in a few minutes.
What this library is
MH-Z19B-CO2-Sensor-Library-for-Proteus-v1.0.zip with the Winsen MH-Z19B NDIR CO2 sensor (UART, PWM and HD), Simple and Advance (TEPMHZ19B.LIB and TEPMHZ19B.DLL), our Arduino UNO V4.0 library with its built-in serial monitor (ArduinoV4TEP.LIB and TEPARDUINO.DLL), the two-UNO simulation with its HEX file, the demo sketch and a README.
This is version 1.0; older or newer releases, when they exist, are listed in the Development tab.
What is inside the ZIP file
- ArduinoV4TEP.LIB – Proteus library, 201.9 KB
- TEPMHZ19B.LIB – Proteus library, 58.1 KB
- TEPARDUINO.DLL – Simulation model, 883.5 KB
- TEPMHZ19B.DLL – Simulation model, 305 KB
- MH-Z19B-CO2-ArduinoUnoV4.pdsprj – Proteus simulation, 24.4 KB
- MHZ19B_CO2_Demo.ino – Arduino sketch, 5.5 KB
- and 4 more, all listed in the File Structure tab
The archive unpacks to 2.7 MB and carries its own README (README.txt), shown in the README tab above.
How to download
Use the download panel at the top of this page: after the counter (30 seconds for guests, 10 for members) the black button unlocks and the ZIP file comes straight from our content network. If the browser opens it instead of saving, use Save as; extract the whole archive before using anything inside it.
How to install
- Step 1: Extract the ZIP file with Windows (Extract All), 7-Zip or WinRAR, keeping its folders.
- Step 2: Close Proteus and copy ArduinoV4TEP.LIB and TEPMHZ19B.LIB into its LIBRARY folder (Proteus 8: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY).
- Step 3: Copy TEPARDUINO.DLL and TEPMHZ19B.DLL into the MODELS folder next to it, so the part simulates.
- Step 4: Start Proteus, press P and search for "ArduinoV4TEP"; place and wire it as in the tutorial.
- Step 5: Open MHZ19B_CO2_Demo.ino in the Arduino IDE, pick board and port and Verify (Export Compiled Binary gives the HEX).
- Step 6: In Proteus set the controller's Program File to MHZ19B_CO2_Demo.hex; on hardware, flash the same file.
- Step 7: Open MH-Z19B-CO2-ArduinoUnoV4.pdsprj in Proteus and press Play.
Read the detailed guide
This page is for the files. The full tutorial, MH-Z19B CO2 Sensor Library for Proteus V1.0: NDIR, UART and PWM, explains the circuit and the code step by step and shows the working results and the simulation; read it before you build. Questions about the download or the installation go in the comments below; more Proteus downloads are listed further down this page.
File Structure
5.5 KB201.9 KB58.1 KB883.5 KB305 KB24.4 KB37 KB883.5 KB305 KB24.6 KBGallery12 images from the tutorialOpen the tutorial
The circuit, the board and the results as they appear in MH-Z19B CO2 Sensor Library for Proteus V1.0: NDIR, UART and PWM. Open an image for its full size.












README
MH-Z19B CO2 SENSOR LIBRARY FOR PROTEUS - V1.0 (NDIR, UART and PWM)
Designed by The Engineering Projects
www.TheEngineeringProjects.com
IMPORTANT LINKS
Article (read it first - pictures, step by step, every feature explained):
https://www.theengineeringprojects.com/2026/10/mh-z19b-co2-sensor-library-for-proteus-v1-0.html
Report a bug or suggest a feature (our forum):
https://www.theengineeringprojects.com/forum/category/mh-z19b-co2-proteus-library
The demo runs on our Arduino UNO V4.0 (included) - working LEDs, RESET and a
built-in serial monitor, no Virtual Terminal to wire - its own article:
https://www.theengineeringprojects.com/2026/10/arduino-uno-library-for-proteus-v40.html
The built-in monitor is our TEP Serial Monitor Advance - its own article:
https://www.theengineeringprojects.com/2026/10/serial-monitor-advance-proteus-library.html
Our other gas sensors (the MQ family, MQ-2):
https://www.theengineeringprojects.com/2026/10/mq-gas-sensor-library-for-proteus-v1-0.html
https://www.theengineeringprojects.com/2026/10/gas-sensor-library-for-proteus-v2-0.html
Support us (the libraries are free):
https://www.theengineeringprojects.com/donate
FILE STRUCTURE
MH-Z19B-TEP-v1.0/
|-- Proteus Library Files/
| |-- ArduinoV4TEP.LIB 201.9 KB TEP Arduino boards V4.0 (UNO), to LIBRARY
| |-- TEPMHZ19B.LIB 58.1 KB the MH-Z19B, to LIBRARY
|-- Proteus Model Files/
| |-- TEPARDUINO.DLL 883.5 KB the Arduino board model, to MODELS
| |-- TEPMHZ19B.DLL 305.0 KB the MH-Z19B model, to MODELS
|-- Proteus Simulation/
| |-- MHZ19B_CO2_Demo.hex 37.0 KB both UNOs (demo sketch V1.0)
| |-- MH-Z19B-CO2-ArduinoUnoV4.pdsprj 24.4 KB demo: 2 UNOs, 2 sensors
| |-- TEPARDUINO.DLL 883.5 KB copy of the board model
| |-- TEPMHZ19B.DLL 305.0 KB copy of the model
|-- Arduino Code/
| |-- MHZ19B_CO2_Demo/MHZ19B_CO2_Demo.ino 5.5 KB the demo sketch (source of the .hex)
|-- README.txt ~25.6 KB this file
Total: 2.67 MB (unzipped). The C++ source code of the model is not included.
WHAT IS IT?
A simulation model of the Winsen MH-Z19B, an infrared (NDIR) CO2 sensor: a
lamp shines through a gold-plated chamber, CO2 absorbs part of the light,
and the sensor turns what is left into ppm. Our own model, written from the
user's manual (MH-Z19B V1.5) and checked against the MH-Z19 Arduino library
1.5.4 - not a part that shows a number:
* The UART at 9600 baud 8N1: 9-byte commands FF 01 cmd ... and a checksum
(0x100 minus the sum of bytes 1 to 7). 0x86 reads the CO2 (FF 86 HIGH
LOW ...), 0x87 calibrates the zero point, 0x88 the span, 0x79 turns ABC
on or off, 0x99 sets the range (2000, 5000 or 10000 ppm). Plus what the
MH-Z19 library asks: 0x85 (the temperature x 100 and the CO2 without
limits), 0x84 (raw), 0x7D (ABC status), 0x9B (the range), 0x9C (the
background, 400), 0xA0 (the version), 0xA2 (the last answer again), 0xA3
and 0x78 (a recovery reset). A wrong checksum gets no answer.
* Two CO2 values: 0x86 and the PWM pin are held at 400 ppm to the range
("limited"); 0x85 is not - it shows a wrong calibration below 400 ppm and
the CO2 above the range ("unlimited", the library's getCO2()).
* PWM: a 1004 ms cycle, HIGH for 2 ms + 1000 ms x CO2 / range, so
Cppm = range x (TH - 2 ms) / (TH + TL - 4 ms) (the manual).
* HD: held LOW for over 7 s, it calibrates the zero point (the manual).
* The preheat (PREHEAT, the manual's 3 minutes): until it is over, 0x86 and
PWM give 410 ppm and 0x85 a value still settling from above - the
MH-Z19 library's filter test sees it.
* The response time (T90, the manual: under 120 s): the sensor follows a
change of the air slowly - 90 % of a step after T90 seconds.
* The zero point is 400 ppm, not 0: a zero calibration (0x87 or HD) makes
the air at that moment read 400 ppm. In fresh outdoor air that is right;
in a room at 1200 ppm every reading is 800 ppm too low afterwards.
* ABC (automatic baseline correction, on by default): every 24 hours the
lowest reading of the day becomes 400 ppm. A DAY (ABC) on the panel runs
it at once. Good in a home that gets fresh air; wrong in a closed room.
* The air at the sensor: its CO2 (property CO2), the panel's - / + (50 ppm a
click), five presets (420, 800, 1200, 2000, 5000 ppm) and four actions:
BREATHE (a breath on the window: +4000 ppm, gone in about 8 s), VENTILATE
(a window open: the room goes to 420 ppm, outdoor air), DRIFT +150 (the
sensor's zero point drifts 150 ppm) and A DAY (ABC).
* The temperature (property TEMP) in 0x85 (x 100) and 0x86 (+ 40).
The sensor is drawn at about three times its real size (33 x 20 mm): the
gold-plated chamber with its label and the diffusion window, on its green PCB,
with the pins on the left: Vin, GND, Tx, Rx, PWM, HD. ON the board, as TEP
additions: the SIMPLE / ADVANCE badge, the PWR, TX and PWM LEDs (TX flashes
with each answer, PWM follows the PWM pin - its flash grows with the CO2) and
the panel button. The LEDs, the badge, the button and the panels are
TEP additions; the real sensor has none of them. The analog output Vo is not
modelled, so the part has no Vo pin.
TWO DEVICES IN ONE LIBRARY (search "MHZ19" or "CO2" in Pick Devices):
Simple MHZ19BTEP "MH-Z19B NDIR CO2 Sensor V1.0 - Simple"
Advance MHZ19BADVTEP (the same, "- Advance")
(pins Vin, GND, Tx, Rx, PWM and HD on the left; category
Sensors > Gas)
Simple On-Sheet Panel: the STATUS panel under the sensor - the banner
(READS ... ppm - THE AIR ... ppm; amber during the preheat, while
the sensor follows a change or above the range, red with a zero
error or a changed gain), THE AIR (CO2) - / + with a ruler (0 to
5000 ppm: the air and the reading), five presets, four actions,
ten readouts (STATE, THE AIR, UART (0x85), LIMITED (0x86), PWM,
TEMP, RANGE, ABC, ZERO ERROR, HD PIN) and the last 4 events. The
red X closes the panel, PANEL: ON / OFF on the board opens it.
Advance Pop-Up Panel: only the sensor on the schematic; at Run a TEP
pop-up window opens - the look of the TEP Serial Monitor. Tabs
Sensor, Event log and Tests; gear and ? icons for Settings and
Help; the palette icon switches the theme:
Sensor the presets on the toolbar; THE AIR AT THE SENSOR
(-100 / -50 / +50 / +100 ppm, BREATHE, VENTILATE,
DRIFT +150, A DAY (ABC), a 0 - 5000 ppm scale with
the air, what the cell sees and the reading); WHAT
THE SENSOR REPORTS (0x85, 0x86, PWM, the
temperature); the last command and its answer byte
by byte; the air and the reading over the last 150 s
Event log power, the readings, the bus (commands, HD), the
air, notes, warnings; filters All / The air / The
bus / Warnings, Pause, Clear
Tests UART & commands, PWM & HD, Calibration & ABC (THE
TEST TOOLS)
Settings theme, text size, open at Run, window size
Help report a bug, suggest a feature, article, updates,
donate, forum; Copy diagnostics for a bug report
The OPEN PANEL button on the board opens the window again.
Both devices use one model, TEPMHZ19B.DLL.
TEST STATUS
V1.0: verified in Proteus 8.5 on 18 Oct 2026 (the demo project as shipped:
two Arduino UNO V4.0 boards with their built-in monitors; node 1 with the
Simple sensor in a room at 600 ppm, range 5000 ppm; node 2 with the Advance
sensor in an office at 1000 ppm, range 2000 ppm; both PREHEAT 30 s, T90 30 s).
What the runs showed:
* Both UNOs pass the MH-Z19 library's begin() check (0x85, 0xA2, 0xA0) and
print "version TEP1, range 2000 ppm, ABC ON, background 400 ppm, raw
34125 (97.5 %)" (ARD2). During the preheat: "t=2 s CO2 3610 ppm 0x86
410 PWM 410 25.0 C - preheating", 0x85 falling to the air by 30 s;
then ARD1 "t=32 s CO2 597 ppm 0x86 597 PWM 597 25.0 C".
* U2 through its pop-up: 5000 ppm with the range at 2000 - 0x85 rises to
4759 ppm, 0x86 and PWM stop at 2000; RANGE 5000 - "range 0 - 5000 ppm",
then 0x86 4867 and PWM 4823 (the first PWM line still a range-2000
cycle: 5000); VENTILATE - from 3229 down to 1595 ppm in 22 s, PWM one
cycle behind; the three tools and the Event log; in outdoor air the
Calibration tool says "yes", CAL - 422 ppm becomes 400 ppm.
* U1 with the real mouse (3 wheel steps on U1): BREATHE - from 597 to 1717
ppm; DRIFT +150 and VENTILATE - about 585 ppm in air of about 425 ppm;
A DAY (ABC) - 576 ppm becomes 398 ppm (ABC took the day's lowest
reading, 581 ppm, as 400 ppm); 1200 ppm and CAL, then 420 ppm - "CO2 0
ppm 0x86 400 PWM 400"; HD - "HD LOW for 8 s ...", "HD released", then
"t=302 s CO2 400 ppm"; STATUS; U1's red X and PANEL.
* 318.1 s of simulation took 722 s - about 0.44 x real time with the
pop-up and both monitors open.
Plus automatic checks on a PC, 0 failed: 56 on the model (every command
bit by bit with its checksum, PWM, HD, the preheat, T90, the calibrations,
ABC, the range), 18 with the real MH-Z19 library 1.5.4 talking to the
model (begin(), getCO2(), the filter, setRange(), autoCalibration(),
calibrate(), recoveryReset() - not one error printed) and 8 on the pop-up;
the demo project read back from disk (93 checks: devices, pins, wires,
labels; no wire through a part, no wire crossing).
INSTALLATION (about 2 minutes)
1. Close Proteus. Extract the WHOLE ZIP to a normal folder (e.g. Desktop).
2. Copy everything in "Proteus Library Files" (TEPMHZ19B.LIB with the two
parts, and our Arduino library V4.0, ArduinoV4TEP.LIB, with the ARDUINO
UNO V4.0 used by the demo) to the LIBRARY folder of Proteus, for example:
C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY
(on some PCs: C:\ProgramData\Labcenter Electronics\Proteus 8 Professional\
LIBRARY - use the folder that already holds Proteus's own .LIB files).
3. Copy TEPMHZ19B.DLL and TEPARDUINO.DLL from "Proteus Model Files" to the
MODELS folder (...\Proteus 8 Professional\MODELS).
ArduinoV4TEP.LIB and TEPARDUINO.DLL are the files of our Arduino Library
V4.0 - if you have it, they are the same.
4. Delete TEPMHZ19B.IDX from the LIBRARY folder if it is there (Proteus
makes a new index).
5. Start Proteus. In Pick Devices (P) search "MHZ19" (or "CO2").
RUN THE DEMO
"Proteus Simulation\MH-Z19B-CO2-ArduinoUnoV4.pdsprj" - keep the .hex file and
the two DLLs beside the project.
ARD1: Arduino UNO V4.0 + U1 = an MH-Z19B (Simple) in a room at 600 ppm,
range 5000 ppm.
ARD2: Arduino UNO V4.0 + U2 = an MH-Z19B (Advance) in an office at
1000 ppm, range 2000 ppm.
Both sensors have PREHEAT 30 s and T90 30 s to keep the demo short (the
real ones: 3 minutes, and under 120 s - set the properties back for that).
Both UNOs run MHZ19B_CO2_Demo.hex and each has its serial monitor built in
("TEP Arduino UNO - ARD1" / "- ARD2").
1. Press Run. Both UNOs' monitor windows open (9600 baud) and so does the
pop-up of U2 (move it aside - it opens over the schematic).
2. Each UNO checks the link with the MH-Z19 library (0x85, then 0xA2 and
0xA0), prints the version, range, ABC, background and raw value, then
every 2 s a line: the CO2 from 0x85, from 0x86 and from the PWM pin,
and the temperature. For the first 30 s it says "- preheating".
3. Change the air on U1's STATUS panel or in U2's pop-up (- / +, the
presets): the readings follow in about T90. BREATHE, VENTILATE.
4. U2 at 5000 ppm with the range at 2000: 0x85 shows about 5000, 0x86 and
PWM stop at 2000. Type RANGE 5000 in ARD2's monitor.
5. DRIFT +150, then A DAY (ABC): ABC takes the day's lowest reading as
400 ppm. 1200 ppm and CAL, then 420 ppm: a zero point set in the wrong
air - 0x85 reads 0. HD (8 s on D4) in fresh air puts it right.
6. U1: close its panel with the red X, open it with PANEL on the board.
U2 (Advance): Sensor, Event log, and Tests - UART & commands, PWM & HD,
Calibration & ABC.
Closed a monitor window? Click the UNO's USB port.
WIRING (the same in Proteus and on a real board)
MH-Z19B Arduino UNO
Vin 5V
GND GND
Tx D8 (AltSoftSerial RX)
Rx D9 (AltSoftSerial TX)
PWM D2 (INT0 - both edges timed)
HD D4 (HIGH; LOW for 8 s with the HD command)
An UNO has one hardware serial port (D0 / D1 - the monitor) and SoftwareSerial
cannot receive in Proteus, so the sketch uses AltSoftSerial (always D8 / D9):
AltSoftSerial co2Serial; MHZ19 mhz;
co2Serial.begin(9600); mhz.begin(co2Serial);
int co2 = mhz.getCO2(); // 0x85: the unlimited value
int limited = mhz.getCO2(false); // 0x86: the datasheet's command
The serial monitor needs no wires: it is built into the Arduino UNO V4.0.
The pins reach their UNO through net labels - TX_1 / RX_1 / PWM_1 / HD_1
(node 1), TX_2 / RX_2 / PWM_2 / HD_2 (node 2): the same name = connected. 5V
and GND are Proteus power terminals.
REAL HARDWARE:
* The supply is 4.5 to 5.5 V and must give 150 mA peaks (the lamp); a weak
supply reads low or not at all (the manual).
* The signals are 3.3 V: a 3.3 V HIGH from Tx or PWM is a valid HIGH for a
5 V UNO (over 3 V), and the manual says Rx and HD take 5 V.
* Do not press on the gold chamber; keep the window free and the sensor away
from heat and sunlight. Calibrate the zero point only after 20 minutes in
fresh outdoor air (400 ppm) - HD, 0x87 or calibrate().
THE TEST TOOLS (Advance, Tests tab) - what they really measure
Every tool reads the model during the running simulation; each shows one
"Good for:" line and, where it judges, a verdict per row (green = fine, amber
= check, red = wrong).
UART & commands
Good for: "Timed out waiting for response", a CRC or a match
error, a command that does nothing. The line, the commands
received, answered and with a wrong checksum, the bytes and
framing errors on Rx, the reads; the last commands with their
bytes and what each did.
PWM & HD Good for: a PWM reading that does not match the UART, the
wrong range in the formula, HD that does nothing. The cycle,
TH and TL now with the formula worked out, the limited value,
the range, the HD pin with its 7 s; one PWM cycle drawn.
Calibration & ABC
Good for: readings that are off by a constant, readings
below 400, a sensor that drifts in a closed room. The
preheat, the zero error, the gain, "Calibrate now?" (yes only
after the preheat in fresh air), ABC with the day's lowest
reading, the calibrations so far.
THE DEMO SKETCH ON THE SERIAL MONITOR (MHZ19B_CO2_Demo V1.0)
CAL zero point calibration (0x87): the air now reads 400 ppm
- in fresh air only
ABC ON / ABC OFF automatic baseline correction (0x79)
RANGE <n> 2000, 5000 or 10000 ppm (0x99, then 0x9B)
HD D4 LOW for 8 s: the zero point by the HD pin
STATUS the version, range, ABC, background and raw value
HELP the command list
Commands are not case-sensitive; type them in the UNO's built-in monitor and
press Enter. Every 2 s the sketch prints a reading by itself.
EXPECTED MONITOR OUTPUT (the start)
ARD2 (an office at 1000 ppm, range 2000 ppm):
TEP MH-Z19B CO2 sensor - demo V1.0
version TEP1, range 2000 ppm, ABC ON, background 400 ppm, raw 34125 (97.5 %)
Commands: CAL (zero point = 400 ppm, fresh air only), ABC ON, ABC OFF,
RANGE 2000 / 5000 / 10000, HD (D4 LOW for 8 s), STATUS, HELP
t=2 s CO2 3610 ppm 0x86 410 PWM 410 25.0 C - preheating
t=4 s CO2 3254 ppm 0x86 410 PWM 410 24.9 C - preheating
ARD1 (a room at 600 ppm) when the preheat ends:
t=30 s CO2 599 ppm 0x86 410 PWM 410 25.0 C - preheating
t=32 s CO2 597 ppm 0x86 597 PWM 597 25.0 C
t=34 s CO2 599 ppm 0x86 599 PWM 599 25.0 C
The last digits move a little: the noise of each reading.
PROPERTIES (double-click the part > Edit Properties)
CO2 the air's CO2 at the start in ppm (default 600)
RANGE the detection range at power-on: 2000, 5000 (default) or
10000 ppm
ABC automatic baseline correction at power-on, ON (default) or OFF
PREHEAT the preheat in s (default 180 - the manual's 3 minutes)
T90 the response time in s (default 60; the manual: under 120 s)
TEMP the temperature in C (default 25)
PANEL Simple only: the STATUS panel at the start, OPEN or CLOSED
RANGE and ABC are what a real sensor has stored. Every run starts again from
the properties, and the sensor from power-on.
The demo's UNOs (ARDUINO UNO V4.0): PROGRAM MHZ19B_CO2_Demo.hex, MONITOR YES
(the built-in monitor), BAUD 9600, AUTOOPEN YES, BOOTLOADER YES.
LINKS.INI (OPTIONAL)
The Help page cards of the Advance device open web pages. To point them
somewhere else without a new DLL, put a text file named links.ini next to
TEPMHZ19B.DLL with lines KEY=URL, for example:
ARTICLE=https://www.theengineeringprojects.com/...
Keys: WEBSITE, FORUM, BUG_REPORT, FEATURE_REQUEST, ARTICLE, USER_GUIDE,
UPDATE_CHECK, DONATE. Only http:// and https:// links are used; lines starting
with # are comments.
TROUBLESHOOTING
* "!ERROR: Failed to verify connection" or "Timed out waiting for response":
Tx / Rx swapped (the sensor's Tx goes to D8), no power, or the sensor is
not at 9600 baud - Tests > UART & commands counts the commands and the
framing errors on Rx.
* "- preheating", 0x86 stuck at 410: the preheat is not over yet (PREHEAT).
* The reading lags the air: the response time (T90); BREATHE is smoothed.
* 0x85 reads 0 or below the air while 0x86 says 400: the zero point was set
in the wrong air (CAL or HD away from fresh air) - calibrate again in
fresh air. A constant offset: DRIFT, or ABC in a room that never gets
fresh air.
* 0x86 and PWM stop at 2000 (or 5000): the range - RANGE 5000 / 10000.
* The PWM reading is off by a factor: the sketch uses another range in the
formula than the sensor (the demo reads it with getRange()).
* The parts are not simulated: TEPMHZ19B.DLL is missing from MODELS and from
the project folder. No UNO / no monitor window: TEPARDUINO.DLL is missing,
or click the UNO's USB port.
* Advance: the pop-up does not appear - click OPEN PANEL on the board, or
turn "Open the panel at Run" on its Settings page back on.
BUG REPORTS AND FEATURE REQUESTS
Please post them in our forum with a screenshot, the Serial Monitor text, the
simulation log and (Advance) the Copy diagnostics text:
https://www.theengineeringprojects.com/forum/category/mh-z19b-co2-proteus-library
SUPPORT US
This library is free. If it saves you time, please support our work:
https://www.theengineeringprojects.com/donate
WEBSITE
https://www.theengineeringprojects.com/
LICENCES AND THIRD-PARTY NOTES
* The MH-Z19B model (TEPMHZ19B.DLL), the symbols and artwork and the Arduino
Library V4.0 (ArduinoV4TEP.LIB / TEPARDUINO.DLL, with its built-in TEP
Serial Monitor Advance) are made by The Engineering Projects. The model is
an independent implementation written from Winsen's user's manual (the
pins, the commands, the PWM, HD, the preheat and the response time) and
the public MH-Z19 Arduino library (the commands it uses). The model uses
only standard Windows libraries; no Visual C++ redistributable is needed.
The C++ source code is not included.
* Arduino UNO V4.0 (ArduinoV4TEP.LIB / TEPARDUINO.DLL, our Arduino Library
V4.0 - its microcontroller is Proteus's own AVR model): The Engineering
Projects, https://www.theengineeringprojects.com/2026/10/arduino-uno-library-for-proteus-v40.html
* The demo sketch uses two libraries; neither is included - install them
from the Arduino Library Manager:
- MH-Z19 1.5.4 by Jonathan Dempsey (WifWaf), GNU Lesser General Public
License v3.0 (LGPL-3.0), https://github.com/WifWaf/MH-Z19
("MH-Z19" in the Library Manager)
- AltSoftSerial 1.4 by Paul Stoffregen (PJRC), MIT License,
https://github.com/PaulStoffregen/AltSoftSerial
The .hex file contains both. AltSoftSerial's licence:
Copyright (c) 2014 PJRC.COM, LLC, Paul Stoffregen, [email protected]
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The MH-Z19 library is LGPL-3.0: its source code is available at
https://github.com/WifWaf/MH-Z19/tree/1.5.4 , and the demo sketch's source
is in "Arduino Code", so the .hex can be rebuilt with another version of
the library (REBUILDING THE FIRMWARE).
* The .hex file is built from the demo sketch, the two libraries and the
Arduino AVR core 1.8.6, which includes LGPL-licensed code; its source code
is available at https://github.com/arduino/ArduinoCore-avr/tree/1.8.6
* MH-Z19B and Winsen are names of Zhengzhou Winsen Electronics Technology Co.,
Ltd. Proteus is a product of Labcenter Electronics and is not included.
Arduino is a trademark of Arduino SA. This library is not made or endorsed
by Winsen or by Labcenter.
REBUILDING THE FIRMWARE (OPTIONAL)
The HEX file is supplied; Arduino IDE is not needed to run the demo. To edit
the sketch, install MH-Z19 and AltSoftSerial (Library Manager), open
Arduino Code\MHZ19B_CO2_Demo\MHZ19B_CO2_Demo.ino in the Arduino IDE, select
Arduino Uno and use Sketch > Export Compiled Binary. Replace the simulation's
.hex with the exported HEX.
The sketch needs 13,460 bytes of flash and 1,108 bytes of RAM.
MODEL SCOPE AND LIMITS
Modelled: the UART commands and answers bit by bit (the manual's five and the
MH-Z19 library's others), the checksum, the limited and unlimited values, the
PWM cycle and its formula, HD, the range, the preheat, the response time, the
zero point at 400 ppm with zero and span calibrations, ABC (24 h at a click),
a zero drift, the temperature, a recovery reset, power on / off, the air and
its changes (BREATHE, VENTILATE).
How the part works with the circuit: Vin and GND power the sensor (on or
off); Rx and HD are digital inputs; Tx and PWM are digital outputs with every
edge at its exact time.
Not modelled: the analog output Vo (no pin), the lamp and the light itself,
the supply voltage and current, the 3.3 V signal level, humidity, pressure
and heat, the sensor's ageing beyond DRIFT, the accuracy limits of a real
unit (50 ppm + 5 %), what a real sensor reports during its preheat, and how
ABC acts over weeks. The model's own choice
…Development1 release
-
V1.0MH-Z19B CO2 Sensor Library for Proteus V1.0this page
V1.0 is the only release in the Download Center so far. When a newer version is published, it appears above with its own download page.
Installation8 steps
From the download to a working project, in order. The steps follow what the package contains.
You will need
- Proteus Design SuiteProteus 8 or newer (Labcenter), on Windows
- Arduino IDE1.8 or 2.x, with the board of the tutorial chosen under Tools → Board
- Any archive toolWindows, macOS and Linux extract ZIP files on their own
Steps
- 1
Extract the archive
Right-click mh-z19b-tep-v1-0-05017fec3c05478599fab2f2d01485b6.zip and choose Extract All (or open it with 7-Zip or WinRAR) into a folder you can find again. Keep its folder structure (MH-Z19B-TEP-v1.0) as it is.
- 2
Copy the library files into Proteus
Move ArduinoV4TEP.LIB and TEPMHZ19B.LIB and the files into the LIBRARY folder of your Proteus installation: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY for Proteus 8, or the matching Proteus 7 folder. Older versions keep it under ProgramData\Labcenter Electronics. If Proteus is open, close it first.
- 3
Add the simulation model
Copy TEPARDUINO.DLL and TEPMHZ19B.DLL into the MODELS folder next to LIBRARY, so the component can run, not only be drawn.
- 4
Restart Proteus and place the component
Start Proteus, open a schematic, press P (Pick Devices) and search for the component by the name used in the tutorial. It appears with its pins ready to wire.
- 5
Open the sketch in the Arduino IDE
Open MHZ19B_CO2_Demo.ino, select your board and port under Tools, then Verify. Sketch → Export Compiled Binary writes the HEX file a simulation needs.
- 6
Load the HEX file
In Proteus double-click the microcontroller, set Program File to MHZ19B_CO2_Demo.hex and run the simulation. For real hardware, flash the same file with your programmer.
- 7
Open the example simulation
Open MH-Z19B-CO2-ArduinoUnoV4.pdsprj in Proteus to see the wiring exactly as in the tutorial. Check the controller's Program File path, then press Play.
- 8
Follow the tutorial
MH-Z19B CO2 Sensor Library for Proteus V1.0: NDIR, UART and PWM explains every connection and setting in order; keep it open beside the files while you build.
FAQs9 questionsContact TEP
How do I download MH-Z19B CO2 Sensor Library for Proteus V1.0?
Wait for the 30-second guest countdown on this page, then press the download button; the file comes straight from our storage. Members who are logged in skip the wait. If the browser opens the file instead of saving it, use its Save as option. The download link is made for you when the countdown ends and works for 15 minutes; a saved or shared link stops working, so share this page instead.
What is inside the archive?
MH-Z19B CO2 Sensor Library for Proteus V1.0 comes as a ZIP archive of 10 files (1.2 MB, 2.7 MB unpacked) holding Proteus library files, simulation model DLLs, a Proteus simulation, an Arduino sketch and compiled HEX firmware. Open the File Structure tab for the full list of 10 files.
What should I do if the download does not start?
Check the browser's download list first; an ad blocker or a company firewall can also hold it back, so try another browser or network. If the file arrives incomplete, download it again. For an installation problem, read the Install tab or tell us in the comments with your software version and the exact error message.
Is this file free?
Yes. Every file in the TEP Download Center is free for learning, personal and student projects. If you share it, link back to this page or the tutorial so others find the latest version.
How do I check that the file arrived complete?
Compare its SHA-256 with the one on this page, af85405aba2b854de3ac5bd8ec94799848897beab407c0a1df6a25ac5b2f494a. In PowerShell run Get-FileHash "mh-z19b-tep-v1-0-05017fec3c05478599fab2f2d01485b6.zip"; on macOS or Linux run shasum -a 256 "mh-z19b-tep-v1-0-05017fec3c05478599fab2f2d01485b6.zip". The same value means the file is exactly the one in our storage; a different one means the download broke off, so download it again.
Do I need WinRAR to open the ZIP file?
No. Windows, macOS and Linux open ZIP archives on their own (Extract All, or double-click). WinRAR and 7-Zip work too. Extract the whole archive before using the files.
Where do I put the LIB and IDX files?
Both files go into the LIBRARY folder of your Proteus installation (Proteus 8: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY; Proteus 7 has the same folder under its own name). Restart Proteus afterwards and search for the component with P.
Which Proteus version does the library need?
The tutorial names the Proteus version the library was made and tested with. Most TEP libraries work in Proteus 7 and Proteus 8; if the component does not appear after a restart, check that both the LIB and the IDX file were copied and that Proteus was fully closed while copying.
How do I get the HEX file into the simulation?
Compile the sketch in the Arduino IDE (Sketch → Export Compiled Binary gives you the HEX next to the sketch), then in Proteus double-click the board, set Program File to that HEX and run.
Members skip the wait. Log in or join TEP.
- 10Total downloads
- 4%Popularity
- ProteusCategory
- 0Comments
- ssyedzainnasirUploaded by
- 16 Oct 2026Uploaded at
af85405aba2b854de3ac5bd8ec94799848897beab407c0a1df6a25ac5b2f494a
















Comments
0