Home

Awesome

Sensirion Raspberry Pi I2C SEN5x Driver

This document explains how to set up the Sen5x sensor to run on a Raspberry Pi using the provided code.

<center><img src="images/SEN5x.png" width="500px"></center>

Supported sensors

Setup Guide

Connecting the Sensor

Your sensor has the five different connectors: VCC, GND, SDA, SCL, SEL (the sixth connector will not be used for now). Use the following pins to connect your SEN5x:

SEN5xRaspberry PiJumper Wire
VCCPin 2 (5V)Red
GNDPin 6Black
SDAPin 3Green
SCLPin 5Yellow
SELPin 9 (GND for I2C)Blue
<center><img src="images/GPIO-Pinout-Diagram.png" width="900px"></center> <center><img src="images/SEN5X_pinout.png" width="300px"></center>
PinNameDescriptionComments
1VCCSupply Voltage5V ±10%
2GNDGround
3SDAI2C: Serial data input / outputTTL 5V and LVTTL 3.3V compatible
4SCLI2C: Serial clock inputTTL 5V and LVTTL 3.3V compatible
5SELInterface selectPull to GND to select I2C
6NCDo not connect

Raspberry Pi

Troubleshooting

Building driver failed

If the execution of make in the compilation step 3 fails with something like

-bash: make: command not found

your RaspberryPi likely does not have the build tools installed. Proceed as follows:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential

Initialization failed

Missing I2C permissions

If your user is missing access to the I2C interface you should first verfiy the user belongs to the i2c group.

$ groups
users input some other groups etc

If i2c is missing in the list add the user and restart the Raspberry Pi.

$ sudo adduser ${USER} i2c
Adding user `pi' to group `i2c' ...
Adding user pi to group i2c
Done.
$ sudo reboot

If that did not help you can make globally accessible hardware interfaces with a udev rule. Only do this if everything else failed and you are reasonably confident you are the only one having access to your Pi.

Go into the /etc/udev/rules.d folder and add a new file named local.rules.

$ cd /etc/udev/rules.d/
$ sudo touch local.rules

Then add a single line ACTION=="add", KERNEL=="i2c-[0-1]*", MODE="0666" to the file with your favorite editor.

$ sudo vi local.rules