Fc-22 Gas sensor Arduino: Difference between revisions
From wikiluntti
(Created page with "== Introduction == == Theory == <syntaxhighlight lang="C"> </syntaxhighlight > == Exercises == == Code 1 == <syntaxhighlight lang="C"> </syntaxhighlight > == Code 2 == <syntaxhighlight lang="C"> </syntaxhighlight > == Code 3 == <syntaxhighlight lang="C"> </syntaxhighlight >") |
(→Theory) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
MQ-2 | |||
== Theory == | == 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. | |||
<syntaxhighlight lang="C"> | <syntaxhighlight lang="C"> | ||
#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); | |||
} | |||
</syntaxhighlight > | </syntaxhighlight > | ||
See https://github.com/Ravenneo/CO2-sensor | |||
Calibration https://hackaday.io/project/3475-sniffing-trinket/log/12363-mq135-arduino-library | |||
== Exercises == | == Exercises == |
Latest revision as of 18:06, 18 November 2024
Introduction
MQ-2
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