Cảm biến khí dễ cháy MQ-9 được dùng trong cá hệ thống phát hiện rò rỉ khí gas trong gia đình và công ngiệp.
Cảm biến MQ-9 (Gas sensor) đo khí CO chuyển thành điện áp đưa ra chân AOUT.
Biến trở trên Module có chức năng điều chỉnh điện áp tham chiếu (ngưỡng), khi cảm biến MQ-9 phát hiện khí CO đến ngưỡng thì chân DOUT sẽ đảo trạng thái.
Thông số kỹ thuật:
- Nguồn nuôi: 2.5V – 5V
- Kích thước: 40 x 21mm
- Tích hợp led báo
- Tích hợp biến trở điều chỉnh độ nhạy
Sơ đồ chân:
Code tham khảo Arduino:
const int LED = 2;
const int DO = 8;
void setup() {
Serial.begin(9600);
pinMode(LED, OUTPUT);
pinMode(DO, INPUT);
}
void loop() {
int alarm = 0;
float sensor_volt;
float RS_gas;
float ratio;
//-Replace the name "R0" with the value of R0 in the demo of First Test -/
float R0 = 0.91;
int sensorValue = analogRead(A0);
sensor_volt = ((float)sensorValue / 1024) * 5.0;
RS_gas = (5.0 - sensor_volt) / sensor_volt; // Depend on RL on yor module
ratio = RS_gas / R0; // ratio = RS/R0
Serial.print("sensor_volt = ");
Serial.println(sensor_volt);
Serial.print("RS_ratio = ");
Serial.println(RS_gas);
Serial.print("Rs/R0 = ");
Serial.println(ratio);
Serial.print("\n\n");
alarm = digitalRead(DO);
if (alarm == 1) digitalWrite(LED, HIGH);
else if (alarm == 0) digitalWrite(LED, LOW);
delay(1000);
}
Tài liệu tham khảo:
Video tham khảo: