Overview
Now you can quickly integrate the Sensirion SEN54 / SEN55 environmental sensor node into your microcontroller or microcomputer project, with no soldering or fiddly breadboarding - thanks to this here Adafruit SEN54 or SEN55 Adapter Breakout.
We covered the awesome Sensirion SEN54 / SEN55 environmental sensor nodes on EYE ON NPI a while ago. It's an awesome all-in-one air quality sensor, but has the annoyance that it requires 5V power and it has a special cable connection.
This adapter breakout will make an instant friendship with all SEN5x boards, thanks to a JST GH-compatible connector in the middle so that you can plug a 6-pin GH cable directly between your SEN and this adapter. In the middle is a small switch-cap boost converter that will generate 5V at 100mA to power the fan and electronics in the SEN5x even if you're using 3V power and logic. Then you can use any ol' STEMMA QT cable to plug into your Metro, Feather, QT Py, Raspberry Pi, etc. I2C port.
Once you've got it plugged together, you can run Sensirion's Arduino library or Raspberry Pi Python library to read temperature, humidity, VOC, Particulate Matter PM1 / PM2.5 / PM4 and PM10. (NOx reading is also available on the SEN55)
Please note: this board does NOT come with a JST GH-compatible cable NOR a SEN5x sensor! You can pick up the cable here, and a SEN5x from DigiKey.
Page last edited May 13, 2024
Text editor powered by tinymce.
Pinouts
The default I2C address for the SEN5x sensors is 0x69.
Power Pins
- Vin - this is the power pin. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V.
- GND - common ground for power and logic.
I2C Logic Pins
- SCL - I2C clock pin, connect to your microcontroller's I2C clock line. This pin can use 3-5V logic, and there's a 10K pullup on this pin.
- SDA - I2C data pin, connect to your microcontroller's I2C data line. This pin can use 3-5V logic, and there's a 10K pullup on this pin.
- STEMMA QT - These connectors allow you to connect to to dev boards with STEMMA QT (Qwiic) connectors or to other things with various associated accessories.
JST GH Connector
At the top edge of the board is the JST GH connector. This connector lets you plug in a SEN54 or SEN55 sensor directly into the breakout with a 6-pin GH cable.
Power LED and Jumper
- Power LED - In the upper left corner, above the STEMMA connector, on the front of the board, is the power LED, labeled on. It is a green LED.
- LED jumper - This jumper is located on the back of the board and is labeled LED on the board silk. Cut the trace on this jumper to cut power to the "on" LED.
Page last edited May 13, 2024
Text editor powered by tinymce.
Python
It's easy to use the SEN5x Adapter Breakout with Python and the Sensirion Python driver for SEN5x sensors. This driver allows you to easily write Python code to read environmental data from a SEN5x sensor.
You can use this driver with any computer that has GPIO and Python. Note that this is NOT a CircuitPython compatible driver, it is for CPython (desktop Python).
Python Computer Wiring
Since there are dozens of Linux computers/boards you can use, we will show wiring for Raspberry Pi.
Here's the Raspberry Pi wired with I2C using the STEMMA connector:
-
Pi 3V to breakout STEMMA VIN (red wire)
-
Pi GND to breakout STEMMA GND (black wire)
-
Pi SCL to breakout STEMMA SCL (yellow wire)
- Pi SDA to breakout STEMMA SDA (blue wire)
- SEN5x sensor to breakout JST GH port
Here's the Raspberry Pi wired with I2C using a solderless breadboard:
-
Pi 3V to breakout VIN (red wire)
-
Pi GND to breakout GND (black wire)
-
Pi SCL to breakout SCL (yellow wire)
- Pi SDA to breakout SDA (blue wire)
- SEN5x sensor to breakout JST GH port
Python Installation of Sensirion SEN5x Library
You'll need to ensure that I2C is enabled on your platform and verify you are running Python 3.
Once that's done, from your command line run the following command:
pip3 install sensirion-i2c-driver sensirion-i2c-sen5x
This will install the Sensirion I2C driver and I2C SEN5x driver. If your default Python is version 3 you may need to run 'pip' instead.
Python Usage
Once you have the library pip3 installed on your computer, copy or download the following example to your computer, and run the following, replacing code.py with whatever you named the file:
python3 code.py
# SPDX-FileCopyrightText: 2024 Liz Clark for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
from sensirion_i2c_driver import I2cConnection, LinuxI2cTransceiver
from sensirion_i2c_sen5x import Sen5xI2cDevice
i2c = LinuxI2cTransceiver('/dev/i2c-1')
device = Sen5xI2cDevice(I2cConnection(i2c))
# Print some device information
print(f"Version: {device.get_version()}")
print(f"Product Name: {device.get_product_name()}")
print(f"Serial Number: {device.get_serial_number()}")
# Perform a device reset (reboot firmware)
device.device_reset()
# Start measurement
device.start_measurement()
time.sleep(1)
def read_data():
try:
# Wait until next result is available
print("Waiting for new data...")
while device.read_data_ready() is False:
time.sleep(0.1)
# Read measured values -> clears the "data ready" flag
values = device.read_measured_values()
print(values)
# Access a specific value separately (see Sen5xMeasuredValues)
# mass_concentration = values.mass_concentration_2p5.physical
# ambient_temperature = values.ambient_temperature.degrees_celsius
# Read device status
status = device.read_device_status()
print("Device Status: {}\n".format(status))
except Exception as e: # pylint: disable = broad-except
print(f"Error: {e}")
while True:
read_data()
time.sleep(5)
Sensirion has a LinuxI2cTransceiver module in its sensirion_i2c_driver library. This lets you interface with the I2C bus on the Raspberry Pi in a way that is compatible with the Sensirion SEN5x library.
After the sensor is instantiated over I2C, data is read from the sensor and printed to the serial console every five seconds in the loop.
Page last edited May 13, 2024
Text editor powered by tinymce.
Arduino
Using the SEN5x adapter breakout with Arduino involves wiring up the adapter with a SEN5x sensor to your Arduino-compatible microcontroller, installing the Sensirion I2C SEN5X library, and running the provided example code.
Wiring
Wire as shown for a 5V board like an Uno. If you are using a 3V board, like an Adafruit Feather, wire the board's 3V pin to the breakout VIN.
Here is an Adafruit Metro wired up to the breakout using the STEMMA QT connector:
-
Board 5V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
- SEN5x sensor to breakout JST GH port
Here is an Adafruit Metro wired up using a solderless breadboard:
-
Board 5V to breakout VIN (red wire)
-
Board GND to breakout GND (black wire)
-
Board SCL to breakout SCL (yellow wire)
- Board SDA to breakout SDA (blue wire)
- SEN5x sensor to breakout JST GH port
Library Installation
You can install the Sensirion I2C SEN5X library for Arduino using the Library Manager in the Arduino IDE.
Click the Manage Libraries ... menu item, search for Sensirion SEN5x, and select the Sensirion I2C SEN5X library:
If asked about dependencies, click "Install all".
If the "Dependencies" window does not come up, then you already have the dependencies installed.
/*
* 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);
}
}
}
The Sensirion I2C SEN5X library has an example to read all of the available data from the SEN5x sensor over I2C. Upload the sketch to your board and open up the Serial Monitor (Tools -> Serial Monitor) at 115200 baud. You'll see the PM1.0, PM2.5, PM4.0, PM10.0, humidity, temperature, VOC index and NOx index readings print to the Serial Monitor every second. Note that NOx readings are only available on the SEN55 sensor.
Page last edited May 13, 2024
Text editor powered by tinymce.
WipperSnapper
What is WipperSnapper
WipperSnapper is a firmware designed to turn any WiFi-capable board into an Internet-of-Things device without programming a single line of code. WipperSnapper connects to Adafruit IO, a web platform designed (by Adafruit!) to display, respond, and interact with your project's data.
Simply load the WipperSnapper firmware onto your board, add credentials, and plug it into power. Your board will automatically register itself with your Adafruit IO account.
From there, you can add components to your board such as buttons, switches, potentiometers, sensors, and more! Components are dynamically added to hardware, so you can immediately start interacting, logging, and streaming the data your projects produce without writing code.
If you've never used WipperSnapper, click below to read through the quick start guide before continuing.
First, wire up a SEN5x Adapter Breakout to your board exactly as follows. Here is an example of the SEN5x Adapter wired to an Adafruit ESP32 Feather V2 using I2C with a STEMMA QT cable (no soldering required).
It is expected you would have a Sensirion SEN5x sensor (SEN50/SEN54/SEN55) attached to the adapter breakout (not shown here in wiring diagrams).
-
Board 3V to sensor VIN (red wire on STEMMA QT)
-
Board GND to sensor GND (black wire on STEMMA QT)
-
Board SCL to sensor SCK (yellow wire on STEMMA QT)
- Board SDA to sensor SDI (blue wire on STEMMA QT)
Usage
Connect your board to Adafruit IO Wippersnapper and navigate to the WipperSnapper board list.
On this page, select the WipperSnapper board you're using to be brought to the board's interface page.
If you do not see your board listed here - you need to connect your board to Adafruit IO first.
On the device page, quickly check that you're running the latest version of the WipperSnapper firmware.
The device tile on the left indicates the version number of the firmware running on the connected board.
- If the firmware version is green with a checkmark - continue with this guide.
- If the firmware version is red with an exclamation mark "!" - update to the latest WipperSnapper firmware on your board before continuing.
Next, make sure the sensor is plugged into your board and click the I2C Scan button.
You should see the SEN5x's default I2C address of 0x69 pop-up in the I2C scan list.
First, double-check the connection and/or wiring between the sensor and the board.
Then, reset the board and let it re-connect to Adafruit IO WipperSnapper.
With the sensor detected in an I2C scan, you're ready to add the sensor to your board.
Click the New Component button or the + button to bring up the component picker.
The Adafruit SEN54 or SEN55 Adapter Breakout actually supports all three models of Sensirion's SEN5x series of air-quality sensors (SEN50/SEN54/SEN55), along with the 6x series (SEN60, SEN63C, SEN65, SEN66, SEN68).
The SEN50 only supports Particulate Matter options (no Temp/Humidity/VOC/NOx), while the SEN54 has PM/Temp/Humidity/VOC, and the SEN55 additionally has the NOx index.
Normally there is an identification label showing the model number with a QR code. If your sensor doens't have any label then pick the SEN55 component.
Depending on the sensor model there may be some data types that return no data, matching the unsupported features in your sensor model.
Deselect those options to avoid consuming feeds unnecessarily.
Adafruit IO supports a large amount of components, compatible with any boards running on WipperSnapper firmware. To quickly find your sensor, type SEN5 into the search bar, then select the component matching your sensor.
On the component configuration page, the SEN5x's sensor address should be listed along with the sensor's settings.
The Send Every option is specific to each sensor's measurements. This option will tell the Feather how often it should read from the SEN5x sensor and send the data to Adafruit IO. Measurements can range from every 30 seconds to every 24 hours.
For this example, set the Send Every interval to every 30 seconds.
Your device interface should now show the sensor components you created. After the interval you configured elapses, WipperSnapper will automatically read values from the sensor(s) and send them to Adafruit IO.
To view the data that has been logged from the sensor, click on the graph next to the sensor name.
Here you can see the feed history and edit things about the feed such as the name, privacy, webhooks associated with the feed and more. If you want to learn more about how feeds work, check out this page.
Page last edited May 13, 2024
Text editor powered by tinymce.
Downloads
Page last edited May 13, 2024
Text editor powered by tinymce.