Skip to content

Quick Start Guide

Quick Start Guide - Thumbnail


In this guide we'll cover how to utilize the Qwiic 5V Boost with two 5V I2C devices; such as the BlinkM LED and Sensirion SEN55 sensor. To follow along with this tutorial, users will need the following items:

Warning

Soldering is required for this board.

Board Layout

This is the basic layout of the Qwiic 5V Boost board.

Layout

Layout of the major components on the Qwiic 5V Boost.

Demo - BlinkM LED

In this demo, we'll connect a BlinkM RGB LED to the Qwiic 5V Boost board; and control it with an ESP32 Thing Plus development board, utilizing the Arduino IDE.

Connect the BlinkM LED

Soldering is required to connect the BlinkM LED to the Qwiic 5V Boost board. In the example below, we used headers and jumper wires to make the necessary pin connections shown in the table. Once the BlinkM LED is attached, users will need to connect the Qwiic 5V Boost board to their development board with a Qwiic cable.

Qwiic 5V Boost BlinkM RGB LED
GND -
5V +
SDA d
SCL c

Demo - BlinkM LED

Connecting the BlinkM LED to the Qwiic 5V Boost.

Tip

If you're not familiar with using breakout board or soldering, please refer to the Hardware Overview & Assembly sections for a detailed overview of the board along with instructions on soldering to the breakout.

Example Code

With the hardware assembled, users will need to program their development board to control the BlinkM LED. In the Arduino IDE, upload the BlinkMStart example sketch from the BlinkM Arduino library. This example will fade the hue of the BlinkM LED and output the hue values to the Serial Monitor.

Follow the steps below to upload the example code:

  • Open the Arduino IDE.
  • Manually install the BlinkM Arduino library, by downloading it from the GitHub repository.
  • Restart the Arduino IDE.
  • Open BlinkMStart example sketch from the BlinkM Arduino library.
  • Select your board and serial port; then, upload the sketch.
  • Once the code compiles and uploads to the development board, open the serial monitor with the baud rate set to 9600 bps.
  • The example sketch prints out the hue values as they change on the BlinkM LED.
Tip

If you're not familiar with using the Arduino IDE, refer to the Troubleshooting Tips section for related tutorials.

LED Not Changing

For users who find it hard to distinguish the changes in the LED's hue, the sketch can be modified to change the RGB values. Below, is an example of modifications that would change the red value of the RGB LED.

Modifications

byte red=0;
void loop() 
{
    red += 10; // random(0,255);
    Serial.print("Fading to hue ");
    Serial.println(red);

    blinkm.fadeToRGB( red, 255, 255);

    delay(500);
}

Source Files

  • BlinkM Arduino library
  • BlinkMStart.ino example sketch

    BlinkMStart.ino
    /*
     * BlinkMStart -- simplest BlinkM example.
     *   Change the hue of the BlinkM
     * 
     */
    
    #include "BlinkM.h"
    #include "Wire.h"
    
    
    int ledPin = 13;      // select the pin for the LED
    
    int blinkm_addr = 0;  // 0 = talk to all blinkms on the i2c bus
    
    byte hue=0;
    
    BlinkM blinkm = BlinkM( blinkm_addr );
    
    //
    void setup() 
    {
      delay(1000);
      pinMode(ledPin, OUTPUT);
    
      blinkm.powerUp();  // use analog pins A3,A2 as power pins (works for Uno)
    
      blinkm.begin();
      blinkm.off();     // stop script and go to black
    
      delay(1000);
      Serial.begin(9600);
      Serial.println("BlinkStart ready");
    }
    
    //
    void loop() 
    {
        hue += 10; // random(0,255);
        Serial.print("Fading to hue ");
        Serial.println(hue);
    
        blinkm.fadeToHSB( hue, 255, 255);
    
        delay(500);
    }
    

Demo - SEN55 Particle Sensor

In this demo, we'll connect the Sensirion SEN55 particulate matter, VOC, NOx, humidity, and temperature sensor to the Qwiic 5V Boost board; and read data from it with an ESP32 Thing Plus development board, utilizing the Arduino IDE.

Connect the Sensirion SEN55 Sensor

Soldering is required to connect the SEN55 sensor to the Qwiic 5V Boost board. In the example below, we used headers and a Qwiic jumper cable to make the necessary pin connections shown in the tables.

Qwiic 5V Boost Sensirion SEN55 Sensor
GND 2
5V 1
SDA 3
SCL 4
GND 5

SEN55 sensor pins

Hardware pins for the Sensirion SEN55 sensor.

