Antilog converter linearizes carbon dioxide sensor

Hanwei Electronics MG-811

Jordan Dimitrov


While most carbon dioxide sensors use IR technology, electrochemical sensors are a serious competitor because of their high sensitivity, wide measurement range, and low price. As a rule, electrochemical sensors connect to a microcontroller through a buffer amplifier with an extremely low bias current (< 1 pA). The micro is needed to linearize the logarithmic response of the sensor. A good example of this approach is the SEN-000007 module from Sandbox Electronics, which uses an MG-811 CO2 sensor from Hanwei Electronics. Reference 1 reveals the circuits and the code, but does not specify accuracy.

Antilog converter linearizes carbon dioxide sensor
Figure 1. The sensor has a logarithmic response with a 265 mV offset.

This Design Idea shows a pure hardware solution to the linearization problem with a simple and cheap circuit that features easy adjustment and good accuracy. The output signal can go directly to a panel meter or a microcontroller, requiring no complex data manipulation such as log or antilog calculations.

The MG-811 sensor measures CO2 concentration from 400 to 10,000 ppm (0.04% to 1%). Figure 1 displays the transfer function of the sensor. The data points come from the datasheet of the MG-811. The line and equation are generated by the curve fitting tool of Microsoft Excel.

Antilog converter linearizes carbon dioxide sensor
Figure 2. A quad op-amp and a pair of matched transistors provide
simple and cheap linearization. R7 is a standard
compensating resistor, as from PRC.

Figure 2 presents the circuit. It uses a quad op-amp and a pair of matched transistors. IC2A and IC2B, make a conditioning circuit that provides high input resistance to the sensor, removes the 265 mV offset from the sensor response, and amplifies the resulting signal. The goal is to modify the sensor response to the form VS = lnC (C is CO2 concentration) so the antilog converter (built with IC2C, IC2D, and the matched transistors, Reference 2) can implement the elnC = C identity, thus providing a linear relation between VOUT and CO2 concentration. The 2.5 V reference IC1 allows the circuit to work with other gas sensors – like the TGS4161 from Figaro – that require not 6 V, but a 5 V power supply. Note that the sensor draws a lot of current.

Antilog converter linearizes carbon dioxide sensor
Figure 3. Accuracy is enough for a 3.5-digit panel meter.

The circuit needs only a full-scale adjustment (R11) for calibration. Accuracy is ±0.3% (see Figure 3), which matches well to a 3.5-digit panel meter, and is much better than the expected accuracy of this type of sensor.


  1. MG-811 CO2 Sensor Module
  2. AN-30 Log Converters, National Semiconductor (TI)
  3. TGS4161 Carbon Dioxide detector


JLCPCP: 2USD 2Layer 5PCBs, 5USD 4Layer 5PCBs

You may have to register before you can post comments and get full access to forum.
User Name
Free Shipping for All PCB Assembly Order