Fc-22 Gas sensor Arduino: Difference between revisions
From wikiluntti
Line 2: | Line 2: | ||
MQ-2, Mq2, mq22, mq-22. | MQ-2, Mq2, mq22, mq-22. | ||
Datasheet | |||
* MQ-3 https://www.sparkfun.com/datasheets/Sensors/MQ-3.pdf | |||
== Theory == | == Theory == |
Revision as of 16:28, 3 December 2024
Introduction
MQ-2, Mq2, mq22, mq-22.
Datasheet
Theory
Connect Vcc, GND and Analog Output to Arduino Analog A0 pin (see https://www.instructables.com/How-to-use-MQ2-Gas-Sensor-Arduino-Tutorial/). Also, there is Digital Output.
#include "MQ135.h"
MQ135 gasSensor = MQ135(A5);
int ppm = gasSensor.getPPM();
void setup() {
Serial.begin(9600);
}
void loop() {
float rzero = gasSensor.getRZero(); #Calibaration. Actually it takes ~24h time.
float ppm = gasSensor.getPPM();
Serial.println(ppm);
delay(1000);
}
See https://github.com/Ravenneo/CO2-sensor
Calibration https://hackaday.io/project/3475-sniffing-trinket/log/12363-mq135-arduino-library