Monday, September 22, 2014

air sensors coming along

I've got a team focusing on air sensors.  So far, we've focused on the MQ series.  You get what you pay for, so these are the most reliable devices.  They operate with a heated element to produce a redox voltage, much like an oxygen sensor in your car does.


Pictured above is a very amateurish attempt at calibrating an MQ-2 methane sensor.  The natural gas in the chemistry lab, like most commercial gas, is about 96 percent pure, so in theory, a saturation of it would be 960,000 ppm.  Don't laugh, I know that's not what's happening here.  We're trying to teach theory, not reality, on this one.  We pumped a line from a gas valve into this cloche and looked for a max value on the analog to digital read.  In this case, it maxed at about 970.  The low that we get for this sensor is 54.   The data sheet for the mq sensors has them calibrated on a logarithmic scale.  We got our constant this way:

960000=10k(970-54)  or     max val ppm= 10 k (max analog read-min analogread)
Log 960000 =  k(916)
Log960000/916 = k = .006530864

so the final formula that converts the analog read to ppm is based on the formula:

Y= 10 ^ .006530864(x-54)                         x being the analog read value



The math in the Arduino sketch would go this way:

void loop() {

  // read the analog in value:
  // read the sensor:
  int sensorReading = analogRead(A0);
    float ppmValue = pow(10,(.006530864*(sensorReading-54)));
  // print the sensor reading so you know its range
    Serial.print("ppm methane = " );                      
  Serial.println(ppmValue);



We can think of half a dozen reasons off the top of our heads to not trust whatever number is spewing out, but in theory, it gets the principle of calibrating and constants taught.  If we're lucky, we might track down some really accurate monitoring devices for our pollutants  that we can calibrate against to get our own readings somewhere in the ballpark.  

No comments:

Post a Comment