Use MATLAB ‘timetable’ to Merge ThingSpeak Data Channels

We released a new version of MATLAB® and it’s available now for every ThingSpeak user. MATLAB R2016b includes many new features that make it easy to work with time-stamped tabular data, manipulate, compare, and store text data efficiently, and find, fill, and remove missing data.

With multiple sensors around my house or office, I want to be able to send data to multiple ThingSpeak channels. But, when I want to perform data analysis, I have a hard time working with data from multiple channels. The channels do not have the same time stamps and are out-of-sync with each other.

With R2016b of MATLAB, I am able to use the new timetable data container. Once the data is a stored as a timetable, I can perform powerful operations such as retime, synchronize, and rmmissing.

In this example, I have two sensors outside of my office here in Natick, MA. One sensor is a temperature sensor that is sending data to ThingSpeak channel 163540. My other sensor is writing humidity data to channel 163545. Both channels are public. My goal is to plot temperature versus humidity over one time series. To accomplish this, I will use timetable and synchronize inside of a new MATLAB Visualization on ThingSpeak.

% Read from the temperature channel
temperatureTT = thingSpeakRead(163540,'Fields',1,'NumPoints',100,'outputFormat','timetable');

% Read from the humidity channel
humidityTT = thingSpeakRead(163545,'Fields',1,'NumPoints',100,'outputFormat','timetable');

% Synchronize two timestables and fill in missing data using linear interpolation
TT = synchronize(temperatureTT,humidityTT,'union','linear')

% Plot Temperature and Humidity over time
title('Temperature and Humidity Synchronized From Two Channels')
xlabel('Temperature and Humidity in Natick, MA')

The first part of the script reads in ThingSpeak data from two different channels and stores the data in two timetables. Once the data is stored in a timetable, I am able to take advantage of synchronize. With synchronize, I can combine both timetables with one time series and fill in missing data using linear interpolation. This results in a plot that shows my data over time without any missing data. To create the plot, I signed into ThingSpeak, selected Apps, and created a new MATLAB Visualization with my MATLAB code.

All ThingSpeak users are able to try this example or explore the other new MATLAB features directly on ThingSpeak. I will leave my temperature (163540) and humidity (163545) channels public, so you can try out timetable example without having to connect devices to ThingSpeak.

Schedule MATLAB Code with TimeControl

Here at our headquarters we have a weather station collecting lots of weather data and sending it to ThingSpeak. We have made that data public for use in your own projects.

MathWorks Weather Station

We write the temperature and humidity values from the weather station to a ThingSpeak channel. At some point in the project, we started to wonder about dew point calculations. We wrote some MATLAB code that combined the temperature and humidity to calculate dew point. I did this using the ThingSpeak app, “MATLAB Analysis”. You can try this out with ThingSpeak now by signing in, selecting Apps, MATLAB Analysis, New, selecting “Calculate Dew point”, and clicking “Create”. This happens to be one of our built-in examples using our weather station’s public data.

It is great that it was easy to calculate dew point with MATLAB, but I want to see this analyzed data over time just like any other sensor data. The solution is a powerful combination of MATLAB Analysis and TimeControl. We use MATLAB Analysis to do the analysis and write the data to a ThingSpeak channel. Then, we use the TimeControl app to repeat the analysis every 5 minutes.

To setup MATLAB Analysis on a schedule, sign into ThingSpeak, select Apps, TimeControl, and New TimeControl.

Dew Point TimeControl in ThingSpeak

My MATLAB code now runs every 5 minutes doing analysis and writing data to my ThingSpeak channel. The TimeControl settings can be tailored to your needs such as executing MATLAB code once a day or only on weekends. This combination of MATLAB Analysis + TimeControl allows you to create continuous analysis of your project data.

To try this out for yourself, we have a public channel of weather station data that we have collected in Natick, MA at our headquarters. You can use that data and do your own MATLAB Analysis and writing the results back to your own channel. Also, Check out the ThingSpeak Documentation where we have a complete tutorial for you to help get started with ThingSpeak and MATLAB.

[Instructables] Wi-Fi Temperature Data Logger

[noel portugal] is at it again! This time Noel created a simple Wi-Fi based sensor data logger using ThingSpeak, the ESP8266 Wi-Fi module, and a digital temperature sensor. At the heart of the project is a low-cost Wi-Fi module that could be the basis for many Internet of Things projects.

ThingSpeak WiFi Temperature Logger

Everything you need to know in order to build your own sensor logging project is on Noel’s Instructables.

[via Instructables]

