Oct 15

Official ThingSpeak Library for Arduino and Particle

We are thrilled to announce the official ThingSpeak Communication Library for Arduino and Particle devices. This library enables an Arduino or other compatible hardware to write or read data to or from ThingSpeak, an open data platform for the Internet of Things with built-in MATLAB analytics and visualization apps.

Arduino IDE Installation

In the Arduino IDE, choose Sketch/Include Library/Manage Libraries. Click the ThingSpeak Library from the list, and click the Install button.

Particle / Spark IDE Installation

In the Particle/ Spark Web IDE, click the libraries tab, find ThingSpeak, and choose “Include in App”.

Compatible Hardware

  • Arduino or compatible using an Ethernet or Wi-Fi shield (we have tested with Uno and Mega)
  • Arduino Yun running OpenWRT-Yun Release 1.5.3 (November 13th, 2014) or later.
  • Particle Core or Photon (Formally Spark)

ThingSpeak Examples

The library includes several examples to help you get started.

  • CheerLights: Reads the latest CheerLights color on ThingSpeak, and sets an RGB LED.
  • ReadLastTemperature: Reads the latest temperature from the public MathWorks weather station in Natick, MA on ThingSpeak.
  • ReadPrivateChannel: Reads the latest voltage value from a private channel on ThingSpeak.
  • ReadWeatherStation: Reads the latest weather data from the public MathWorks weather station in Natick, MA on ThingSpeak.
  • WriteMultipleVoltages: Reads analog voltages from pins 0-7 and writes them to the 8 fields of a channel on ThingSpeak.
  • WriteVoltage: Reads an analog voltage from pin 0, converts to a voltage, and writes it to a channel on ThingSpeak.

Complete source code and examples for the ThingSpeak Library are available on GitHub.

Sep 15

Video Introduction to ThingSpeak and the Internet of Things

Our very own Robert Mawrey produced a video introducing ThingSpeak and the Internet of Things.

ThingSpeak Intro Video

ThingSpeak is an open data platform for the Internet of Things. Your device or application can communicate with ThingSpeak using a RESTful API, and you can either keep your data private, or make it public. In addition, use ThingSpeak to analyze and act on your data. ThingSpeak provides an online text editor to perform data analysis and visualization using MATLAB®. You can also perform actions such as running regularly scheduled MATLAB code or sending a tweet when your data passes a defined threshold. ThingSpeak is used for diverse applications ranging from weather data collection and analysis, to synchronizing the color of lights across the world.

At the heart of ThingSpeak is a time-series database. ThingSpeak provides users with free time-series data storage in channels. Each channel can include up to eight data fields. This tutorial provides an introduction to some of the applications of ThingSpeak, a conceptual overview of how ThingSpeak stores time-series data, and how MATLAB analysis is incorporated in ThingSpeak.

[via MathWorks]

Sep 15

Counting Cars and Analyzing Traffic #RaspberryPi #MATLAB #ThingSpeak

The power of any tool becomes magnified when you start combing it with other tools. In this MakerZone project by Eric Wetjen, he demonstrates a powerful project by using a webcam to gather live traffic video of Route 9 in Natick, MA, using Simulink to deploy a car-counting algorithm to a Raspberry Pi, using MATLAB to perform analysis, and using ThingSpeak to collect and share the analyzed data with others.

Car Counting Camera

The project uses a Raspberry Pi 2 and USB webcam acting as a sensor. The webcam picks up traffic flowing in both directions. Once the algorithm for detecting cars is modeled in Simulink, the algorithm gets deployed on the Raspberry Pi. The Raspberry Pi sends the raw data to ThingSpeak on regular basis where it is analyzed using the MATLAB Analysis app on ThingSpeak.


After sending to ThingSpeak, Eric created a MATLAB Analysis app to calculate the daily traffic-volume on ThingSpeak Channel 51671. Now that the data is public, others could use this processed data within apps such as Waze to optimize directions using analyzed traffic flows.

MATLAB Traffic Analysis ThingSpeak Visualization

Check out the MakerZone article for the complete project details and all of the code to get your Raspberry Pi + ThingSpeak analysis project started.

[via MathWorks MakerZone]

Sep 15

Updates to the MATLAB Analysis App with Lots of Example Code

When using the MATLAB Analysis app on ThingSpeak, the MATLAB function to represent date and time (datetime) allows you to represent points in time. You can also use datetime(‘now’)datetime(‘today’), datetime(‘yesterday’), or datetime(‘tomorrow’) to create scalar datetimes at or around the current moment. Refer to the link below for additional information about datetime function: http://www.mathworks.com/help/matlab/ref/datetime.html

