Wish List 0

Mh-Z14A C02 Sensor Module

Rs. 2,301.00 Rs. 2,624.00

  • MH-Z14A Infrared Carbon Dioxide Sensor module
  • MH-Z14A Infrared CO2 gas sensor module is very easy to use sensor module. This module provides output in PWM, UART as well as analog voltage thus it can be interfaced to your Microcontroller in various ways.
  • MH-Z14A NDIR Infrared gas module is a common type, small size sensor, using non-dispersive infrared NDIR principle to detect the existence of CO2 in the air, with good selectivity, non-oxygen dependent, long life.
  • Built-in temperature sensor can do temperature compensation; and it has digital output and analog voltage output.
  • MH-Z14A NDIR Infrared gas module is applied in the HVAC, indoor air quality monitoring, industrial process, safety and protection monitoring, agriculture and animal husbandry production process monitoring.

SPECIFICATION
working voltage   DC4-6V
The working current   50mA average | - peak 100mA
The detection range   0-5000ppm
Detection accuracy   ± 50ppm
Preheating time   180S
Analog output voltage   0.4-2V (linear output)
Digital output   serial data output (9600, N, 8,1)
Response time   ≤ 30S
Working temperature   0 ~ 60 ℃
Working humidity   0 ~ 90% RH
Storage temperature   -20 ~ 60 ℃
The service life   5 years
OVERVIEW
working voltage   DC4-6V
The working current   50mA average | - peak 100mA
The detection range   0-5000ppm
Detection accuracy   ± 50ppm
Preheating time   180S
Analog output voltage   0.4-2V (linear output)
Digital output   serial data output (9600, N, 8,1)
Response time   ≤ 30S
Working temperature   0 ~ 60 ℃
Working humidity   0 ~ 90% RH
Storage temperature   -20 ~ 60 ℃
The service life   5 years

PACKAGE INCLUDES:

1 PCS x Mh-Z14A C02 Sensor Module



#include <ESP8266WiFi.h>

#include <WiFiClient.h>

#include <ESP8266WebServer.h>

#include <ESP8266mDNS.h>

#include <time.h>


const char* ssid = "co2_sensor";

const char* password = "1qazxsw2";


ESP8266WebServer server(80);


const int led = BUILTIN_LED;

int getCO2();


int pwm_co2 = 0;


void pwm_in_interrupt() {

  static int t_last = 0;

  int t = micros();

  if (digitalRead(D5) == 0) {

    pwm_co2 = (t - t_last - 2) * 4 / 1000;

  }

  t_last = t;

}


void setup(void) {

  WiFi.mode(WIFI_AP);

  pinMode(led, OUTPUT);

  digitalWrite(led, 0);

  Serial.begin(9600);

  Serial.swap();

  WiFi.softAP(ssid, password);

  attachInterrupt(D5, pwm_in_interrupt, CHANGE);


//  // Wait for connection

//  while (WiFi.status() != WL_CONNECTED) {

//    digitalWrite(led, 1);

//    delay(400);

//    digitalWrite(led, 0);

//    delay(100);

//  }


//  if (MDNS.begin("esp8266-mh-z14")) {

//    MDNS.addService("http", "tcp", 80);

//  }


//  configTime(3600 * 3, 0, "pool.ntp.org");


  server.on("/", []() {

    digitalWrite(led, 0);

    int co2 = getCO2();

//    time_t ts;

//    time(&ts);

    int ts = millis();

    String response = String("{\"co2\":") + co2 + ", \"pwm_co2\":" + pwm_co2 + ", \"time\":" + ts + "}\n";

    server.send(200, "text/json", response);

    digitalWrite(led, 1);

  });

  server.begin();

  delay(5000);

  digitalWrite(led, 1);

}


void loop(void) {

  server.handleClient();

}


const uint8_t cmd[9] = {0xFF,0x01,0x86,0x00,0x00,0x00,0x00,0x00,0x79};

int getCO2() {

  uint8_t response[9];

  Serial.write(cmd, 9);

  if (Serial.readBytes(response, 9) == 9) {

    int responseHigh = (int) response[2];

    int responseLow = (int) response[3];

    int ppm = (256 * responseHigh) + responseLow;

    return ppm;

  }

  return -1;

}

https://www.youtube.com/watch?v=Vk4oQpy98sc&feature=emb_logo

15 days 

Write a review

Please login or register to review