H2S sensing revisited: using the sensor with Arduino Uno


Ever since I wrote the blog post on sensing hydrogen sulfide using Arduino Due, I have received a lot of comments and messages about using the sensor with the more popular Arduino Uno.

To use the sensor with the Arduino Uno, one must overcome two issues. The first issue relates to the fact that the sensor uses 3.3V logic and power, while the Arduino Uno is a 5V board. The second issue lies in the fact that Arduino Uno has a single serial port, and that post is commonly used for debugging.

Overcoming these two issues is relatively easy.

To solve the logic level issue, one can take 3.3V power from the Arduino Uno and use a logic level converter like BOB-12009 from Sparkfun.

Then, one can rely on using SoftwareSerial to create a emulate a second serial port in software, and make some minor changes in the code to accommodate this. Please note that SoftwareSerial doesn’t work on all Arduino pins. In my code example I used pins 10 and 11, but if you wish to change that, do read first the documentation and make sure the pins are supported by the code library.

For this example, I have connected the H2S sensor as follows:

Connecting the H2S sensor to Arduino Uno

Connecting the H2S sensor to Arduino Uno

The logic level converter receives 5V (orange wire) and 3.3V (red wire) from Arduino Uno. The 3.3V voltage also goes to pin 8 of the H2S sensor.

GND (blue wire) runs from Arduino Uno to the logic level converter and then to the H2S sensor.

Pin 11 runs to the HV4 pin of the logic level converter. Its counterpart LV4 is connected to pin 2 (RXD) of the H2S sensor. Later, in the code, this pin will become SoftwareSerial TX.

Pin 10 runs to the HV3 pin of the logic level converter. Its counterpart LV3 is connected to pin 3 (TXD) of the H2S sensor. Later, in the code, this pin will become SoftwareSerial RX.

This is how the connections are made on a breadbaord. I used the same colors of wire as in the above diagram, to make things easier to follow:

Arduino Uno connections to H2S sensor

Arduino Uno connections to H2S sensor

If you don’t want to dig into the datahsheet of the sensor, here is a detailed image of the H2S sensor connector:

H2S sensor pinout

H2S sensor pinout

From top to bottom we have:

pin 1 – N/C
pin 2 – RXD
pin 3 – TXD
pin 4 – N/C
pin 5 – N/C
pin 6 – GND
pin 7 – N/C
pin 8 – V+ (2.6 to 3.6V)

H2S sensing with Arduino Uno: the code

The code is the same as in the original blog post, with only minor changes to accommodate SoftwareSerial:

That’s all folks!



  1. What is going on in your physical wiring with both the 5V and 3.3V pins from the Arduino going to the same outer rail track, and the red wire on the inner rail track connecting to the same inter rail? I’m throughly confused.

    • Teodor Costachioiu on

      5v goes to outer rail
      3.3v goes to inner rail (the angle of the wire is a bit misleading)
      on breadboards from wishay the rails are split in half, tbat’s why the short red wire connecting the inner rails

      • So the 3.3v pin from the Arduino is going to the inner track? Now that makes sense.

        If one were to use a nodencu or similar ESP8266 3.3V device, there would be no need to use a logic level converter, right? And if it has WiFi you wouldn’t have to bother with even using SoftwareSerial as you could use MQTT or webhooks to display your output.

  2. For anyone wondering, the reason you need to use this logic converter is because the RX/TX pins work on 5v, which will fry your sensor. It’s probably easier to just get a 3.3v controller and use that.

Leave A Reply

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