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:

Arduino Uno with DCG-H2S sensor. Schematic created with Fritzing.org


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:

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

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!





Name

Air quality,2,Arduino code library,2,Arduino projects,23,Buggy,1,Casual stuff,1,ESP8266,2,MikroElektronika,3,PIC projects,7,Review,26,Robots,1,Tutorial,20,
ltr
item
Electronza: H2S sensing revisited: using the sensor with Arduino Uno
H2S sensing revisited: using the sensor with Arduino Uno
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrEFtSDrtcIblwIynN-D3rC3m0H1gefOLv0ZhxVCpEHqzVoPokURkJigJa2MCGZpH0fP1EUgHN-XXzpO5DlXzlh-XSSj7AQQuyi8N4lycyjFBMClhXY4bf4rG0TvJz_YuULbbAFc6jFIVjJenpq1dnlAxcgznwNTvo9XtvQmd74RfYn18HcTnCvpq-/w640-h306/H2S-Arduino-Uno.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrEFtSDrtcIblwIynN-D3rC3m0H1gefOLv0ZhxVCpEHqzVoPokURkJigJa2MCGZpH0fP1EUgHN-XXzpO5DlXzlh-XSSj7AQQuyi8N4lycyjFBMClhXY4bf4rG0TvJz_YuULbbAFc6jFIVjJenpq1dnlAxcgznwNTvo9XtvQmd74RfYn18HcTnCvpq-/s72-w640-c-h306/H2S-Arduino-Uno.jpg
Electronza
https://www.electronza.com/2018/10/h2s-sensing-revisited-using-sensor-with.html
https://www.electronza.com/
https://www.electronza.com/
https://www.electronza.com/2018/10/h2s-sensing-revisited-using-sensor-with.html
true
4275662725798500575
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content