MQ137 Ammonia Gas Sensor Interfacing with Arduino

MQ137 Sensor belongs to the MQ series which detects different gasses present in the air. The MQ137 is an ammonia gas sensor which detects the presence of ammonia gas. As the concentration of N gas rises in the air, the conductivity of the sensor tends to become higher. Using a circuit, you can convert this change in conductivity to the output value which indicates the concentration of a gas. Along with ammonia gas, it can detect organic amines also.

MQ137 Pinout

This diagram shows the pinout of a sensor only. But we can use a complete sensor module also. Because module are also easily available in the market.

MQ137 Ammonia Gas Sensor pinout diagram

Pins Description

  • H pins are heater pins. Connect one H pin to Vcc and others to the ground.
  • Connect the two A pins with each other. We get analog output from these pins.
  • Connect the two B pins together and connect them to the ground through a resistor.
  • But both A and B are interchangeable, you can connect one with the ground and others can be used as an analog output pin.

You can interchange the connections between A and B pins but avoid interconnections between these two pins.


  • You can use it as both digital sensors and analog sensors.
  • This sensor operates in an analog voltage range of 0V to 5V. In the case of digital voltages, the output voltage is either 0 or 5V.
  • It has high sensitivity to ammonia and organic amines.
  • It provides a stable operation along with fast response.
  • You can change the digital pin sensitivity by connecting a potentiometer and varying its resistance.
  • It provides a feature of preheating duration over 24 hours.

Where to use MQ137?

This device is available in a sensor and module form. The module version of sensor can operate without a microcontroller also with the help of its digital pin. You can interface them directly with Arduino and any other microcontroller to detect gases like ammonia or carbon mono-oxide. You can measure the gas though the TTL based analog pin.

In conclusion, you can use the MQ137 sensor in the detection of gases like ammonia, carbon mono-oxide, and organic amines, etc. by interfacing this sensor with a microcontroller or you can use it even without a microcontroller. If you need the output in parts per million then use the sensor only.

How to use MQ137?

The MQ137 is an electrochemical sensor consisting of a built-in heater. The purpose of this heater is to maintain a certain temperature required for the operation of the sensor. The maintenance of temperature is very important as the sensor operates and detect the gasses present in the air only at a specific temperature.

Internal Circuit

MQ137 Ammonia Gas Sensor Internal Circuit

The H pins are heater pins and they provide a specific temperature for sensor working. Connect one pin to the ground and other to a voltage supply (VH) as shown in the figure above. Either apply power source of 5V DC supply at H pin or apply the PWM pulse of amplitudes in a range of 2V to 5V.

Connect two A pins and the two B pins together. Supply one with power supply and other to an analog pin. These two pins are interchangeable that’s why you can connect any one of them to a power source and other to an analog pin. For best performance, connect the analog pin to ground through a resistor RL. The RL value should lie in between 2kΩ to 47kΩ. The higher load resistance will provide high sensitivity.

This sensor gives the value in parts per million. To use this sensor, we need to find out the value of RO and calibrate the sensor. Then we will calculate the resistance of the sensor in gas concentration by the formula:

Rs= (RC/VRL-1) × RL

Rs/Ro Ratio Graph

The graph shown below gives the ratio of Rs/Ro. This ratio gives the concentration of a gas in parts per million.

Amonia gas sensor Response graph

MQ137 Sensor Module

This sensor is also available in module form which consists of four pins. Two of them are power supply pins for ground and a positive voltage source. The other two are analog and digital pin.

MQ137 sensor module pinout

MQ137 Interfacing with Arduino

You can directly interface this module with Arduino by connecting digital and analog pins in the Arduino board. The analog pin provides analog value indicating the concentration of gas in the air. Digital pin provides High or Low value by comparing gas concentration with a certain value. If it is higher than that limit, the digital pin will be HIGH or 5V otherwise LOW or 0V. A potentiometer is used to set this value.

MQ137 Interfacing with Arduino

Note: MQ137 has a preheating time of 24 hours which should be provided before using it to get accurate values.

Download Code

Other Gas Sensors


  • Domestic gas alarms for detecting ammonia gas
  • Ammonia gas leakage alarms in industries
  • Portable NH3 gas detector.

 2D Diagram

2D Diagram


MQ137 Sensor Datasheet

Leave a Comment