Libelium makes the Meshlium IoT Gateway that supports commercial IoT systems and sensor applications such as waste management, forest fire detection, potable water monitoring, supply chain control, and fleet tracking. Libelium now supports ThingSpeak, so that you can take IoT applications to the next level by using ThingSpeak’s integrated MATLAB enabled IoT analytics and visualizations.
ThingSpeak is a MATLAB enabled IoT analytics platform from MathWorks, the leading developer of technical computing software for engineers and scientists. With ThingSpeak, users can view instant visualizations of live data from any Internet-connected web browser and schedule MATLAB code to run live analyses and visualizations as new data arrives. To accelerate the development of IoT analytics, MATLAB offers a full set of statistics and machine learning functionality, plus advanced methods such as nonlinear optimization, system identification, and thousands of prebuilt algorithms for signal and image processing.
Libelium sensors are used in a variety of vertical IoT applications like air quality monitoring and smart agriculture that are also common applications for users of the ThingSpeak platform. “The new integration between the Meshlium IoT Gateway and ThingSpeak will allow our customers with mutual interests to quickly analyze their data in the cloud with MATLAB,” said Eric Wetjen, Senior Product Marketing Manager for ThingSpeak.
The ThingSpeak integration allows you to easily connect your Libelium devices to the ThingSpeak IoT analytics platform by using the ThingSpeak cloud connector, which is built into the Libelium Meshlium IoT gateway. The ThingSpeak cloud connector inside of the Meshlium Manager System creates the ThingSpeak channels needed for your devices and synchronizes the data automatically without writing any custom code.
Check out the MathWorks Hardware Catalog for more information about the Libelium support for ThingSpeak and MATLAB.
We have published an example in the ThingSpeak documentation that shows you how to train a feedforward neural network to predict temperature. The feedforward neural network is one of the simplest types of artificial networks but has broad applications in IoT. Feedforward networks consist of a series of layers. The first layer has a connection from the network input. Each other layer has a connection from the previous layer. The final layer produces the network’s output. In our IoT application, the output will be the predicted temperature.
We are collecting data in a ThingSpeak channel and will use the integrated MATLAB analytics. To predict the temperature, this example makes use of the Neural Network Toolbox in MATLAB along with the data collected in a ThingSpeak channel. We will be using data collected by a weather station located at MathWorks offices in Natick, Massachusetts.
The process for creating, training, and using a feedforward network to predict the temperature is as follows:
- Gather data from the weather station
- Create a two-layer feedforward network
- Train the feedforward network
- Use the trained model to predict data
Read Data from the Weather Station ThingSpeak Channel
ThingSpeak channel 12397 contains data from the MathWorks weather station, located in Natick, Massachusetts. The data is collected once every minute. Fields 2, 3, 4, and 6 contain wind speed (mph), relative humidity, temperature (F), and atmospheric pressure (hg) data respectively. To read the data from the weather station within MATLAB, use the thingSpeakRead function.
data = thingSpeakRead(12397,'Fields',[2 3 4 6],'DateRange',[datetime('Jul 30, 2018'),datetime('Jul 31, 2018')],... 'outputFormat','table');
Create Two-Layer Feedforward Network
Use the feedforwardnet function to create a two-layer feedforward network. The network has one hidden layer with 10 neurons and an output layer.
net = feedforwardnet(10);
Train the Feedforward Network
Use the train function to train the feed-forward network.
[net,tr] = train(net,inputs,targets);
Use the Trained Model to Predict Data
After the network is trained and validated, you can use the network object to calculate the network response to any input.
output = net(inputs(:,5))
output = 74.9756
This example can be adapted to other IoT applications. Check out the ThingSpeak documentation for the code and explanation.
The ThingSpeak IoT has been building a new framework to support widgets on channel views. Widgets can be added to the public or private view of a ThingSpeak channel and even be embedded in 3rd-party systems and dashboards. The first widget that we are releasing is the gauge!
At the recent Boston TechJam, MathWorks had a ThingSpeak People Counter that used face detection to count people that came over to our booth and learned about our demo. The people counter uses MATLAB to identify faces in a live video stream from a webcam, count the number of faces, and send the results to ThingSpeak. The code and instructions for the ThingSpeak People Counter project are on File Exchange.
Now that we have the infrastructure for widgets on ThingSpeak, we can more widget types. What other widgets would you like to see on ThingSpeak?
The ThingSpeak team has integrated the Predictive Maintenance Toolbox for MATLAB into the IoT Analytics features of ThingSpeak. The Predictive Maintenance Toolbox provides tools for labeling data, designing condition indicators, and estimating the remaining useful life (RUL) of a machine. You can analyze and label machine data imported from local files, cloud storage, and distributed file systems. You can also label simulated failure data generated from Simulink models.
Here is a quick list of features of the Predictive Maintenance Toolbox for MATLAB:
- Survival, similarity, and time-series models for remaining useful life (RUL) estimation
- Time, frequency, and time-frequency domain feature extraction methods for designing condition indicators
- Organizing sensor data imported from local files, Amazon S3, Windows Azure® Blob Storage, and Hadoop®Distributed File System
- Organizing simulated machine data from Simulink® models
- Examples of developing predictive maintenance algorithms for motors, gearboxes, batteries, and other machines
The Predictive Maintenance Toolbox is available on ThingSpeak to users that have a license to the toolbox. Just sign into ThingSpeak using your MathWorks Account and you will have access to the features of the Predictive Maintenance Toolbox with the MATLAB Analytics app. If you have any questions about the Predictive Maintenance Toolbox, contact Aditya Baru at MathWorks.
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!