Once the sensor is attached, users will need to connect the Qwiic 5V Boost board to their development board with a Qwiic cable.

Demo - SEN55 sensor

Connecting the Sensirion SEN55 sensor to the Qwiic 5V Boost.

Tip

If you're not familiar with using breakout board or soldering, please refer to the Hardware Overview & Assembly sections for a detailed overview of the board along with instructions on soldering to the breakout.

Example Code

With the hardware assembled, users will need to program their development board to retrieve data from the SEN5X sensor. In the Arduino IDE, upload the exampleUsage example sketch from the Sensirion I2C SEN5X Arduino library. This example will read the particulate matter, VOC, NOx, humidity, and temperature values from the SEN5X sensor and output them in the Serial Monitor.

Follow the steps below to upload the example code:

  • Open the Arduino IDE.
  • Open the Library Manager tool, search for the Sensirion I2C SEN5X Arduino library and install the latest version.
  • Open exampleUsage example sketch from the Sensirion I2C SEN5X Arduino library.
  • Select your board and serial port; then, upload the sketch.
  • Once the code compiles and uploads to the development board, open the serial monitor with the baud rate set to 115200 bps.
  • The example sketch prints out the particulate matter, VOC, NOx, humidity, and temperature values from the SEN55 sensor.
Tip

If you're not familiar with using the Arduino IDE, refer to the Troubleshooting Tips section for related tutorials.

