mq lib

Dependents:   gather_sensor_data

Committer:
readysteadygo2006
Date:
Thu Sep 08 14:05:33 2016 +0000
Revision:
0:a43405a3d273
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
readysteadygo2006 0:a43405a3d273 1 /**************************************************************************/
readysteadygo2006 0:a43405a3d273 2 /*!
readysteadygo2006 0:a43405a3d273 3 @file MQ135.h
readysteadygo2006 0:a43405a3d273 4 @author G.Krocker (Mad Frog Labs)
readysteadygo2006 0:a43405a3d273 5 @license GNU GPLv3
readysteadygo2006 0:a43405a3d273 6
readysteadygo2006 0:a43405a3d273 7 First version of an Arduino Library for the MQ135 gas sensor
readysteadygo2006 0:a43405a3d273 8 TODO: Review the correction factor calculation. This currently relies on
readysteadygo2006 0:a43405a3d273 9 the datasheet but the information there seems to be wrong.
readysteadygo2006 0:a43405a3d273 10
readysteadygo2006 0:a43405a3d273 11 @section HISTORY
readysteadygo2006 0:a43405a3d273 12
readysteadygo2006 0:a43405a3d273 13 v1.0 - First release
readysteadygo2006 0:a43405a3d273 14 */
readysteadygo2006 0:a43405a3d273 15 /**************************************************************************/
readysteadygo2006 0:a43405a3d273 16 #ifndef MQ135_H
readysteadygo2006 0:a43405a3d273 17 #include "mbed.h"
readysteadygo2006 0:a43405a3d273 18
readysteadygo2006 0:a43405a3d273 19 #define MQ135_H
readysteadygo2006 0:a43405a3d273 20
readysteadygo2006 0:a43405a3d273 21 /// The load resistance on the board
readysteadygo2006 0:a43405a3d273 22 #define RLOAD 10.0
readysteadygo2006 0:a43405a3d273 23 /// Calibration resistance at atmospheric CO2 level
readysteadygo2006 0:a43405a3d273 24 #define RZERO 76.63
readysteadygo2006 0:a43405a3d273 25 /// Parameters for calculating ppm of CO2 from sensor resistance
readysteadygo2006 0:a43405a3d273 26 #define PARA 116.6020682
readysteadygo2006 0:a43405a3d273 27 #define PARB 2.769034857
readysteadygo2006 0:a43405a3d273 28
readysteadygo2006 0:a43405a3d273 29 /// Parameters to model temperature and humidity dependence
readysteadygo2006 0:a43405a3d273 30 #define CORA 0.00035
readysteadygo2006 0:a43405a3d273 31 #define CORB 0.02718
readysteadygo2006 0:a43405a3d273 32 #define CORC 1.39538
readysteadygo2006 0:a43405a3d273 33 #define CORD 0.0018
readysteadygo2006 0:a43405a3d273 34
readysteadygo2006 0:a43405a3d273 35 /// Atmospheric CO2 level for calibration purposes
readysteadygo2006 0:a43405a3d273 36 #define ATMOCO2 397.13
readysteadygo2006 0:a43405a3d273 37
readysteadygo2006 0:a43405a3d273 38 class MQ135 {
readysteadygo2006 0:a43405a3d273 39 private:
readysteadygo2006 0:a43405a3d273 40 PinName _pin;
readysteadygo2006 0:a43405a3d273 41
readysteadygo2006 0:a43405a3d273 42 public:
readysteadygo2006 0:a43405a3d273 43 MQ135(PinName pin);
readysteadygo2006 0:a43405a3d273 44 ~MQ135();
readysteadygo2006 0:a43405a3d273 45 float getCorrectionFactor(float t, float h);
readysteadygo2006 0:a43405a3d273 46 float getResistance();
readysteadygo2006 0:a43405a3d273 47 float getCorrectedResistance(float t, float h);
readysteadygo2006 0:a43405a3d273 48 float getPPM();
readysteadygo2006 0:a43405a3d273 49 float getCorrectedPPM(float t, float h);
readysteadygo2006 0:a43405a3d273 50 float getRZero();
readysteadygo2006 0:a43405a3d273 51 float getCorrectedRZero(float t, float h);
readysteadygo2006 0:a43405a3d273 52 };
readysteadygo2006 0:a43405a3d273 53 #endif