Skip to main content

Quick Start

Plug the breakout into your controller with a Qwiic cable, install the library, and run its first example. The example ships with another gas's preset, so step 3 says which name to change to read ammonia in ppm. The board answers on I2C address 0x30 until you move its ADDRESS switch.

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

1. Connect the breakout board​

Qwiic means no soldering: plug one end of a Qwiic cable into your controller and the other into either Qwiic connector on the breakout. The cable carries 3.3 V, GND and the I2C lines.

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

The board runs from 3.3 V only and has no regulator. The header and both Qwiic connectors share that one 3.3 V supply, so never feed it 5 V.

Without Qwiic: jumper-wire wiring​

The board is not breadboard compatible, so connect it with jumper wires to the header pins. Wire the header's SDA1/SCL1 pair, the same bus the Qwiic connectors carry, to your controller's I2C pins. Leave SDA2/SCL2 unconnected: that pair is the board's own bus between the ATtiny404, the analog front end and the ADC.

NULA DeepSleepSoldered Electrochemical NH3 Gas Sensor Breakout (Qwiic)
GNDGND
3V33V3
IO8SDA1
IO9SCL1
Wiring diagram: the NULA DeepSleep connected to the Soldered Electrochemical NH3 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. The ZIP holds the library as its main branch is today, not a fixed commit. These pages were checked against commit c4df54b, which the link below opens.

🔗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, written for this board's ATtiny404 bridge. It creates the sensor on address 0x30, starts it, and prints a reading every 2.5 seconds. If you moved the ADDRESS switch, the board answers on that address (0x30 to 0x37) instead.

The example creates the sensor with SENSOR_CO, the library's carbon monoxide preset. SENSOR_NH3 is the library's preset for the SGX-4NH3 cell on this board, and the ppm conversion uses the preset's sensitivity: 70 nA/ppm for SENSOR_CO, 40 nA/ppm for SENSOR_NH3. As shipped, the example's readings are therefore not ammonia ppm. To read ammonia, change SENSOR_CO to SENSOR_NH3 in the line that creates the sensor.

The example's comments say to set the address with jumpers on the back of the board. On this board the address is set with the three-position ADDRESS switch. The 0x49/0x4A/0x4B the comments mention are ADS1115 addresses, not addresses this board answers on. Where the comments say LMPEN is hardwired to GND, on this board a 10 kΩ resistor pulls it to GND: leave it unconnected.

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​

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!

After that, a line starting with Sensor reading: follows every 2.5 seconds, with the concentration in ppm to five decimals. The library never reports a negative concentration: a result 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 on the address in the sketch.

5. If it does not work​

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