How to drive Winsen MG812 with Op-Amp

Hi All! What would be a sensible way of driving a Winsen MG812 sensor?

Here’s a link to the datasheet:

I’ve been experimenting with an LM324 as well as a TI OPA333 op-amp and I seem to be destroying them as they don’t work properly in Unity-gain mode any more - as in the two inputs always read completely different voltages now. Most electrochemical sensors of these sorts use a sort of resistive sensing method whereas the MG812 actually generates electromotive force, and one of the big rules of op-amps is that you shouldn’t feed current into them, which I think I did. The diagram on the datasheet is a bit ambiguous.

The attached schematic is my op-amp frying circuit using this sensor.

Any ideas would be amazing, thanks in advance!!

I don't see how that would kill your op-amps.

The LM324 is not a rail-to-rail op-amp and with a single +5V power supply it's probably not going low-enough to work.

The OPA333 should get closer to ground.

You can test your op-amps by making a unity-gain amplifier and feeding-in 2.5V with a voltage divider. Or, just connect the input to +5V and check and output "close" to +5V, and then to ground and check for an output "close" to zero V.

whereas the MG812 actually generates electromotive force, and one of the big rules of op-amps is that you shouldn't feed current into them

Electromotive Force is another way of saying voltage. You can't force current into an op-amp. Ohm's Law is still a law of nature and unless you over-voltage the inputs, they will remain high impedance.

And since the Arduino has a very-high impedance analog input, I don't see any reason for a unity-gain op-amp.

The sensor they show has 4 leads, 2 for the heater and 2 for the sensor. Your pic only has 3 pins, and the sensor is wired to 5vdc. The datasheet has the sensor putting out mV range. Have you tried hooking the sensor up on it's own and monitor the output voltage while breathing on it?

Yes, the datasheet is hard to follow. The Chinese to English translation is ....lacking.

The graph shows a voltage span of about 55mV.
That's only 11 A/D values over the entire measuring range when default Aref is used.
And about 50 values if 1.1volt Aref is used.
Don't know if that will give the resolution you're after.
I think you need an (instrumentation) amp for this sensor.
This page shows one for the MG-811.

Just to check on that circuit you posted. You are applying a supply voltage to that op-amp aren’t you? If you don’t wire up the power rails then that would destroy the op-amp. Also you need some supply decoupling on the amplifier. These are often not shown on a diagram because “everyone” knows you need them. It is just that beginners often don’t.

Apart from that that the circuit is not sufficient to do the job. You need an instrumentation amplifier with the two sensor signals being applied to the + and - inputs.

What would be a sensible way of driving a Winsen MG812 sensor?

You are not driving that sensor. Driving means controlling it, like you drive a car. You are actually reading the sensor. While it might sound pedantic using the correct words is vital for communication.

Finally many beginners are not aware that sensors like this need to be on for 24 to 48 hours to stabilise and that they need calibrating with a known concentration of C02.


Your sensor schematic does not at all match the schematic on page 3 of the datasheet or the pinout info on page 5.

On 4-pin type sensor:
1, 3 is for the heating electrode,
2, 4 is for the test electrode

