Hans on IoT

ThingSpeak, MATLAB, and the Internet of Things

Edit ThingSpeak Code Easier in MATLAB Online

If you want to upgrade your ThingSpeak capabilities, have a look at the ThingSpeak repository of template codes that open in MATLAB Online. ThingSpeak has MATLAB built in to make it easy to analyze and visualize your data, but the text window for MATLAB analysis and MATLAB visualizations can be tricky to use. Imagine you wanted to peek at your variables while the code was running, step through the code, or get any of the standard benefits that come from using a development environment. You can use MATLAB Online to edit and test your MATLAB code before using it in ThingSpeak.

To try it out, follow any of the links in the ThingSpeak GitHub repo. The template links will automatically take you to MATLAB Online and open the file for you to edit. You can also create your own GitHub repositories that have links to open in MATLAB online. You can read the instructions on how to create these links; the page even includes a form to build the link for you using a few inputs.

If you find yourself wanting some advanced analysis on your IoT data (as I often do), or perhaps you want to set up automated analysis and reporting of the status of your data, use ThingSpeak’s integration with MATLAB. Try these:

  • Automatically calculate the weekly average of your data
  • Send email alerts when a particular condition is met
  • Compare data from multiple sensors or channels (devices)
  • Trigger actions based on channel data (such as activating a cooling fan)

Three-day temperature comparison example

Let’s say you wanted to make this cool three-day temperature comparison with ThingSpeak data using MATLAB. 

Three day temperature comparison chart in MATLAB

  1. Click here to open the template code in MATLAB Online.
  2. Customize the code for your ThingSpeak channel, or leave it as is.
  3. Click run.

Using MATLAB Online with GitHub is just one example of how you can leverage the power of MATLAB to improve your ThingSpeak IoT projects. With its advanced features and user-friendly interface, MATLAB Online is a valuable tool for anyone working with IoT data and analytics.

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.