Skip to main content

Quick Start

Plug the breakout into your controller with a Qwiic cable, install the library and read the SO2 concentration in ppm. The board answers at I2C address 0x30 as shipped.

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

The board runs from 3.3 V only. It has no regulator, so the headers and both Qwiic connectors share one 3.3 V supply.

1. Connect the breakout board​

Plug a Qwiic cable into your controller's Qwiic connector and into either Qwiic connector on the breakout. The cable carries 3.3 V, GND and I2C.

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

Without Qwiic: breadboard wiring​

Solder the included header pins and wire the four pins of the top header that carry the main I2C bus. Use the SDA1 and SCL1 pins, not SDA2 and SCL2.

NULA DeepSleepSoldered Electrochemical SO2 Gas Sensor Breakout (Qwiic)
GNDGND
3V33V3
IO8SDA1
IO9SCL1
Wiring diagram: the NULA DeepSleep connected to the Soldered Electrochemical SO2 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 as a ZIP library.

🔗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 breakout at address 0x30. The library picks how to talk to the board from that address: 0x30 to 0x37 is this board's on-board microcontroller.

  1. Copy the sketch into the Arduino IDE.
  2. Change SENSOR_CO to SENSOR_SO2 in the line that creates sensor. SENSOR_SO2 is the library's preset for the SGX-4SO2 cell on this board.
  3. Upload it and open the Serial Monitor at 115200 baud.

The listing is the library's file at the pinned commit, apart from a few comment-only lines, which name the connector by an older name or link to other Soldered products, and are left out. Where its comments say to set the address with jumpers, on this board the address is set by the ADDRESS switch (0x30 as shipped), and the address jumpers JP2 to JP4 stay as shipped. Where they say LMPEN is hardwired to GND, on this board LMPEN is pulled to GND by a 10 kΩ resistor and also runs to the on-board microcontroller (see Hardware Details).

Select Board
bridgeBoard.ino
/**
**************************************************
*
* @file bridgeBoard.ino
* @brief See how to init a sensor on the new ATtiny404 bridge board revision,
*
* To successfully run the sketch:
* - Set the desired address using the jumpers on the back of the board
* (address = 0x30 + jumper offset, giving a range of 0x30-0x37)
* - Run the sketch and open serial monitor at 115200 baud!
*
* Note: on this board revision, LMPEN is hardwired to GND, so there's
* no configPin argument to pass - the constructor's third argument
* is ignored whenever the address falls in the bridge range (0x30-0x37).
*
*
* @authors @ soldered.com
***************************************************/

// Include the required library
#include "Electrochemical-Gas-Sensor-SOLDERED.h"

// Any additional boards on the same bus just need a different jumper setting
// (0x30-0x37), same as twoSensors.ino does for legacy boards with 0x49/0x4A/0x4B.
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);
}

4. Check the result​

The Serial Monitor first confirms that the board answered. After that, a new Sensor reading: line follows every 2.5 seconds, with the SO2 concentration in ppm to five decimal places. A run in clean air looked like this:

Serial MonitorAutoscrollShow timestampNewline115200 baud
Message (Enter to send message to the board)
Sensor initialized successfully!
Sensor reading: 0.00282 PPM
Sensor reading: 0.00315 PPM
Sensor reading: 0.00292 PPM
Sensor reading: 0.00290 PPM

The library never reports a negative value: anything below zero is printed as 0.

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.