We use cookies to provide our visitors with an optimal site experience. View our privacy notice and cookie notice to learn more about how we use cookies and how to manage your settings. By proceeding on our website you consent to the use of cookies.
Hello I have a problem with the 968-006 SO2 sensor. Sometimes when I run the arduino code from the ULPSM github example, the recheck settings shows up even though I haven’t changed anything. It works mostly but sometimes it doesn’t I don’t understand why. But when it does work, the ppm values fluctuates by 0-2 ppm in clean environment. What I’ve seen is that the safe levels are within 0.15 ppm. I’m using MCP6002 opamp for it and this is the diagram.
That first discontinuity from 95 to 0 at index 3000 suggests an integer overflow.
As a simple example, consider a uint8_t:
Actual
Perceived
254
254
255
255
256
0
257
1
This could be an actual overrun or an error in math e.g. division. Watch out for implicit cast operations. IMO, it’s better to explicitly cast your numbers to prevent this type of hazard.
Sincerely,
APDahlen
P.S. There is more going on than just the classic wrap, as the number continued negative past index 10,000 instead of jumping back up. Others may have more to say about this behavior.
Hello @heke Thanks for the reply! I have added the 100nF to both the mcp6002 ic. The signals look much more cleaner but it drifts away after some time.
On the first few minutes the data looks like it is very stable but after that it drifts up and down significantly but it seems like the high-frequency noise has been eliminated.
Hi @APDahlen It’s actually a command I sent on the serial monitor where if it receives the letter ‘Z’, it will make the latest current reading as the baseline for clean air or 0 ppm. It’s used to calibrate the sensor.
Do some investigation as to where the reference voltage for the ADC conversion is coming from.
If (for example) it’s the the USB power supply voltage, any variation in such will be directly reflected in the conversion result when measuring an input that is not also proportional to that voltage.
Use of a suitable voltage reference IC is needful for such cases. Considering that the nominal output of the sensor here appears to span only 60mV while the spec for USB power can vary by ±250mV and still be within spec, it’s a case that would seem to qualify.
First, from the datasheet for the 968-006, it states that the "Power-On Stabilization Time is 60 minutes, which means it should be powered on for 60 minutes before one can consider the measurements taken as valid. Have you taken that into account?
Second, based on my calculations, using the full 10-bit resolution of the ATmega328 of the Arduino Uno using a 3.3V reference voltage, one bit is equivalent to about 3.2mV, which, according to the datasheet for the sensor board, is slightly more than the typical output change of 1ppm when using a 3.0V reference.
So, basically one LSB is about equivalent to 1ppm, and therefore 20 LSB would be the full range of the sensor’s 20ppm output. This is only 1.2% of the full range of the ADC. It’s very easy for the ADC to misread any given sample by an LSB or two, which means one or two ppm in this application.
I haven’t looked into the include files in your code above, but one should make sure that you’re giving the Arduino the best chance to get an accurate reading by slowing the ADC clock down as much as possible (this gives a longer sample time) and by taking multiple samples and averaging them (this helps to filter out noise).