On ThingSpeak, so far, the datetime function returned time set to UTC time zone by default. Starting at 10 am (EDT) on September 10th 2015, the datetime function will return date and time set to your account time zone (at https://thingspeak.com/account). This will allow you to read data from your channel with timestamps zoned to your local time zone instead of UTC.

For example, my account time zone is set to Eastern Time (US & Canada), and when I ran the following MATLAB code at 12:23 pm, I received:

dt = datetime('now')
dt =
10-Sep-2015 12:23:35


Prior to this change, I would have received:

dt =
10-Sep-2015 16:23:35


As you can see, the timestamp is 4 hours ahead of my time zone, which was due to MATLAB returning time in UTC.

This change makes it easier for you to perform time related activities in your time zone. Note that this new feature is available for both thingSpeakRead and thingSpeakWrite functions as well. As an example, consider the following request to read data from the MathWorks Weather Channel:


[data, timestamp] = thingSpeakRead(12397);
display(timestamp.TimeZone, 'TimeZone');
data =
225.0000    3.8000   43.9000   95.8000
0   29.9800    4.3000    0.0300
timestamp =
10-Sep-2015 16:13:54
TimeZone =


With this enhancement, you would no longer have to explicitly specify the time zone of your dates and time to read and write data in your time zone.

Here are a few other examples:

  1. Read data corresponding to one entire day in your time zone:
startDateTime = datetime('September 10, 2015 00:00:00')
endDateTime = datetime('September 10, 2015 23:59:59')
readChannelID = 12397;
[data, timeStamps] = thingSpeakRead(readChannelID, 'DateRange', [startDateTime, endDateTime])

  1. Read data between certain hours of a day (between 7 am and 9 pm)
startDateTime = datetime('September 10, 2015 07:00:00')
endDateTime = datetime('September 10, 2015 21:00:00')
readChannelID = 12397;
[data, timeStamps] = thingSpeakRead(readChannelID, 'DateRange', [startDateTime, endDateTime])

  1. Generate a MATLAB plot in your local time zone:
[data, timeStamps] = thingSpeakRead(12397, 'Fields', 3, 'NumPoints', 10);
plot(timeStamps, data)


Note that, if at present, you are explicitly setting the time zone to your local time zone, you might see unexpected behavior in your code. Here are a few examples, based on support requests we have received:

  1. If you are using datetime function in your code similar to the example below:
% Set the time now to variable dt
dt = datetime('now')
% Assign time zone to UTC since the dt is unzoned by default
dt.TimeZone = 'UTC';
% Convert the timestamp to ‘America/New_York’
dt.TimeZone = 'America/New_York'


To fix this, remove the “TimeZone” assignments since time is now returned in your time zone by default, and use the code below:

% Set the time now to variable dt
dt = datetime('now')

  1. If you are setting the time zone of data returned by thingSpeakRead to your zone:
% Read data from a channel
[data, timeStamps] = thingSpeakRead(12397);
% Set the timezone to match your zone
timeStamps.TimeZone = 'America/New_York';


To fix this, remove the line with the “TimeZone” assignment, and use the code below:

% Read data from a channel
[data, timeStamps] = thingSpeakRead(12397);


For more information about the datetime function refer to the MATLAB documentation. If you need support, use the MATLAB section of the ThingSpeak Forum.

Sep 15

Analyzing CheerLights with MATLAB

CheerLights is an Internet of Things project created by Hans Scharler that allows people’s lights all across the world to synchronize to one color set by Twitter. This is a way to connect physical things with social networking experiences and spread cheer at the same time. When one light turns red, they all turn red.

CheerLights uses ThingSpeak to collect the latest color. We get the color value by following “CheerLights” on Twitter using the TweetControl app. When someone Tweets using “CheerLights” and a color name, the TweetControl app writes the color to the CheerLights Channel on ThingSpeak. Other developers wanting to join the CheerLights project read in the latest color value using the ThingSpeak Channel API and then set their light color to the same one.

With some MATLAB Analysis and Visualizations, I know that currently red is the most popular color on CheerLights! I have recently taken advantage of the MATLAB integration with ThingSpeak. Under Apps -> MATLAB Analysis, we have an example that will show you how to analyze the public CheerLights Channel on ThingSpeak to determine the most requested color. The MATLAB Analysis example is called, “Analyze text for the most common color”.

Example MATLAB Visualization Code
lights = thingSpeakRead(1417,'OutputFormat','table','NumDays',30);


People all over the world have joined CheerLights by making all kinds of light displays, apps, and browser plugins. I recently created a CheerLights display for my parents using a LIFX Wi-Fi Light Bulb. If you want to control all of the lights, just send a Tweet using Twitter that mentions @CheerLights and a color.

“@CheerLights Let’s go Blue!”

Check out CheerLights.com for more detail and for ideas on how to join the project. We are all connected!

[via CheerLights.com]

Aug 15

You’ve Collected Lots of IoT Data, Now We Can Help You Figure Out What It Means!

For the last several years, I have been collecting data with ThingSpeak from devices all around my house. I have been tracking temperature, humidity, light levels, outside weather data, my deep freezer’s temperature, the state of My Toaster, and air quality metrics. I just recently started to think about what all of this data really means to me and if it’s good data to begin with. Wouldn’t it be great if I could explore my data in ThingSpeak?  Well, I am happy to say that with the latest upgrade to ThingSpeak, you can do just that.

We have been working with the MATLAB team at MathWorks to provide two new ThingSpeak Apps: MATLAB Analysis and MATLAB Visualizations. With these new built-in Apps, the ThingSpeak web service can automatically run MATLAB code. That makes it easier to gain insight into your data.

ThingSpeak MATLAB Apps

With the MATLAB Analysis app, I am now able to turn my home’s temperature and humidity data into dew point. Dew point is important to find out if the environment is comfortable independent of just knowing the temperature alone. If the dew point is too high or too low, your guests may notice their glasses sweating or that they are uncomfortable.

I am also able to clean up my sensor data and filter out bad data and write it back to a new ThingSpeak channel. From time to time, I see one of my sensors report a really high value, and I’d like to have a way to fix it.

We have provided many MATLAB code examples to get started quickly.

Some of our analysis examples include:

  • Calculate Average Humidity
  • Calculate Dew point
  • Convert Celsius to Fahrenheit
  • Eliminate data outliers
  • Convert Fahrenheit to Celsius
  • Calculate hourly max temperature
  • Replace missing values in data

With MATLAB Visualizations, we made it way easier to chart data from multiple data fields. By selecting the “Wind Velocity” example MATLAB Visualization, I can see a plot of the wind velocity data collected by my weather station.

MATLAB Plot Output on ThingSpeak

Other visualization examples include:

  • View temperature variation over the last 24 hours using a histogram
  • Plot wind velocity over the last hour using a compass plot
  • Understand relative temperature variation
  • Plot data from multiple fields
  • View temperature and pressure levels
  • Visualize relationship between temperature and humidity

Are you looking for an easy way to connect your Arduino or Raspberry Pi devices to ThingSpeak? We have also been working with the MATLAB team at MathWorks on some Hardware Support Packages to help with that. I’ll talk about that in a future blog!

This is really big news for the ThingSpeak Community. I am really excited to see what you do with these new apps. I will share projects on the blog as they come in. Let’s find out together what all of this data means. Get started at ThingSpeak.com!


Aug 15

[Kickstarter] nodeIT – Small, Stackable IoT Device

Kickstarter projects pop up all of the time. Developers are looking to raise money for their projects so they can order a larger production run and gauge market reaction. A lot of recent projects are trying to address the “Maker Community” by making it easier to prototype connected devices and sensors. We just found one called, “nodeIT” from Sweden.

nodeIT IoT device on Kickstarter uses ESP8266 and ThingSpeak

The nodeIT is centered around the ESP8266 Wi-Fi microcontroller and allows you stack other boards to extend its base functionality. Once the nodeIT is connected to your Wi-Fi network, you can easily publish data to ThingSpeak and visualize the results, such as data collected by a barometric sensor.

For more information about nodeIT, follow their Kickstarter campaign and check out their ThingSpeak Room Monitor project.

[via Kickstarter]

Aug 15

Collecting Dust Levels with ThingSpeak and ESP8266 Wi-Fi

Using the ESP8266 Wi-Fi module, [shadowandy] built a dust sensor to measure dust levels in his house. The project incorporates the Shinyei PPD42NS dust sensor to do the measurements and posts the data to his ThingSpeak channel from data collection and reaction to dust levels.

Dust Sensor sending data to ThingSpeak

The sensor records the PM10 and PM2.5 dust levels to get an accurate indication of the dust in the air. This project is a great example of how a little sensor could turn into something important for protecting machine shops, construction sites, and garages.

[via shadowandy / GitHub]

Jul 15

Soldering Iron Connected to ThingSpeak with #NodeMCU and #ESP8266 Wi-Fi

[Vegard Paulsen] created a solder iron that reports its usage and temperature to ThingSpeak and alerts him when it was left on. He uses an NodeMCU / ESP8266 Wi-Fi module to collect the data and post it to his ThingSpeak channel. Once the data is on ThingSpeak, he is able to send push notifications to his phone using the ThingSpeak React App.

Soldering Iron IoT ThingSpeak

Hackaday.com wrote an article about Vegard’s soldering iron connected to the Internet of Things. Here’s what they had to say:

The data pushes out to the ThingSpeak server which handles pushing data out to the bigger network, and data representation (like the cool Google gauge…). The best part: [Vegard] gets a phone notification when he accidentally leaves his soldering iron on. How perfect is that?

That looks a lot like our desks… wires, microcontrollers, pliers, cutters, Wi-Fi modules, and soldering irons. And now, the soldering iron is on the Internet of Things.

[via Vegard Paulsen / Hackaday.com]

Jul 15

Basement Dehumidifier Tweets Its Humidity with ThingSpeak and ESP8266 Wi-Fi

ThingSpeak user, Spencer, adapted a humidifier that sits in his basement. He is solving a common issue about humid basements. If your dehumidifier fails, you get wet things you have stored and then mold. Spencer created a humidity board using the DHT22 that measures humidity and then reports the data to his ThingSpeak Channel via the ESP8266 Wi-Fi module. Once the data is stored in ThingSpeak, he uses ThingSpeak React to update Twitter when things get out of whack.

Basement Dehumidifier Twitter

[via Twitter]