I purchased a Grove Oxygen gas sensor and am trying to use it without the Grove Arduino shield - that means I’m wiring it directly to my Arduino Uno. However, I haven’t been able to find a wiring diagram on this website, in the forum, or on the Seeed Studio website or wiki.
I’d greatly appreciate it if someone could provide guidance as to proper wiring for this sensor, as well as some meaningful documentation for this sensor - example code or at the very least a table or chart correlating the sensor output to an actual oxygen concentration. The information on the Seeed Studio wiki page for this product is outdated and incorrect according to their own technical support staff.
I have it wired up as follows: VCC goes to the +5V pin, GND goes to the ground pin, and SIG goes to one of the analog input pins on the Arduino, but I have no idea if this is right or if the sensor is even configured for analog output. When wired up in this configuration, the sensor outputs a nearly constant 5V as measured by the Arduino or an external multimeter.
It sounds like you have the right wiring setup: VCC goes to the +5V pin, GND goes to the ground pin, and SIG goes to one of the analog input pins on the Arduino.
Some gas sensors have a “break-in” period, where the sensor needs to be run up to 20 minutes before the output signals start making sense. Seeedstudio doesn’t mention if this is needed for theirs. Can you try?
Regarding the break-in/warm-up period, the sensor output still didn’t make sense after several hours of operation, so I don’t think it’s a warmup issue - although I do indeed notice a small change in output within a couple minutes of turning the sensor on.
I’ve looked at the Winsen data sheet for the oxygen sensing electrochemical cell itself (the heart of the sensor). If I’m interpreting it correctly, it seems that the cell itself outputs an electrical current which is proportional to the oxygen concentration. They also include a chart correlating an output signal voltage (0-12mV) to an oxygen concentration, which is somewhat confusing to me because they don’t say how the generate the output voltage. My guess is that the Seeedstudio board contains circuitry that converts the current output of the electrochemical cell into a voltage that can be read by the Arduino, but I can’t figure out how the board does this. The example code provided by Seeedstudio on the product wiki page does compile and run, but the output doesn’t make sense when looking at the output signal-oxygen concentration chart (it outputs something like 23-24mV with the sensor in air). They also have a conversion formula in their code that they don’t explain.
I’ve tried contacting Seeedstudio about this and they admit their wiki documentation is out of date, but they didn’t provide any explanation of the example code or an updated correlation chart.
Do you, or someone else at Robotshop, have any idea of how the Seeedstudio board works or how to interpret its output?
I haven’t used this sensor myself, and it’s true the documentation isn’t really clear… It seems that the sensor does output a small signal that is then amplified by an op-amp on the PCB, and the output signal from this is then read by the Arduino. I think the 0-12mV signal is before the amplification by the op-amp, as the sample code has a thresholdVoltage at 1.84V…
Are you able to test the sensor with the current code in different environments to see if the value will fluctuate? For example, compare the values for indoors, versus outdoors, versus next to a BBQ or next to a car tailpipe? Can you give us an idea of the values that you’ve observed in these situations?
I think that 1.84V threshold voltage in their sample code is for triggering some kind of alarm indicating a low oxygen concentration.
Indoors the sensor board raw voltage output is ~4.67V, and if I breathe on it for a short while the output drops to about ~4.39V and then returns to ~4.67V when I stop, so the output is indeed changing based on the sensor environment.
I’m pretty sure the 0-12mV signal on the SeeedStudio Wiki page is in reference to the output from the following line of code:
sensorVoltage = sensorVoltage/201*1000;
This line takes the raw board output voltage and divides it by 201, then multiplies it by 1000 (there are no parenthesis to establish order of operations, so it just executes the two arithmetic operations left-to-right). Using the 4.67V raw board voltage this produces something like 23.23mV, however, this value is literally off the chart they provided and there is no explanation of the equation or how to interpret its results.
The sensorVoltage is the output voltage of the sensor’s signal. It is then compared with a thresholdVoltage (configured at 1.84V in this case), and once the voltage drops below there, the buzzer is turned on.
This part of the program agrees with what you have observed: the sensor reads around 4.67V normally, and the voltage decreases (to 4.39V and lower) as concentration drops.
So I think the code should be
const int buzzerPin = 3; //Connect the Buzzer Grove module to Pin3, Digital 3
float thresholdVoltage = 1.84; //The treshold for which the Buzzer should sound.
void setup() {
Serial.begin(9600); //Start the Serial connection
pinMode(buzzerPin, OUTPUT); //Set the LED on Digital 12 as an OUTPUT
}
void loop() {
float sensorValue;
float sensorVoltage;
sensorValue = analogRead(A0);
sensorVoltage = (sensorValue / 1024) * 5.0;
if (sensorVoltage < thresholdVoltage) {
digitalWrite(buzzerPin, HIGH);
} else {
digitalWrite(buzzerPin, LOW);
}
Serial.println("the output voltage is:");
Serial.print(sensorVoltage);
Serial.println("V");
delay(1000);
}
I’m not sure thought what this means for the graph. If possible, I’d just ignore it and do experimental tests to see what are better values.
I also noticed the same graph on the datasheet from Winsensor. It just seems like there isn’t any helpful documentation on this sensor anywhere, which is disappointing. I’ll let you know if I do move ahead with this sensor and develop a calibration curve, as there may be other people similarly frustrated by the lack of documentation.
I thought I’d share an update with you. The graph provided on the datasheet for the sensor itself (from Winsen) is the voltage output of the sensor when hooked up to a 100 ohm resistor. More on this in a minute. I was able to track down the board schematic and I figured out that the circuitry on the board is basically an op amp with a gain factor of 201 - which explains the sensorVoltage = sensorVoltage/201*1000; line of code. This code basically removes the gain from the op amp and gives you the actual output voltage across that 100 ohm load resistor, which you should be able to use with the graph to determine the oxygen concentration (in principle). The problem is that Winsen, the manufacturer of the electrochemical sensor itself, has changed the sensor without releasing an updated datasheet; the new version of the sensor has a bigger output that doesn’t match the graph on the datasheet. I’ve contacted Winsen about getting an updated data sheet and I’ll try to post the relevant data here if/when I get it.
I am another grove o2 sensor (with winsen me3-02 EC unit) user in frustration. When i directly connect the sensor to arduino (+5v-vcc; Gnd-Gnd; A0-Sig) , I get analogread fluctuating around 1017. No influence on the surrounding air has any effect on the raw analog read (which I hope is the basic expectation). Let us worry about what happens with conversions as given the “non-working” code given in the wiki page of seeedstudio.
I have tried the following and got these respective (negative) results
I removed the white label (gas barrier) on top of hte electrochemical unit(EC), doubting if it prevents the gas exchange with the sensollt. I get the same results.
I have introduced a pull-down resistor between the wiring of Gnd and A0. The analog values came down, but that does not change the sensitivity of the sensor, where the values does not change when I change the surrounding air (blowing, vaccum, etc.,)
I dont know if the sellers are concerned about their customers, no action has been taken on this issue in spite of their marketing slogans on this product.
I went through the same thing and share your frustration. Several things to point out:
]The example code on the seeedstudio wiki page does work, it’s just neither documented nor explained. As I detailed in an earlier post in this thread, the Grove O2 sensor board is basically a 100 ohm load resistor for the Winsen ME3-O2 electrochemical oxygen cell, and an op-amp with a gain factor of 201 to amplify the voltage measured across the load resistor. To use the sensor with the board, you can either work with the raw output from the board which should range from 0V to just shy of 5V when powered with 5V, or you can divide the raw output by 201 to get the voltage output of the EC cell itself./:m] ]The Winsen website has an outdated/obsolete data sheet posted for the ME3-O2 sensor. Their data sheet says the ME3-O2 sensor itself should output about 11mV in air when connected to a 100 ohm load resistor, however the unit I received outputs about double that and I’ve been unable to get any updated info from Winsen. So I’ve been operating on the assumption that the EC output is linear with oxygen concentration but I’ve been using my own calibration scale./:m] ]There is a bit of a “warm-up” period with these sensors if they’ve been sitting unused or unplugged for a while. My recommendation is to hook plug the EC module into the board and simply log the output of the board, probably with a computer via serial connection to your Arduino. My intuition tells me that when exposed to oxygen, but disconnected from any load resistor, the EC module is behaving like a battery that is slowly charging itself up. In order to function properly as a sensor, the stored charge must first be discharged so that the output depends only on the rate of oxidation, which is determined by the ambient oxygen concentration. Now that I think about it, simply leaving the EC module plugged into the Grove sensor board puts the load resistor across the EC module terminals, so if you didn’t want to log or monitor anything you could just leave the EC module plugged in for a day or so and it should be good to go./:m]Good luck. Let us know how it works out or if you run into more trouble.
Sorry for the belated feedback. I wanted to say that it worked! But, alas! It didnt work even with 48 hrs of warmup. This is a learning for me, but a costly one. Thanks Grove and Winsen
I dont want to rewrite what I have tried earlier, as it was given in my earlier response. Whats new here is just following your recommendation of giving warmup period for the EC unit to possibly read meaningful values. I dont get whats out of context here. All that I wanted to say is the warmup suggestion didnt help. But that does not mean I misunderstood your help. Thanks.
After a lot of googling and reading I made it work - here’s how, based on a comment on seedstudio’s webpage:
Page 2, reply to “jeff”'s post on Oct 17,2018
Use this code in the zip, provided in one of the many comments by Seedstudio - I’ve been struggling to make it work and get proper readings until I found this…