Quick Start Guide
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:
- Thing Plus Development Board
- We recommend either the ESP32 Thing Plus or the RP2350 Thing Plus
- SparkFun Qwiic 5V Boost - AP3012K
- SparkFun Qwiic Cable Kit
- A 5V compatible I2C device:
- Soldering tools
- Headers and jumper Wire
- USB cable
Warning
Soldering is required for this board.
Board Layout
This is the basic layout of the Qwiic 5V Boost board.
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 |
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.
Source Files
- BlinkM Arduino library
-
BlinkMStart.ino
example sketchBlinkMStart.ino
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 |
Once the sensor is attached, users will need to connect the Qwiic 5V Boost board to their development board with a Qwiic cable.
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 sketchexampleUsage.ino
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
/* * 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); } } }