Hydrogen Sulfide sensing with Arduino Due


It’s almost two years since I was forced to relocate my office. The good thing is that now I work on in quiet location and I have to drive only 15 minutes from my home. Unfortunately, there’s a bad thing, too. During the hot summer days, a nasty smell originating from a garbage dump located some 3km away lingers in the air. It seems that the rotten egg smell is typical to hydrogen sulfide (H2S). I’m not the only one bothered by the smell; there were a lot of complaints this summer. The local environment authorities have performed some measurements and found that none of the values are above the legal limits. Still, there’s the smelly issue…

This article is more than two years old and might contain obsolete information; it is still kept here for informational purposes.

As hydrogen sulfide is bad for health, even in concentrations as small as ten parts per million, I wanted to build my monitoring station, to know exactly what’s in the air I breathe. Easier said than done!

The biggest issue was finding a reliable H2S sensor.


There’s the cheap MQ-136 H2S sensor, which goes below 30$. The problem is, that sensor has an analog output. As such, I have to read it with an ADC, and it’s extremely difficult to calibrate without access to specialized lab equipment.

The MQ-136 sensor is also sensitive to other gases, such as carbon monoxide, sulfur dioxide or methane. So, do I have a high level of hydrogen sulfide, or a high level of carbon monoxide, or what? It’s quite difficult to get an accurate reading from this sensor.

Second, there are dedicated H2S sensors, calibrated, reliable, but they cost a fortune. I’m not going to pay 2000$ for such a sensor, considering that it will go into a small project.

And then, recently, I stumbled upon the website of Spec Sensors, a company specialized manufacturing sensors for gas sensing application. What caught my attention is their line of digital gas sensors for IoT. Besides the hydrogen sulfide sensor I was looking for, one can find dedicated sensors for carbon monoxide, ozone, sulfur dioxide, nitrogen dioxide, breath alcohol, and other respiratory irritants. And the best thing is that, with a price tag of 75$, these sensors are quite cheap.

As a side note, I ordered mine from digikey.com, as I got zero transport cost. All I had to do is pay the VAT to the local customs office.

SPEC Digital H2S sensor

SPEC Digital H2S sensor

The DGS-H2S 968-036 digital hydrogen sulfide sensor comprises the sensor itself, the digital breakout board and one USB-UART adapter (not pictured here). I haven’t used the UAB-UART adapter at all; it could have been omitted from the package at all to save a few bucks.

SPEC hydrogen sulfide sensor

SPEC hydrogen sulfide sensor

The sensor itself doesn’t say much. From its datasheet I find that it’s an amperometric gas sensor, that is an electrochemical sensor which generates a current proportional to the volumetric fraction of the gas. More information can be found in the technical documents. The bottom line is, this sensor needs a complicated analog front-end, something difficult to design and build by the average maker.

And here comes into play the digital breakout.

SPEC Digital H2S Sensor - bottom view

SPEC Digital H2S Sensor – bottom view

SPEC Digital H2S Sensor - top viewSPEC Digital H2S Sensor - top view

SPEC Digital H2S Sensor – top view

The analog front end is implemented using one LMP91000, a programmable AFE potentiostat designed for use in use in micro-power electrochemical sensing applications. This little thing supports gas sensitivities over a range of 0.5 nA/ppm and up to 9500 nA/ppm. Communication with the microcontroller is done via I2C, plus one analog line for the sensor readings.

The microcontroller used is a PIC24F16KM202, featuring a 12-bit A/D converter with threshold detect, which takes care of all the computations and sends data to the host application via UART interface (3.3V logic levels).

There’s also one IC that looks to me like a Si7021-A20 I2C temperature and humidity sensor. On the top side, there’s an IC marked “SPH3” which I haven’t been able to identify.

Anyway, that’s not even important; all one has to know is the communication protocol.

1 2


    • Teodor Costachioiu
      Teodor Costachioiu on

      The sensor is 3.3V only, so it will require some level translators to work with the Arduino Uno.
      The communication protocol is serial, but Arduino Uno has a single serial port. So, if you wish to do serial debugging or to send data to PC, then you will have to use software serial.
      I will try next week to post some images regarding the connections, and maybe a code example for the Arduino Uno, but it will take me a few days to do this.

    • Teodor Costachioiu
      Teodor Costachioiu on

      The analog version requires some extensive computations, especially when speaking on temperature and humidity compensation. The digital version does all this internally, and its easier to use.

  1. Avatar


    What PPB readings are you getting for “clean” air? I’m getting around 250 or so, even after running for several hours.

    • Teodor Costachioiu
      Teodor Costachioiu on

      It will detect H2S, even in very low amounts. However, this won’t be an accurate indicator of “smelliness”, as there are other gases that contribute to the overall odor.

        • Teodor Costachioiu
          Teodor Costachioiu on

          Hi Thomas,

          The cheaper alternative is MQ136 sensor. Also MQ137 might be interesting to detect ammonia. See https://playground.arduino.cc/Main/MQGasSensors for more info on MQ sensors.

          Please note that MQ series sensors are analog. Their output needs to be applied on a pin with A/D function, like A0-A5.

          Also, they are not calibrated. Their output is just proportional with the amount of gas in the air, but you won’t be able to tell exactly how much of the nasty gas is present.

    • Electronza

      Try to run the sensor for about one hour. It takes some time for the output to stabilize after the sensor is powered on.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.