Since there's dozens of different sensor manufacturers out there, and we don't want to have a ton of #ifdef's in our code to manage each kind, we'll be using Adafruit SensorLab to manage detecting the various magnetometers, accelerometers, pressure sensors... etc!

Adafruit SensorLab automatically detects a wide range of sensors, over I2C, no matter what I2C address it's on. It will return an Adafruit Unified Sensor object that we can query for events. You can't do advanced stuff like manually setting ranges or internal filters, but for many projects the basics will do just fine!

We'll be assuming you have the sensor on the main I2C port, and of course use the matching Adafruit library to verify the sensor is working and powered right before you continue!

A list of supported sensors is available here

Remember, only supported sensors on I2C will be detected!

Install SensorLab

Since there are a ton of sensors, and we also use Arcada in a few examples, there's a lot of libraries to install

No really, we have a lot of software involved here - probably 20 or so libraries total!

For that reason we really strongly recommend you use Arduino 1.8.10 or greater which handles automatic library dependency installation. Otherwise you will be frustrated...

Select the Sketch -> Include Library -> Manage Libraries...

Search for Sensor Lab and install the Adafruit library you see

This guide was first published on Jan 26, 2020. It was last updated on Jan 26, 2020.

This page (Install SensorLab) was last updated on May 10, 2021.

Text editor powered by tinymce.