Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: gather_sensor_data
MQ135.h
00001 /**************************************************************************/ 00002 /*! 00003 @file MQ135.h 00004 @author G.Krocker (Mad Frog Labs) 00005 @license GNU GPLv3 00006 00007 First version of an Arduino Library for the MQ135 gas sensor 00008 TODO: Review the correction factor calculation. This currently relies on 00009 the datasheet but the information there seems to be wrong. 00010 00011 @section HISTORY 00012 00013 v1.0 - First release 00014 */ 00015 /**************************************************************************/ 00016 #ifndef MQ135_H 00017 #include "mbed.h" 00018 00019 #define MQ135_H 00020 00021 /// The load resistance on the board 00022 #define RLOAD 10.0 00023 /// Calibration resistance at atmospheric CO2 level 00024 #define RZERO 76.63 00025 /// Parameters for calculating ppm of CO2 from sensor resistance 00026 #define PARA 116.6020682 00027 #define PARB 2.769034857 00028 00029 /// Parameters to model temperature and humidity dependence 00030 #define CORA 0.00035 00031 #define CORB 0.02718 00032 #define CORC 1.39538 00033 #define CORD 0.0018 00034 00035 /// Atmospheric CO2 level for calibration purposes 00036 #define ATMOCO2 397.13 00037 00038 class MQ135 { 00039 private: 00040 PinName _pin; 00041 00042 public: 00043 MQ135(PinName pin); 00044 ~MQ135(); 00045 float getCorrectionFactor(float t, float h); 00046 float getResistance(); 00047 float getCorrectedResistance(float t, float h); 00048 float getPPM(); 00049 float getCorrectedPPM(float t, float h); 00050 float getRZero(); 00051 float getCorrectedRZero(float t, float h); 00052 }; 00053 #endif
Generated on Tue Jul 12 2022 18:11:51 by
1.7.2