-
User Submitted Tutorial - Magnetic Door Spy
Faraday Robotech shared their updated version of the IoT Door Detector Tutorial. Check out their new and improved version of the tutorial here: Wi-Fi Magnetic Door Spy Tutorial
If you would like your Adafruit IO tutorial to be featured, share it with us via Twitter (@adafruit) or Instagram (@adafruit) by using the hashtag #adafruitio.
-
State of IO 12.06.16
Here are the stats for the past week:
* 63.6 million inserts of logged data in the last 7 days * 19,537 users * 14,583 online feeds (51,303 feeds total) * ~100 inserts per second via MQTT * ~10 inserts per second via REST API
-
Loading Data from Adafruit IO into Pandas
If you are logging sensor data to Adafruit IO, you may have a need to do a deeper examination of your data. One popular option is the pandas data analysis library for Python.
Here is a description from the pandas website:
pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
Let’s take a quick look at how to load data into pandas from a public Adafruit IO feed.
Setup
You will need Python 3.5 installed, and you will also need to install pip if it wasn’t included with your Python install.
Once Python and pip are installed, you can install pandas by running:
$ pip install pandas
For this example, we will be pointing pandas at a public Adafruit IO feed. If your feed is currently private, you will need to make it public.
Importing Feed Data
To get started, you will need to open up a new Python file in your favorite editor, and start by importing pandas:
import pandas as pd
Next, we need to pull in feed data via the
read_json
method. ReplaceUSERNAME
andFEED_KEY
with your Adafruit IO username, and the key of the feed you wish to load.feed_data = pd.read_json('https://io.adafruit.com/api/v2/USERNAME/feeds/FEED_KEY/data')
If you are not sure where to find your feed’s key, you can find it below the feed name.
Date Conversion
Next, we will convert the
created_at
column from a string todatetime
, and set it as the index for the data frame:feed_data['created_at'] = pd.to_datetime(feed_data['created_at'], infer_datetime_format=True) feed_data = feed_data.set_index('created_at')
Plot Values on a Chart
Now that the data has a valid date column, we can load the feed values into a time series, and plot the values:
values = pd.Series(feed_data['value']) values.plot()
Another simple example is to resample the data into daily averages, and plot them on a bar chart:
daily = values.resample('1d').mean() daily.plot(kind='barh')
You can do a wide range of useful operations with Time Series, and you should refer to the documentation for more details.
-
State of IO 11.23.16
Here are the stats for the past week:
* 56.1 million inserts of logged data in the last 7 days * 18,941 users * 14,043 online feeds (49,321 feeds total) * ~90 inserts per second via MQTT * ~10 inserts per second via REST API
-
State of IO 11.07.16
Here are the stats for the past week:
* 54.7 million inserts of logged data in the last 7 days * 18,147 users * 13,309 online feeds (46,968 feeds total) * ~77 inserts per second via MQTT * ~10 inserts per second via REST API