Skip to main content

Quick Start

Connect the breakout over Qwiic, install the library, and run an example that prints a gas concentration in PPM every 2.5 seconds. Step 3 shows how to set it up for this board's H2S cell. The board answers at I2C address 0x30 out of the box.

You program the controller connected to this breakout. The breakout itself is not flashed.

1. Connect the breakout board​

Plug a Qwiic cable into either Qwiic connector on the breakout and into the Qwiic connector on your controller. Both connectors carry the same I2C bus and the same 3.3 V supply.

NULA DeepSleepSoldered Electrochemical H2S Gas Sensor Breakout (Qwiic)
Qwiic connectorQwiic connector
Wiring diagram: the NULA DeepSleep connected to the Soldered Electrochemical H2S Gas Sensor Breakout (Qwiic) with a Qwiic cable

Without Qwiic: breadboard wiring​

Use the top header row instead. Power the board from 3.3 V only: it has no regulator.

NULA DeepSleepSoldered Electrochemical H2S Gas Sensor Breakout (Qwiic)
GNDGND
3V33V3
IO8SDA1
IO9SCL1
Wiring diagram: the NULA DeepSleep connected to the Soldered Electrochemical H2S Gas Sensor Breakout (Qwiic): GND to GND, 3V3 to 3V3, IO8 to SDA1, IO9 to SCL1

2. Install the library​

Install Electrochemical Gas Sensor Soldered from its GitHub repository.

🔗Electrochemical Gas Sensor Soldered

Verified Arduino library at commit c4df54b

→

Tip: downloading from GitHub. On the library's GitHub page, click the green Code button and choose Download ZIP, then add it in Arduino IDE with Sketch → Include Library → Add .ZIP Library....

3. Run the first example​

This is the library's bridgeBoard example, which talks to the board at 0x30. It is written with SENSOR_CO, the library's carbon monoxide preset, so its PPM values are not H2S values.

Do not switch it to the library's SENSOR_H2S preset unchanged. That preset is written for the SGX-4H2S-100 cell, with a sensitivity of 1200 nA per ppm. This board carries the SGX-4H2S-300 cell, whose datasheet gives an output signal of 460 ± 140 nA per ppm, so with SENSOR_H2S the reading comes out about 2.6 times too low.

Instead, give the library a custom sensor type: the SENSOR_H2S settings with the SGX-4H2S-300's sensitivity, 460 nA per ppm. Add it above the line that creates sensor, and pass it in place of SENSOR_CO:

const sensorType SENSOR_CUSTOM = {
460.0F, // nanoAmperesPerPPM
0, // internalZeroCalibration
ADS_GAIN_4_096V, // adsGain
TIA_GAIN_7_KOHM, // TIA_GAIN_IN_KOHMS
RLOAD_10_OHM, // RLOAD
REF_EXTERNAL, // REF_SOURCE
INTERNAL_ZERO_20_PERCENT, // INTERNAL_ZERO
BIAS_SIGN_POSITIVE, // BIAS_SIGN
BIAS_0_PERCENT, // BIAS
FET_SHORT_DISABLED, // FET_SHORT
OP_MODE_3LEAD_AMP_CELL, // OP_MODE
};

ElectrochemicalGasSensor sensor(SENSOR_CUSTOM, 0x30);

The unchanged example follows.

Select Board
bridgeBoard.ino
// Include the required library
#include "Electrochemical-Gas-Sensor-SOLDERED.h"

ElectrochemicalGasSensor sensor(SENSOR_CO, 0x30);

void setup()
{
Serial.begin(115200); // For debugging

// Init the breakout
if (!sensor.begin())
{
// Can't init? Notify the user and go to infinite loop
Serial.println("ERROR: Can't init the sensor! Check connections and jumper address!");
while (true)
delay(100);
}

Serial.println("Sensor initialized successfully!");
}

void loop()
{
// Make the reading
double reading = sensor.getPPM();

// If PPB is more relevant for your sensor, you can use:
// double reading = sensor.getPPB();

// Print the reading with 5 digits of precision
Serial.print("Sensor reading: ");
Serial.print(reading, 5);
Serial.println(" PPM");

// Wait a bit before reading again
delay(2500);
}

Open the complete example

4. Check the result​

Open the Serial Monitor at 115200 baud. When the board answers, you see:

Serial MonitorAutoscrollShow timestampNewline115200 baud
Message (Enter to send message to the board)
Sensor initialized successfully!
Sensor reading: 0.00217 PPM
Sensor reading: 0.00213 PPM
Sensor reading: 0.00216 PPM
Sensor reading: 0.00220 PPM

A new Sensor reading: line follows every 2.5 seconds, with the concentration in PPM to five decimals. The values above are an example from one board on our bench; yours depend on the gas around the sensor and on the sensor type your sketch uses. The library never reports a value below zero: it returns 0 instead, so 0.00000 is a normal reading.

If you see ERROR: Can't init the sensor! Check connections and jumper address! instead, the board did not answer at 0x30.

5. If it does not work​

Continue with Troubleshooting and retry this smallest example after each change.