Battery-powered Temperature Logger with ThingSpeak + Electric Imp

[Marcus Olsson] of slickstreamer made a battery-powered temperature logger using ThingSpeak to store and visualize the data collected. He chose the Electric Imp Wi-Fi module for connectivity. The project is complete with a 3D printed case.

ThingSpeak Electric Imp Temperature Logger

All of the source code to connect Electric Imp to ThingSpeak and the 3D printer design files are available on Marcus’ blog ‘slickstreamer‘.

[slickstreamer / Dangerous Prototypes]

Store, Share, and Visualize Sensor Data using the BrickPi, Raspberry Pi, and ThingSpeak

Dexter Industries launched a very successful Kickstarter campaign this past summer to build and release the BrickPi. The BrickPi turns the Raspberry Pi computer into a robotics and sensing platform for LEGO® MINDSTORMS®. Since the wrap up of the campaign, users have jumped on board making cool projects using the BrickPi including a step-by-step tutorial using ThingSpeak to store, share, and visualize sensor data.

BrickPi Weather Station using ThingSpeak and the Raspberry Pi

Check out the tutorial, “ThingSpeak Temperature with Raspberry Pi“, to learn how to send sensor data using the BrickPi, a Raspberry Pi computer, and a temperature sensor for the LEGO® MINDSTORMS® NXT. The project uses ThingSpeak to store, share, and visualize sensor data collected by BrickPi-enabled projects. The Python code for the Raspberry Pi is available on GitHub and the entire project is open source!

[via  Dexter Industries]

Solar-powered Temperature Logger with Electric Imp and ThingSpeak

[Marcus Olsson] from Slickstreamer created a solar-powered temperature logger using the Electric Imp Wi-Fi module to push data up to ThingSpeak to store and visualize the data collected by his sensors. Marcus provides a parts list and a how-to on his blog. The temperature sensor, solar panel, and solar charger are all readily available parts from Adafruit.

Electric Imp Temperature  Logger with ThingSpeak

Looking over the code for the Electric Imp, it looks pretty easy to cross-clouds from the Imp to ThingSpeak. Check out the source code on GitHub and full details on Slickstreamer.

[via Slickstreamer]

Another Winner… @SmartThings to ThingSpeak with Python #iot #contest

Here’s another contest winner for Internet of Things Contest (aka The Easiest Contest Ever) – Part 2:

For more information and Python source code, visit MY NERD JOURNAL.


Indoor Environmental Quality Station #arduino #thingspeak #instructables

[donmatito] created an Indoor Environmental Quality Station based on the Arduino platform and uses Bluetooth for connectivity to ThingSpeak cloud services. The great news is that Don completely documented the project at Instructables for others to learn from and add to. By using ThingSpeak he has made it easy to get access to the data with an app and share the data with other users.

ThingSpeak Air Quality Monitor

Indoor Environmental Quality (IEQ) is the measure of comfort and includes factors such as temperature, humidity, pressure, noise level, and indoor air quality. don’s original goal was to monitor the IEQ of his baby’s room, but he soon realized that his project has more applications around the house and for others.

Don published the full details of the project and submitted it to the Green Design Contest at Instructables. Great work!

[via Instructables]

Solar Hot Water Temperature Monitoring with Arduino + ThingSpeak

Here’s another “Klink Family Adventure”. The Klink’s created a solar water heater monitor using an Arduino connected to multiple waterproof DS18B20 temperature sensors. What’s great about this project is that it has the complete schematic and source code for interfacing multiple sensors to ThingSpeak at the same time. This is a common request in the ThingSpeak forum, so we are glad to see the code in the wild. The application is great. Monitoring the yield of a solar water heating system allows you to keep track of efficiency and savings.

Here’s what the temperature looks like now in Australia:

Check out the family’s blog for the source code and to learn how to create your own solar water heater monitoring system.

[via Klink Family Adventures]

Smart Home Project with ThingSpeak, Arduino, chipKIT, and Drupal

Via Twitter, we caught wind of a project by a group of Rutgers University SCI ITI students. As their final project, the team built a working model of a smart home using sensors connected to ThingSpeak cloud services via Arduino and chipKit. They were able to embed their data and integrate with their Drupal-based website and show a live demonstration of the smart house. Lots of cool technology went into their project including a small scale model complete with balsa wood and Popsicle sticks. This proved to be a great way to show how their project works with other students and faculty.

This video that we discovered on YouTube is the team’s presentation. You will get to see ThingSpeak in action, live in front of an audience about halfway thru…

We hope you got an “A” on the project (do they still give letter grades?)!