(pins are labeled CW starting with pin 1 at the TAB (bottom view)

Look at your schematic.
Do you see any pin numbers ?

Look at the datasheet.
Do you see the Test pins SHORTED to the HEATER pins like YOUR schematic ?
The Test pins are labeled A & B with B being the output (to the op amp) and A being the feedback (from the OP AMP.)

Do you see any such wiring in your schematic ?
(as already noted, your schematic shows no power supply connection information. That is critical.)

Until you post a schematic that is consistent with the datasheet I don’t see point in discussing this.

Wow thank you all for your replies!

A few things I should have clarified is that I am using an ADS1115 ADC and I am in fact using a Particle Photon not an Arduino although this is largely irrelevant. This has been brought up on the particle forum before and I haven’t seen the quality of answers I’ve received here.

Yes the schematic is very lacking, I copied what I had on eagle and at the same time joined together the two grounds inside the sensor. The datasheet schematic is totally ambigious and simply says that that the two ends of the sensing element should be connected to a circle saying ‘mV’ which I somehow interpreted as one having to go to ground, and another to the ADC. I think I may reconsider my use of an op-amp and ramp up my circuit to include an instrumentation amplifier (Microchip MCP6N11) as its the more stable measuring chip for this application and has a nice, stupidly high impedance that I want.

@dvdDoug: I had used the OPA333 before and was still having the same issue of it not quite matching the inputs. I'm well aware of what EMF means although there is something different about this sensor. most work in such a way that the 'top' end of the sensor element is connected to +5v and the 'bottom' is connected via a load to ground and you measure the resistance of the element. With this one its actually producing a voltage and I’m guessing you can’t feed that into an op-amp input and expect to be very happy with you. Also the ADC is high impedance, but the datasheet is asking for an ‘inner resistance of higher than 100GΩ’ and the input impedance of my ADC is not more than 20MΩ.

@tinman13kup Yes my diagram is incomplete, the full schematic is quite large as its not the only sensor and also I can't splurge the whole thing on here due to the secrecy of the project. I have several sensors working completely fine but this one is driven differently. If you look at the datasheets

@Wawa Its possible that I may implement an instrumentation amplifier, wheatstone bridge or something similar or simply connect the negative input to the middle of a voltage divider to amplify the signal thus giving me a greater range (although am I right in thinking it would amplify the noise as well?)

@Grumpy_Mike Yep there is voltage going into it, forgive my loose terminology. I have no issues reading it hooked up directly to an ADC but for stability, this is not the way to do it. Also we are warming it up, it runs continuously and has been for a couple of days now. I did also put a 1μF capacitor to decouple the supplies.

@raschemmel Keep calm its only a message board :slight_smile: You may notice that the datasheet schematic also does not reference any kind of ground or power supply information (other than 5V for the heater) and I was just being minimalist to save time.

Apologies if I’ve missed anything again. Replies will be faster as its not the weekend.

one thing I forgot once again, pin numbers: Clockwise from top-left: 1,4,2,3

I hope thats everything!

I hope thats everything!

Well no.
You managed to ignore all the good advice you were given.

Your sensor schematic does not at all match the schematic on page 3 of the datasheet or the pinout info on page 5.

Why is your circuit not wired per the example in the datasheet ?

The sensor is supposed to be between the op amp +V pin and the op amp output pin. (COMPLETELY isolated from GND )(insert exclamation point for emphasis...)
It is not supposed to be connected to GND , period.

There should be a current sense resistor in the op amp feedback loop and the ads1115 differential inputs should be connected to either side of that resistor. We can't help you if you don't follow instructions.
Why post if you are going to ignore our advice ?

Right now you aren't even in the right ballpark..
(your schematic has a 0 % chance of working.
Any guesses why ? (hint:current)
What is op amp input input bias current ?
what is the source of voltage on op amp +V pin ?

I haven't really ignored all the advice thank you very much, I have only redrawn the diagram to match what I had first wired more accurately. I am quite busy so I'm not devoting all my hours to this single sensor so I was simply updating my first post essentially to more accurately portray the situation.

TBH I had assumed it would be connected to ground because most are and you would be astounded at what is missed in these datasheets. I have received about 10 different instructions all at once so give me a chance to try it and get back to you. Also nobody had previously mentioned that I should use the differential inputs of the ADC, Neither had a current sensing resistor been mentioned. Are you saying that this current sensing resistor should be wired in where the 'mV' circle is? What sort of specification of resistor would you recommend?

Speaking of which, What is that 'mV' symbol on the schematic? Not something I've seen before...

My apologies for not being the most competent or experienced person but hey this is the arduino forum and analogue stuff is relatively new to me so please bear with me.

I'll try all this stuff out tomorrow afternoon and get back to you all.

Rcurrent sense =5V/0.500 A (500 mA max output) = 10 ohms

This will take some time to order as we are in Lebanon but I will get back to you when we have it.

Thank you

"mV" = milliVolts

I understand that mV is milliVolts... but 'milliVolts' is not a component or device. I guess it is saying that if there is some load there then there will be something inthe range of milliVolts across it? Or something to that effect...

P.s. the parts have finally arrived. A 10 ohm current sensing resistor as well as a INA 333 op-amp

A "component" that measures milliVolts is called an "ammeter" and traditionally was a round metal guage manufactured to measure 0 - 1000 milliVolts but with the advent of smart digital "Multimeters" it could be a DMM
(Digital MultiMeter (configuredvl fir mV current measurement by moving the red lead from the "Volts/Resisance" banana jack to the 300 mV jack).


Here is the new circuit I am using.

R1 = 10 ohm
R2 = gain resistor... i have yet to decide the value of this yet.

At the moment I'm not actually using the INA333 but I will implement it as soon as something actually reads across the 10 ohm resistor, so far I'm getting nothing. This is using both the ADC and the multimeter to measure the voltage across it.

Just a heads up.. I'm not purposefully ignoring anybody's advice, I'm not that stupid. But I am stupid enough that it will take more than one reply for me to get my head around :slight_smile: