MICS-2614 library

Hello…
I am working on MICS-2614 Ozone sensor. I tried to find out library for MICS-2614, but i can’t. I don’t know how to make code for it. I also refered datasheet, but i found only schematic, not library or any equation. Can anyone suggest me how to make library of MICS-2614 or suggest me links to get tips for coding?

I have not used this chip, but I read the data sheet and I believe this should work. Keep in mind that I have not tested this!

Connect pin F (heater+) to 3V3.
Connect pin C (heater-) to a 160 ohm resistor, which is then connected to GND. Note that the data sheet says 82 ohm, but that’s for a 5V supply.

Connect pin G to 3V3. The data sheet indicates 5V, but the analog inputs can only be used up to 3.3V and you should be able to use 3.3V for the measuring circuit.

Connect pin D to an analog input pin (A0-A6). Also connect pin D to GND using a resistor. The minimum is 820 ohms, but I’d use 10K.

The sensor is a variable resistance between pin G and D, depending on the level of ozone. The resistance varies from 3K to 60K ohms.

By adding the external 10K resistor, you have a voltage divider circuit, so the voltage at the analog input will vary between 0.471V and 2.538V. This corresponds to an analog input value that you can read using analogRead() of 584 to 3150. Note that the numbers are backwards, 584 is the maximum concentration of 1000 ppb and 3150 is the minimum concentration of 10 ppb.

Good luck!

Thank you for your answer.
Can you suggest me any equation for ppb calculation?

This took some thinking:

double value = (double) analogRead(A0);
double ppb = Math.pow(10, (2566-(value-584) / 1283) + 1)

You might need to play around with the constants a little to get it to work out.
2566 = maximum value you get, which is actually the minimum amount of ozone
584 = minimum value you get, which is the maximum amount of ozone, which hopefully you’ll never see
1283 = a factor used to get the full range to work out to two orders of magnitude on a log10 scale

Thank you so much, Now i will try with this equations.

Thank you once again.

This Equation is not working. It gives me infinite value.

Oops. Sorry, I think I missed parentheses. It should be:

double ppb = Math.pow(10, ((2566-(value-584)) / 1283) + 1)

Thank you. Now it is seeming that it is working. Can you tell me these values are right or wrong?

Can i ask how you get this equation?

I have no way of knowing for sure, but the values look plausible.

The values from analogRead should range from 584 to 3150, but are reversed where 3150 is the minimum (10 ppb) and 584 is the maximum (1000 ppb).

The first thing I did was adjust to 0 to 2566 by subtracting 584 = (value - 584).

Then make it so 0 is the smallest ozone concentration instead of the largest
2566 - (value above) = 2566 - (value - 584)

According to the data sheet, the scale is logarithmic, so the lowest value is 10, the largest value = 1000 and the middle value is 100 ppb. The middle value is 2566 / 2 = 1283.

The next step is to convert the scale from 0 to 2566 to 1 to 3, that’s ((2566-(value-584)) / 1283) + 1.

Then the Math.pow(10, ((2566-(value-584)) / 1283) + 1) converts the 1 to 3 to the range of 10 (10^1) to 1000 (10^3) using a log10 scale.

1 Like

Can you tell me readings are right or wrong?

How could @rickkas7 possibly know how much ozone is near your sensor right now?

As he said above, the values are “plausible” and that means in the right range. Do you have source of ozone you can test with to see how the values go up or down?

2 Likes

I ordered this sensor. Right now i am taking readings from proteus simulation as you can see in above image. But i think my reading are wrong, because according to data sheet range of sensor is 10 to 1000 ppb.

How can i make equation for ppb calculation from above graph? I made equation, but it gives me wrong reading.

Hi @ashish.talaviya

A few things to note about that graph:

  1. The X and Y on that graph are “backwards” from the equation you want–you need to measure resistance and calculate O3 ppb.
  2. The graph has been calibrated to a normalized resistance value for 100ppb. You need to think about how you would come up with this number since the datasheet only says it is between 3 and 60 kohm.
  3. The graph is for 25 degrees C and 50% relative-humidity and might not be valid at other temperatures and humidity levels.

If you have MATLAB or similar, you can do a polynomial fit to some points from the graph (just remember that the Y axis is the input and the X axis is the output. Finding the order of the polynomial to fit requires some experience or guess work. If you have not studied linear algebra, it will be hard to explain how this polynomial fit is obtained, but I am sure if you search many references will come up.

When I fit a polynomial to a few points from that graph and assume a third-order equation, I get the following equation which seems to fit the points well. If you had actual calibration data from the sensor you are using, you could do better.

Rnorm = Rmeasured / R100ppb;  /* You must find R100ppb to calibrate */
x = Rnorm;

O3ppb = 1.15354664573491*x^3 + 0*x^2 + 95.0232835796925*x +  3.82316977457257;
1 Like

@bko, just a note - the second order term is zero :wink:

I left it in just to show that there is not a mistake in the order of the equation.

1 Like

@bko
Thank you so much.
I saw Proteus Simulation with this Equation. I think it is ruuning.
I ordered Sensor. When it will come, I will test and give updates.

Bko,
Could you please elaborate how to create “reverse” polynomial equation?
I am using excel, and i understand how to get the equation taking X or ppm as input, but can not figure out how to reproduce your suggestion.
Thanks

Hi Wally,

Reverse here just means that when you read the graph, pretend the Y axis is the X axis and vice-versa. No big deal. It is like you printed the graph and rotated it 90 degrees.

I have never tried this in Excel, but it has a function called LINEST that looks like it might work. It does a linear least-squares fit to the points you give it. You want something like =LINEST(Y0:Y10, X0:X10^{1,2,3} for a third-order fit to 11 points.

There are many ways to fit equations to data and the way I did it was to sample several points off of the graph in [x,y] = [R, ppm] format, like [0.065, 10], [1, 100], [6.75, 1000], etc. I then formed the Vandermonde matrix with the x-coordinates and computed the inverse matrix. I then multiplied this inverse by the y-coordinate vector to get the polynomial coefficient vector.

The procedure is outlined on this page under Applications:

Note that none of the polynomial fitting procedures can create a polynomial that is meaningful outside the range of points you fitted to, so in this case we have data from R = 0.01 to 10 and any R input outside that range will lead to potentially incorrect results.

1 Like

If you put a good amount of points taken from the chart into Excel, create a chart and add a trend line, you can choose a well suited option an let the function be displayed in the chart.

But @bko has provided the more professional view :wink:

1 Like