ThingSpeak IoT Blog

Organize Your ThingSpeak IoT Channels with Tags!


I am excited to announce a number of new features that are available to all ThingSpeak users. We added the ability for ThingSpeak channels to be organized by tags. ThingSpeak channels have a “tags” setting that allows you to enter some tags separated by a comma. I use them to organize my channels by a project identifier. In some of my projects, I need a few channels to represent the system. By tagging both channels with the same project identifier, I can see the related channels. We have added a search box to help you search by tags. You can also click on a tag within your channel list to see only the channels that match.

We also added support for tags within the ThingSpeak User API. Just pass the same tag into the API call to ThingSpeak, and you will receive a list of channels that match. This is really useful for integrating ThingSpeak into enterprise systems and for automating channel creation by deployed devices.

All of the tag-related features are available today to all ThingSpeak users!

Discussions About How to Use MATLAB and Arduino on the MATLAB Maker Community


As most of you know I love building IoT projects. Most of these maker projects use an Arduino, Particle, or Raspberry Pi, like my IR color-changing robot that connects to ThingSpeak and the CheerLights project.

I recently became the moderator of the MATLAB Maker Community that is hosted on MATLAB Central. There are many times where MATLAB and Simulink can help build a hardware-based project or be used to create the code running on a device. I also use MATLAB for analytics. Here are the most popular colors on CheerLights in the last 30 days.

The goal of the MATLAB Maker Community is to connect makers and builders together. I learn by working with others and sharing my work. If you are interested in maker project, I suggest following the Maker Community and jumping in on conversations or starting new discussions. I find this helpful if I am exploring a new idea or looking for feedback.

Right now, there is a discussion thread about how to use MATLAB to interface and interact with an Arduino. Makers can use MATLAB to control an Arduino by first installing the MATLAB® Support Package for Arduino®. Once you have the support package, you can use MATLAB to control the Arduino with familiar MATLAB commands.

% create an Arduino object
a = arduino('com3', 'uno');
% turn on an LED connected to Pin D11
writeDigitalPin(a, 'D11', 1);
% turn off an LED connected to Pin D11
writeDigitalPin(a, 'D11', 0);

Share your ideas on how to use the MATLAB connection to Arduino on the MATLAB Maker Community.

Join Us at the MIT Connected Things Conference


Join the MathWorks and ThingSpeak IoT team at the MIT Connected Things 2018 conference held at the MIT Media Lab on April 5, 2018. MathWorks is proud to be a sponsor for a second year and we are looking forward to sharing our IoT solutions. We have tools for every part of the IoT workflow — everything from edge analytics to cloud analytics.

Randy Cronk, a volunteer at the MIT Enterprise Forum of Cambridge, sits down with Eric Wetjen of MathWorks and interviews him about IoT solutions from MathWorks and our ThingSpeak IoT Analytics platform. Check out the interview on the Connected Things blog.

Learn How to Build a Condition Monitoring IoT System


Douglas Mawrey created a Smart Humidity Sensor using ThingSpeak to collect data, MATLAB to analyze the data, and IFTTT to send push notifications for certain conditions. This project uses the outdoor temperature to determine the ideal indoor humidity and inform you about the room’s comfort. The data and condition results are displayed on Douglas’ public ThingSpeak channel 418058. This project is a good starting point to see the power of the MATLAB integration on ThingSpeak and how to perform real-time condition monitoring.

Setting up the Sensor

This project uses the ESP-based NodeMCU as an IoT gateway to forward sensor data to ThingSpeak. The NodeMCU is essentially a microcontroller and a Wi-Fi device that costs less than $10 US. The humidity sensor that is used in this project is the DHT11. This a very common sensor used to monitor temperature and humidity. The sensor either comes in a 4 pin or 3 pin package. The NodeMCU is programmed with the Arduino IDE using the code in Douglas’ tutorial or GitHub.

Using ThingSpeak Metadata

Douglas uses the metadata setting within a ThingSpeak channel to store condition ranges. This allows you to adjust settings in your online analytics code without redeploying new code. Each ThingSpeak channel has a metadata setting. You can store arbitrary text data that can be used in your MATLAB Analysis code. To load your channel’s metadata into MATLAB, use the webread function and add metadata=true to the ThingSpeak API Read Data request.

indoorChannelData = webread(strcat('https://api.thingspeak.com/channels/', ...
                                    num2str(indoorChannelID), ...
                                    '/feeds.json?metadata=true&api_key=', ...
                                    indoorChannelReadKey));

Using MATLAB for Condition Monitoring

Douglas uses MATLAB on ThingSpeak to determine the proper condition. This is a common requirement in complex IoT systems. This example could be a good starting point for building a condition monitoring system for industrial maintenance applications. You use MATLAB to determine the target humidity using a polynomial fit over the lookup data.

lookupFit = polyfit(humidityLookup(:, 1), humidityLookup(:, 2), length(humidityLookup) - 1);
optimalHumidity = polyval(lookupFit, curTempOut);

humidityDiff = curHumidity - optimalHumidity;

Using IFTTT for Alerts

Often you want to get notifications when a certain condition is met. Douglas shows you how to use IFTTT to send push notification directly to your phone. In this project, MATLAB is determining the condition and then interfaces with the IFTTT API to send the push notification. To send push notifications via IFTTT, use the webwrite function in MATLAB.

webwrite(strcat('https://maker.ifttt.com/trigger/', makerEvent, ...
                '/with/key/', makerKey), ...
                'value1', stateMsg, ...
                'value2', char(timeSinceChange, 'hh:mm'));

All of the MATLAB code can be deployed on ThingSpeak and scheduled to be executed periodically without having this on your desktop computer. The complete Smart Humidity Sensor project tutorial is available on Hackster.io. Feel free to discuss on the MATLAB Maker Community.

What is a Bomb Cyclone? Use ThingSpeak and MATLAB to Figure it Out.


Social media is blowing up the term bomb cyclone. The term is everywhere from Twitter to 24/7 news coverage of the storm hitting the East Coast of the United States. The technical term for a bomb cyclone is bombogenesis which is the combination of “bomb” and “cyclogenesis.” Or, you could call it an explosive cyclogenesis to grab views to your blog.

A storm undergoes bombogenesis when its central low pressure drops at least 24 millibars in 24 hours, according to the National Oceanic and Atmospheric Administration (NOAA).

At the MathWorks headquarters in Natick, MA we have a weather station sending data to ThingSpeak for the past several years. Here’s what the weather station looks like on a better day.

Not many interesting events emerge from the data, but with something called a bomb cyclone, Rob Purser decided to take a closer look using MATLAB. Our weather station on ThingSpeak channel 12397 collects temperature, humidity, and pressure data. By taking a look at this MATLAB plot of the pressure analyzed over 24 hours, you will see the pressure drops at least 24 millibars in 24 hours and in fact over 40 millibars. This storm definitely fits its name of explosive cyclogenesis.

Have a look at the raw data from ThingSpeak and see if you can determine the bomb cyclone event. In MATLAB, use thingSpeakRead via the ThingSpeak Support Toolbox. We documented the process of analyzing the weather station data using MATLAB on Hackster.io. Just follow the steps using MATLAB or MATLAB Online, to discover some interesting results.

Stay warm.