---
title: Routing IoT Data to Adafruit IO (and Beyond)
description: Learn how to use Notecard and Notehub to route collected sensor data for visualization (and more) on Adafruit IO.
source_url: https://dev.blues.io/blog/routing-iot-data-to-adafruit-io-and-beyond/
canonical_url: https://dev.blues.io/blog/routing-iot-data-to-adafruit-io-and-beyond/
markdown_url: https://dev.blues.io/blog/routing-iot-data-to-adafruit-io-and-beyond.md
---

# Routing IoT Data to Adafruit IO (and Beyond)

![Routing IoT Data to Adafruit IO (and Beyond) banner](https://dev.blues.io/images/blog/posts/routing-adafruit-io/banner.jpg?v=dea8a892)

March 19, 2025

## Learn how to use Notecard and Notehub to route collected sensor data for visualization (and more) on Adafruit IO.

- [Notehub](https://dev.blues.io/blog/tag/notehub)
- [Cloud](https://dev.blues.io/blog/tag/cloud)

[![Rob Lauer](https://dev.blues.io/images/blog/authors/rob-lauer.jpg?v=57fb21a7)](https://dev.blues.io/blog/author/rob-lauer/)

[Rob LauerSenior Director of Developer Relations](https://dev.blues.io/blog/author/rob-lauer/)

Too often in this industry we dismiss products and services that are informally labelled for use by "makers". Something about that term illicits assumptions that the product, tool, or service is simple, silly, or not enterprise-ready.

The irony is we all know this "maker" persona is in many ways the foundation of embedded development, and key for inspiring young/new developers. Sure, maybe they are building a ridiculous Rube Goldberg machines, but that can be just step one on their journeys.

I bring this up because [Adafruit](https://www.adafruit.com/) is a well-known brand that has a strong attachment to makers, and for good reason. They are my go-to source for high quality components when I'm building out POCs that demonstrate the value of Blues.

Now, I only recently learned more about Adafruit's cloud service, [Adafruit IO](https://io.adafruit.com/), and I have to say I left impressed.

> This article is a subset of a write-up I did on Adafruit Playground that demonstrates how to build a cloud-connected indoor air quality monitoring solution: [Monitor Indoor Air Quality with Blues, IFTTT, Adafruit IO and a Hue LED Strip](https://adafruit-playground.com/u/roblauer/pages/monitor-indoor-air-quality-with-blues-ifttt-adafruit-io-and-a-hue-led-strip). Yes, very much a "maker" project, but it includes the potential for very practical extensions.

## What is Adafruit IO?

Adafruit IO is a cloud-based platform designed for IoT applications, enabling users to **collect, visualize, and interact with data from connected devices**. Built with simplicity and rapid prototyping in mind, Adafruit IO supports a wide range of hardware, including Arduino, Raspberry Pi, and STM32- and ESP32-based microcontrollers.

![adafruit io logo](https://dev.blues.io/images/blog/posts/routing-adafruit-io/adafruit-io.png?v=f0167631)

Adafruit IO also provides [MQTT](https://io.adafruit.com/api/docs/mqtt.html#adafruit-io-mqtt-api) and [HTTP](https://io.adafruit.com/api/docs/#adafruit-io-http-api) APIs, allowing for seamless integration with [Blues Notehub](https://notehub.io/).

Their platform offers real-time and historical data visualization through customizable dashboards, as well as automation features such as "actions" and "power-ups" for more event-driven responses.

Let's take a quick journey through setting up a Blues Notecard, Blues Notehub, and Adafruit IO to sync data from a connected device.

> Again, for a complete view of this project, [consult the write-up on Adafruit Playground](https://adafruit-playground.com/u/roblauer/pages/monitor-indoor-air-quality-with-blues-ifttt-adafruit-io-and-a-hue-led-strip).

## Blues Notecard and Notehub Setup

If you don't know already know by now, [Blues Notecard](https://shop.blues.com/collections/notecard?utm_source=dev-blues\&utm_medium=web\&utm_campaign=store-link) and its paired cloud service, Blues Notehub, make it incredibly easy to cloud-connect your product. Supporting cellular, WiFi, LoRa, and satellite options, Notecard is your onramp for wireless connectivity.

![all blues notecards](https://dev.blues.io/images/blog/posts/routing-adafruit-io/all-notecards.png?v=774ed0c5)

In fact, it takes only two commands to start sending data to the cloud using the Notecard API:

1. Start with the `hub.set` API:

   The [hub.set API](https://dev.blues.io/api-reference/notecard-api/hub-requests/latest.md#hub-set) tells the Notecard to which Notehub cloud project it should send data.

   After setting up a (free) Notehub project, you'll have a globally unique `ProductUID`:

   ![new notehub project](https://dev.blues.io/images/blog/posts/routing-adafruit-io/notehub-project.png?v=5130e5e5)

   And the supporting code in your sketch?

   ```c
   {
      J *req = notecard.newRequest("hub.set");
      if (req != NULL)
      {
         JAddStringToObject(req, "product", PRODUCT_UID);
         JAddStringToObject(req, "mode", "continuous");
         notecard.sendRequest(req);
      }
   }
   ```

   **TIP:** If you're new to Notecard, you should know you also develop with virtually [any language or RTOS](https://dev.blues.io/tools-and-sdks.md) (not just C!).

2. Send data with the `note.add` API

   Every time we want to send data to the cloud, we call the [note.add API](https://dev.blues.io/api-reference/notecard-api/note-requests/latest.md#note-add). This creates an event (a.k.a. a [Note](https://dev.blues.io/api-reference/glossary.md#note) in Blues lingo) full of sensor data.

   For example, if you were gathering temperature, humidity, and other sensor readings:

   ```c
   {
      J *req = notecard.newRequest("note.add");
      if (req != NULL)
      {
        JAddStringToObject(req, "file", "sensors.qo");
        JAddBoolToObject(req, "sync", true);
        J *body = JAddObjectToObject(req, "body");
        if (body)
        {
          JAddNumberToObject(body, "temp", temp);
          JAddNumberToObject(body, "humid", humid);
          JAddNumberToObject(body, "co2", co2);
          JAddNumberToObject(body, "raw", sraw);
          JAddNumberToObject(body, "voc", vocIndex);
          JAddNumberToObject(body, "voltage", voltage);
        }
        notecard.sendRequest(req);
      }
   }
   ```

   And the resulting data appears in your Notehub project like so:

   ![notehub event](https://dev.blues.io/images/blog/posts/routing-adafruit-io/notehub-event.png?v=e893eccf)

## Adafruit IO Setup

Let's imagine at this point we are gathering sensor data locally and sending it periodically to the cloud using Notecard and Notehub.

Next, we need to *do something meaningful* with this data, and that's where [Adafruit IO](https://io.adafruit.com/) comes into play. With a generous free tier, this cloud service provides a ridiculously easy way to **visualize data (dashboards), create alerts (actions), and even integrate with third-party services (power-ups)**.

### Adafruit IO Feeds

After setting up an Adafruit IO account, head to the **Feeds** section to create one feed for each data element you want to use:

![adafruit io feeds](https://dev.blues.io/images/blog/posts/routing-adafruit-io/all-feeds.png?v=2e590733)

### Routing Data from Notehub to Adafruit IO Feeds

Next, head *back to Notehub* to create a [route](https://dev.blues.io/notehub/notehub-walkthrough.md#routing-data-with-notehub) which will tell Notehub how to deliver events to the feeds.

From the **Routes** menu option, choose **General HTTP/HTTPS Request/Response**.

![create notehub route](https://dev.blues.io/images/blog/posts/routing-adafruit-io/create-route.png?v=aef18d54)

To set up the rest of the route:

1. The **URL** will be: `https://io.adafruit.com/api/v2/{username}/groups/{group}/data`

   Where `{username}` is your Adafruit IO username and `{group}` is the name of the group that encapsulates your feeds. (This is probably `default`.)

2. Under **HTTP Headers** you'll have to add your Adafruit IO key (which is available back in your Adafruit IO account).

   `X-AIO-Key` is the name and your Adafruit IO key is the value.

3. Under **Filters** you'll want to send the sensor data associated with this project and ignore other session and health info that Notecard sends.

   Therefore, under the **Notefiles** section, choose **Selected Notefiles**, and then `sensors.qo` (or whatever name you used in your `note.add` request above).

4. Lastly in the **Data** section, we'll need to edit or *transform* the JSON payload sent from the device before it's delivered to Adafruit IO. Every cloud service has a certain format of data they expect, and Adafruit IO is no different!

   In essence we need to create a set of key-value pairs, one for each data element we are sending. Something like...

   ```unknown
   {
     "key":"co2-feed",
     "value":body.co2
   }
   ```

   How is this accomplished? Through the magic of [JSONata](https://jsonata.org/) expressions! JSONata lets you transform JSON objects on the fly.

   **TIP:** The [JSONata Exerciser](https://try.jsonata.org/) is a great way to test out JSONata expressions!

   Here's the full JSONata expression I used, with an image of this expression in the aforementioned JSONata Exerciser:

   ```unknown
   {
     "feeds":[
        {
              "key":"bestlocation-feed",
              "value":best_location
        },
        {
              "key":"co2-feed",
              "value":body.co2
        },
        {
              "key":"humid-feed",
              "value":body.humid
        },
        {
              "key":"raw-feed",
              "value":body.raw
        },
        {
              "key":"temp-feed",
              "value":body.temp
        },
        {
              "key":"transport-feed",
              "value":transport
        },
        {
              "key":"voc-feed",
              "value":body.voc
        },
        {
              "key":"voltage-feed",
              "value":body.voltage/5*100
        }
     ],
     "created_at":$fromMillis(when * 1000),
     "location":{
        "lat":best_lat,
        "lon":best_lon
     }
   }
   ```

   ![jsonata exerciser](https://dev.blues.io/images/blog/posts/routing-adafruit-io/jsonata-exerciser.png?v=553c0ceb)

5. Finally, save the route (making sure it's enabled) and watch as the next event comes in. You should see a little green check under the status column in the **Event** view, which tells you the event was successfully routed to Adafruit IO.

   ![notehub event routed](https://dev.blues.io/images/blog/posts/routing-adafruit-io/notehub-event-routed.png?v=7b8fa299)

### Adafruit IO Dashboard

Now that we have data flowing into Adafruit IO, let's create a dashboard.

![adafruit io dashboard](https://dev.blues.io/images/blog/posts/routing-adafruit-io/dashboard.png?v=4a612f92)

1. Head to the **Dashboards** menu option in Adafruit IO and create your first dashboard.

2. Using the intuitive UI provided, create one or more **blocks** for each **feed**. For example, I created a **gauge** to show the most recent reading from a sensor and a **line chart** to show historical readings:

   ![adafruit io voc gauge](https://dev.blues.io/images/blog/posts/routing-adafruit-io/voc-gauge.png?v=024f45ba)

3. Now, **repeat the previous step** for every data element you want to visualize. It's that simple!

### Adafruit IO Actions

"Actions" are another Adafruit IO capability that lets you perform an activity on a scheduled basis, on a timer, or when a feed is updated.

![adafruit io actions](https://dev.blues.io/images/blog/posts/routing-adafruit-io/adafruitio-actions.png?v=4d0f0233)

A simple action is to receive an email alert when a sensor value reaches a specified threshold.

1. Head to the **Actions** menu option in Adafruit IO.

2. Create a new action using either a form or the "Blockly" editor (which feels a bit like programming in [Scratch](https://scratch.mit.edu/)!).

3. Here's what my email alert looks like in the **Blockly editor**:

   ![blockly email action](https://dev.blues.io/images/blog/posts/routing-adafruit-io/blockly.png?v=15320a71)

4. And the alerts? Not too bad:

   ![adafruit io email action](https://dev.blues.io/images/blog/posts/routing-adafruit-io/aio-email.png?v=1b9f6d66)

> **Note:**
>
> You can also build these same alerts [directly in Notehub](https://dev.blues.io/notehub/notehub-walkthrough.md#configuring-alert-monitors).

### Adafruit IO Power-Ups

Power-ups are Adafruit IO-provided integrations with third party services like IFTTT, Zapier, and SMS for messaging (among other services).

![adafruit io power-ups](https://dev.blues.io/images/blog/posts/routing-adafruit-io/adafruitio-power-ups.png?v=32afb21a)

For the aforementioned [Adafruit Playground project](https://adafruit-playground.com/u/roblauer/pages/monitor-indoor-air-quality-with-blues-ifttt-adafruit-io-and-a-hue-led-strip) I put together, I used [IFTTT](https://ifttt.com/) to integrate with my [Philips Hue LED strip](https://www.philips-hue.com/en-us/products/smart-light-strips) and provide some more dramatic lighting feedback by changing the color when a sensor value goes above/below an arbitrary value.

1. Choose the **IFTTT** from the **Power-Ups** menu in Adafruit IO.

2. Log in to your IFTTT account and [create an applet](https://ifttt.com/create).

3. The first step of the applet is to monitor a monitor a feed from Adafruit IO. Search for "Adafruit" and complete the form as needed to set the LED strip color (e.g. if the specified value is less than 100).

   ![ifttt adafruit io monitor](https://dev.blues.io/images/blog/posts/routing-adafruit-io/ifttt-voc.png?v=b4debb9f)

4. Next, in the "then" section, you'll want to connect to your Hue account and select the "change color" action for your HUE light.

   ![ifttt hue](https://dev.blues.io/images/blog/posts/routing-adafruit-io/ifttt-hue.png?v=7187d552)

5. The IFTTT applet should then be complete!

   ![ifttt hue green applet](https://dev.blues.io/images/blog/posts/routing-adafruit-io/ifttt-green.png?v=2351c1e5)

> **Warning:**
>
> The free tier of IFTTT only polls your Adafruit IO feed once per hour. You can upgrade to their "Pro" tier to get more frequent polling.

## Summary

This project measured VOC index levels in my office which don't change that often, so I hard-coded in some VOC values to quickly demonstrate the lights changing:

[Video: Routing IoT Data to Adafruit IO (and Beyond)](https://www.youtube-nocookie.com/embed/pYM0PNfwX8U)

> Again, check out the original [Adafruit Playground write-up](https://adafruit-playground.com/u/roblauer/pages/monitor-indoor-air-quality-with-blues-ifttt-adafruit-io-and-a-hue-led-strip) for the full project details.

Next steps? Get started with [Adafruit IO here](https://io.adafruit.com/) and get your own [Blues Starter Kit](https://shop.blues.com/products/blues-global-starter-kit?utm_source=dev-blues\&utm_medium=web\&utm_campaign=store-link).
