Inter-Integrated Circuit, aka I2C, is a two-wire protocol for connecting sensors and "devices" to a microcontroller. A large number of sensors, including the ones sold by Adafruit, use I2C to communicate. 

Typically, using I2C with a microcontroller involves programming. Adafruit IO and WipperSnapper let you configure a microcontroller to read data from an I2C sensor and publish that data to the internet without writing code.

The WipperSnapper firmware supports a number of I2C sensors, viewable in list format here.

The process for adding an I2C component to your board running WipperSnapper is similar for most sensors. 

On this page, you'll learn how to configure an I2C sensor built into a development board to send data to Adafruit IO. Then you'll learn how to locate, interpret, and download the data produced by your sensors.

Where are the I2C sensors on my board?

Your board has multiple I2C sensors built-in meaning that there's no wiring required! 

  • In the bottom right corner of the board, on the left side of the cutout region (highlighted in yellow), is a DPS310 pressure sensor, that can be used to sense the barometric pressure. It is connected to the I2C port and available on I2C address 0x77.
  • Also in the bottom right corner of the board, on the right side of the cutout region (highlighted in red), is an AHT20 Humidity and Temperature sensor, that can be used to sense the humidity and temperature. It is connected to the I2C port and available on I2C address 0x38.

Create AHT20 Sensor Component

On the device page, click the New Component (or "+") button to open the component picker.

Under the I2C Components header, click AHT20.

On the component configuration page, the AHT20's I2C sensor address should be listed along with the sensor's settings.

The AHT20 sensor can measure ambient temperature and relative humidity. This page has individual options for reading the ambient temperature, in either Celsius or Fahrenheit, and the relative humidity. You may select the readings which are appropriate to your application and region.

The Send Every option is specific to each sensor measurement. This option will tell the Feather how often it should read from the AHT20 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 for both seconds to Every 30 seconds. Click Create Component.

The board page should now show the AHT20 component you created. After the interval you configured elapses, the WipperSnapper firmware running on your board automatically reads values from the sensor and sends them to Adafruit IO.

Read I2C Sensor Values

Now to take a look behind the scenes at a powerful element of using Adafruit IO and WipperSnapper. When a new component is created on Adafruit IO, an Adafruit IO Feed is also created. This Feed holds your sensor component's values for long-term storage (30 days of storage for Adafruit IO Free and 60 days for Adafruit IO Plus plans).

Aside from holding the values read by a sensor, the component feed also holds metadata about the data pushed to Adafruit IO. This includes settings for whether the data is public or private, what license the stored sensor data falls under, and a general description of the data.

Now look at the AHT20's temperature sensor feed. To navigate to a component's feed, click on the chart icon in the upper-right-hand corner of the component.

On the component's feed page, you'll each data point read by your sensor and when they were reported to Adafruit IO.

Doing more with your sensor's Adafruit IO Feed

We've only scratched the surface of what Adafruit IO Feeds can accomplish for your IoT projects. For a complete overview of Adafruit IO Feeds, including tasks like downloading feed data, sharing a feed, removing erroneous data points from a feed, and more, head over to the "Adafruit IO Basics: Feed" learning guide.

Create DPS310 Component

The process of creating an Adafruit IO component for the FunHouse's DPS310 sensor is similar to the process we followed above for the AHT20.

On the device page, click the New Component (or "+") button to open the component picker.

Under the I2C Components header, click DPS310.

The DPS310 sensor can measure barometric pressure and/or temperature. Select the sensor readings which are appropriate to your application and region.

Since we previously set up the DPS310 to measure ambient temperature, we're only selecting the barometric pressure option.

The Send Every option is specific to each sensor measurement. This option will tell the Feather how often it should read from the DPS310 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 for both seconds to Every 30 seconds. Click Create Component.

The board page should now show the DPS310 component you created. After the interval you configured elapses, the WipperSnapper firmware running on your board automatically reads values from the sensor and sends them to Adafruit IO.

This guide was first published on Apr 20, 2021. It was last updated on Feb 14, 2023.

This page (I2C: On-board Sensors) was last updated on Feb 24, 2023.

Text editor powered by tinymce.