Source Files

  • Sensirion SEN5X Arduino library
  • exampleUsage.ino example sketch

    exampleUsage.ino
    /*
     * I2C-Generator: 0.3.0
     * Yaml Version: 2.1.3
     * Template Version: 0.7.0-112-g190ecaa
     */
    /*
     * Copyright (c) 2021, Sensirion AG
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions are met:
     *
     * * Redistributions of source code must retain the above copyright notice, this
     *   list of conditions and the following disclaimer.
     *
     * * Redistributions in binary form must reproduce the above copyright notice,
     *   this list of conditions and the following disclaimer in the documentation
     *   and/or other materials provided with the distribution.
     *
     * * Neither the name of Sensirion AG nor the names of its
     *   contributors may be used to endorse or promote products derived from
     *   this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     * POSSIBILITY OF SUCH DAMAGE.
     */
    
    #include <Arduino.h>
    #include <SensirionI2CSen5x.h>
    #include <Wire.h>
    
    // The used commands use up to 48 bytes. On some Arduino's the default buffer
    // space is not large enough
    #define MAXBUF_REQUIREMENT 48
    
    #if (defined(I2C_BUFFER_LENGTH) &&                 \
         (I2C_BUFFER_LENGTH >= MAXBUF_REQUIREMENT)) || \
        (defined(BUFFER_LENGTH) && BUFFER_LENGTH >= MAXBUF_REQUIREMENT)
    #define USE_PRODUCT_INFO
    #endif
    
    SensirionI2CSen5x sen5x;
    
    void printModuleVersions() {
        uint16_t error;
        char errorMessage[256];
    
        unsigned char productName[32];
        uint8_t productNameSize = 32;
    
        error = sen5x.getProductName(productName, productNameSize);
    
        if (error) {
            Serial.print("Error trying to execute getProductName(): ");
            errorToString(error, errorMessage, 256);
            Serial.println(errorMessage);
        } else {
            Serial.print("ProductName:");
            Serial.println((char*)productName);
        }
    
        uint8_t firmwareMajor;
        uint8_t firmwareMinor;
        bool firmwareDebug;
        uint8_t hardwareMajor;
        uint8_t hardwareMinor;
        uint8_t protocolMajor;
        uint8_t protocolMinor;
    
        error = sen5x.getVersion(firmwareMajor, firmwareMinor, firmwareDebug,
                                 hardwareMajor, hardwareMinor, protocolMajor,
                                 protocolMinor);
        if (error) {
            Serial.print("Error trying to execute getVersion(): ");
            errorToString(error, errorMessage, 256);
            Serial.println(errorMessage);
        } else {
            Serial.print("Firmware: ");
            Serial.print(firmwareMajor);
            Serial.print(".");
            Serial.print(firmwareMinor);
            Serial.print(", ");
    
            Serial.print("Hardware: ");
            Serial.print(hardwareMajor);
            Serial.print(".");
            Serial.println(hardwareMinor);
        }
    }
    
    void printSerialNumber() {
        uint16_t error;
        char errorMessage[256];
        unsigned char serialNumber[32];
        uint8_t serialNumberSize = 32;
    
        error = sen5x.getSerialNumber(serialNumber, serialNumberSize);
        if (error) {
            Serial.print("Error trying to execute getSerialNumber(): ");
            errorToString(error, errorMessage, 256);
            Serial.println(errorMessage);
        } else {
            Serial.print("SerialNumber:");
            Serial.println((char*)serialNumber);
        }
    }
    
    void setup() {
    
        Serial.begin(115200);
        while (!Serial) {
            delay(100);
        }
    
        Wire.begin();
    
        sen5x.begin(Wire);
    
        uint16_t error;
        char errorMessage[256];
        error = sen5x.deviceReset();
        if (error) {
            Serial.print("Error trying to execute deviceReset(): ");
            errorToString(error, errorMessage, 256);
            Serial.println(errorMessage);
        }
    
    // Print SEN55 module information if i2c buffers are large enough
    #ifdef USE_PRODUCT_INFO
        printSerialNumber();
        printModuleVersions();
    #endif
    
        // set a temperature offset in degrees celsius
        // Note: supported by SEN54 and SEN55 sensors
        // By default, the temperature and humidity outputs from the sensor
        // are compensated for the modules self-heating. If the module is
        // designed into a device, the temperature compensation might need
        // to be adapted to incorporate the change in thermal coupling and
        // self-heating of other device components.
        //
        // A guide to achieve optimal performance, including references
        // to mechanical design-in examples can be found in the app note
        // “SEN5x – Temperature Compensation Instruction” at www.sensirion.com.
        // Please refer to those application notes for further information
        // on the advanced compensation settings used
        // in `setTemperatureOffsetParameters`, `setWarmStartParameter` and
        // `setRhtAccelerationMode`.
        //
        // Adjust tempOffset to account for additional temperature offsets
        // exceeding the SEN module's self heating.
        float tempOffset = 0.0;
        error = sen5x.setTemperatureOffsetSimple(tempOffset);
        if (error) {
            Serial.print("Error trying to execute setTemperatureOffsetSimple(): ");
            errorToString(error, errorMessage, 256);
            Serial.println(errorMessage);
        } else {
            Serial.print("Temperature Offset set to ");
            Serial.print(tempOffset);
            Serial.println(" deg. Celsius (SEN54/SEN55 only");
        }
    
        // Start Measurement
        error = sen5x.startMeasurement();
        if (error) {
            Serial.print("Error trying to execute startMeasurement(): ");
            errorToString(error, errorMessage, 256);
            Serial.println(errorMessage);
        }
    }
    
    void loop() {
        uint16_t error;
        char errorMessage[256];
    
        delay(1000);
    
        // Read Measurement
        float massConcentrationPm1p0;
        float massConcentrationPm2p5;
        float massConcentrationPm4p0;
        float massConcentrationPm10p0;
        float ambientHumidity;
        float ambientTemperature;
        float vocIndex;
        float noxIndex;
    
        error = sen5x.readMeasuredValues(
            massConcentrationPm1p0, massConcentrationPm2p5, massConcentrationPm4p0,
            massConcentrationPm10p0, ambientHumidity, ambientTemperature, vocIndex,
            noxIndex);
    
        if (error) {
            Serial.print("Error trying to execute readMeasuredValues(): ");
            errorToString(error, errorMessage, 256);
            Serial.println(errorMessage);
        } else {
            Serial.print("MassConcentrationPm1p0:");
            Serial.print(massConcentrationPm1p0);
            Serial.print("\t");
            Serial.print("MassConcentrationPm2p5:");
            Serial.print(massConcentrationPm2p5);
            Serial.print("\t");
            Serial.print("MassConcentrationPm4p0:");
            Serial.print(massConcentrationPm4p0);
            Serial.print("\t");
            Serial.print("MassConcentrationPm10p0:");
            Serial.print(massConcentrationPm10p0);
            Serial.print("\t");
            Serial.print("AmbientHumidity:");
            if (isnan(ambientHumidity)) {
                Serial.print("n/a");
            } else {
                Serial.print(ambientHumidity);
            }
            Serial.print("\t");
            Serial.print("AmbientTemperature:");
            if (isnan(ambientTemperature)) {
                Serial.print("n/a");
            } else {
                Serial.print(ambientTemperature);
            }
            Serial.print("\t");
            Serial.print("VocIndex:");
            if (isnan(vocIndex)) {
                Serial.print("n/a");
            } else {
                Serial.print(vocIndex);
            }
            Serial.print("\t");
            Serial.print("NoxIndex:");
            if (isnan(noxIndex)) {
                Serial.println("n/a");
            } else {
                Serial.println(noxIndex);
            }
        }
    }