• Stars
    star
    438
  • Rank 99,453 (Top 2 %)
  • Language
    C++
  • Created over 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ThingSpeak Communication Library for Arduino, ESP8266 and ESP32

ThingSpeak Communication Library for Arduino, ESP8266 and ESP32

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 MATLAB analytics and visualization.

Hardware specific examples are found here. But to give you an idea of usage examples for writing and reading with an ESP8266 are shown below. Complete documentation in also shown below.

ThingSpeak offers free data storage and analysis of time-stamped numeric or alphanumeric data. Users can access ThingSpeak by visiting http://thingspeak.com and creating a ThingSpeak user account.

ThingSpeak stores data in channels. Channels support an unlimited number of timestamped observations (think of these as rows in a spreadsheet). Each channel has up to 8 fields (think of these as columns in a speadsheet). Check out this video for an overview.

Channels may be public, where anyone can see the data, or private, where only the owner and select users can read the data. Each channel has an associated Write API Key that is used to control who can write to a channel. In addition, private channels have one or more Read API Keys to control who can read from private channel. An API Key is not required to read from public channels. Each channel can have up to 8 fields. One field is created by default.

You can visualize and do online analytics of your data on ThingSpeak using the built in version of MATLAB, or use the desktop version of MATLAB to get deeper historical insight. Visit https://www.mathworks.com/hardware-support/thingspeak.html to learn more.

Libraries and examples for Particle devices can be found here: https://github.com/mathworks/thingspeak-particle

Installation

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

--- or ---

  1. Download the ZIP file (below) to your machine.
  2. In the Arduino IDE, choose Sketch/Include Library/Add Zip Library
  3. Navigate to the ZIP file, and click Open

Compatible Hardware:

  • Arduino/Genuino or compatible using a WiFi Shield
  • Arduino/Genuino or compatible using a WiFi Shield 101 (Use the WiFi101 library version 0.13.0 or older.)
  • Arduino/Genuino or compatible using an Ethernet Shield
  • Arduino/Genuino or compatible using a MKR ETH Shield
  • Arduino MKR1000
  • Arduino MKR1010
  • Arduino VIDOR 4000
  • Arduino GSM 14000
  • Arduino Uno WiFi Rev2
  • Arduino Yún (Rev1 and Rev2)
  • ESP8266 programming directly (tested with SparkFun ESP8266 Thing - Dev Board and NodeMCU 1.0 module)
  • ESP8266 via AT commands
  • ESP32 (tested with SparkFun ESP32 Thing)

Examples

The library includes several examples organized by board type to help you get started. These are accessible in Examples > ThingSpeak menu of the Arduino IDE.

  • ReadField: Reading from a public channel and a private channel on ThingSpeak.
  • WriteSingleField: Writing a value to a single field on ThingSpeak.
  • WriteMultipleFields: Writing values to multiple fields and status in one transaction with ThingSpeak.
  • ReadMultipleFields: Reading values from multiple fields, status, location, created-at timestamp from a public channel on ThingSpeak
  • SecureConnect: Using the above features and connecting securely to ThingSpeak.

Typical Write Example

In this case, write to a field with an ESP8266 with an incrementing number.

#include <ESP8266WiFi.h>
#include "secrets.h"
#include "ThingSpeak.h" // always include thingspeak header file after other header files and custom macros

char ssid[] = SECRET_SSID;   // your network SSID (name) 
char pass[] = SECRET_PASS;   // your network password
int keyIndex = 0;            // your network key Index number (needed only for WEP)
WiFiClient  client;

unsigned long myChannelNumber = SECRET_CH_ID;
const char * myWriteAPIKey = SECRET_WRITE_APIKEY;

int number = 0;

void setup() {
  Serial.begin(115200);  // Initialize serial
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  
  WiFi.mode(WIFI_STA); 
  ThingSpeak.begin(client);  // Initialize ThingSpeak
}

void loop() {

  // Connect or reconnect to WiFi
  if(WiFi.status() != WL_CONNECTED){
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(SECRET_SSID);
    while(WiFi.status() != WL_CONNECTED){
      WiFi.begin(ssid, pass);  // Connect to WPA/WPA2 network. Change this line if using open or WEP network
      Serial.print(".");
      delay(5000);     
    } 
    Serial.println("\nConnected.");
  }
  
  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
  // pieces of information in a channel.  Here, we write to field 1.
  int x = ThingSpeak.writeField(myChannelNumber, 1, number, myWriteAPIKey);
  if(x == 200){
    Serial.println("Channel update successful.");
  }
  else{
    Serial.println("Problem updating channel. HTTP error code " + String(x));
  }

  // change the value
  number++;
  if(number > 99){
    number = 0;
  }
  
  delay(20000); // Wait 20 seconds to update the channel again
}

Typical Read Example

In this case, read from a public channel and a private channel with an ESP8266. The public channel is the temperature(F) at MathWorks headquarters. The private channel is a counter that increments.

#include <ESP8266WiFi.h>
#include "secrets.h"
#include "ThingSpeak.h" // always include thingspeak header file after other header files and custom macros

char ssid[] = SECRET_SSID;   // your network SSID (name) 
char pass[] = SECRET_PASS;   // your network password
int keyIndex = 0;            // your network key Index number (needed only for WEP)
WiFiClient  client;

// Weather station channel details
unsigned long weatherStationChannelNumber = SECRET_CH_ID_WEATHER_STATION;
unsigned int temperatureFieldNumber = 4;

// Counting channel details
unsigned long counterChannelNumber = SECRET_CH_ID_COUNTER;
const char * myCounterReadAPIKey = SECRET_READ_APIKEY_COUNTER;
unsigned int counterFieldNumber = 1; 

void setup() {
 Serial.begin(115200);  // Initialize serial
 while (!Serial) {
   ; // wait for serial port to connect. Needed for native USB port only
 }
 
 WiFi.mode(WIFI_STA); 
 ThingSpeak.begin(client);  // Initialize ThingSpeak
}

void loop() {

 int statusCode = 0;
 
 // Connect or reconnect to WiFi
 if(WiFi.status() != WL_CONNECTED){
   Serial.print("Attempting to connect to SSID: ");
   Serial.println(SECRET_SSID);
   while(WiFi.status() != WL_CONNECTED){
     WiFi.begin(ssid, pass); // Connect to WPA/WPA2 network. Change this line if using open or WEP network
     Serial.print(".");
     delay(5000);     
   } 
   Serial.println("\nConnected");
 }

 // Read in field 4 of the public channel recording the temperature
 float temperatureInF = ThingSpeak.readFloatField(weatherStationChannelNumber, temperatureFieldNumber);  

 // Check the status of the read operation to see if it was successful
 statusCode = ThingSpeak.getLastReadStatus();
 if(statusCode == 200){
   Serial.println("Temperature at MathWorks HQ: " + String(temperatureInF) + " deg F");
 }
 else{
   Serial.println("Problem reading channel. HTTP error code " + String(statusCode)); 
 }
 
 delay(15000); // No need to read the temperature too often.

 // Read in field 1 of the private channel which is a counter  
 long count = ThingSpeak.readLongField(counterChannelNumber, counterFieldNumber, myCounterReadAPIKey);  

  // Check the status of the read operation to see if it was successful
 statusCode = ThingSpeak.getLastReadStatus();
 if(statusCode == 200){
   Serial.println("Counter: " + String(count));
 }
 else{
   Serial.println("Problem reading channel. HTTP error code " + String(statusCode)); 
 }
 
 delay(15000); // No need to read the counter too often.
 
}

Documentation

begin

Initializes the ThingSpeak library and network settings, whether performing a secure connection or a normal connection to ThingSpeak.

bool begin (client) // defaults to ThingSpeak.com
Parameter Type Description
client Client & TCPClient created earlier in the sketch

Returns

Always returns true. This does not validate the information passed in, or generate any calls to ThingSpeak.

Remarks

use #define TS_ENABLE_SSL before #include <thingspeak.h> so as to perform a secure connection by passing a client that is capable of doing SSL. See the note regarding secure connection below.

writeField

Write a value to a single field in a ThingSpeak channel.

int writeField(channelNumber, field, value, writeAPIKey)
Parameter Type Description
channelNumber unsigned long Channel number
field unsigned int Field number (1-8) within the channel to write to.
value int Integer value (from -32,768 to 32,767) to write.
long Long value (from -2,147,483,648 to 2,147,483,647) to write.
float Floating point value (from -999999000000 to 999999000000) to write.
String String to write (UTF8 string). ThingSpeak limits this field to 255 bytes.
const char * Character array (zero terminated) to write (UTF8). ThingSpeak limits this field to 255 bytes.
writeAPIKey const char * Write API key associated with the channel. If you share code with others, do not share this key

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

Remarks

Special characters will be automatically encoded by this method. See the note regarding special characters below.

writeFields

Write a multi-field update. Call setField() for each of the fields you want to write first.

int writeFields (channelNumber, writeAPIKey)	
Parameter Type Description
channelNumber unsigned long Channel number
writeAPIKey const char * Write API key associated with the channel. If you share code with others, do not share this key

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

Remarks

Special characters will be automatically encoded by this method. See the note regarding special characters below.

writeRaw

Write a raw POST to a ThingSpeak channel.

int writeRaw (channelNumber, postMessage, writeAPIKey)	
Parameter Type Description
channelNumber unsigned long Channel number
postMessage const char * Raw URL to write to ThingSpeak as a String. See the documentation at https://thingspeak.com/docs/channels#update_feed.
String Raw URL to write to ThingSpeak as a character array (zero terminated). See the documentation at https://thingspeak.com/docs/channels#update_feed.
writeAPIKey const char * Write API key associated with the channel. If you share code with others, do not share this key

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

Remarks

This method will not encode special characters in the post message. Use '%XX' URL encoding to send special characters. See the note regarding special characters below.

setField

Set the value of a single field that will be part of a multi-field update.

int setField (field, value)
Parameter Type Description
field unsigned int Field number (1-8) within the channel to set
value int Integer value (from -32,768 to 32,767) to write.
long Long value (from -2,147,483,648 to 2,147,483,647) to write.
float Floating point value (from -999999000000 to 999999000000) to write.
String String to write (UTF8 string). ThingSpeak limits this field to 255 bytes.
const char * Character array (zero terminated) to write (UTF8). ThingSpeak limits this field to 255 bytes.

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

setStatus

Set the status of a multi-field update. Use status to provide additonal details when writing a channel update. Additionally, status can be used by the ThingTweet App to send a message to Twitter.

int setStatus (status)	
Parameter Type Description
status const char * String to write (UTF8). ThingSpeak limits this to 255 bytes.
String const character array (zero terminated). ThingSpeak limits this to 255 bytes.

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

setLatitude

Set the latitude of a multi-field update.

int setLatitude	(latitude)	
Parameter Type Description
latitude float Latitude of the measurement (degrees N, use negative values for degrees S)

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

setLongitude

Set the longitude of a multi-field update.

int setLongitude (longitude)	
Parameter Type Description
longitude float Longitude of the measurement (degrees E, use negative values for degrees W)

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

setElevation

Set the elevation of a multi-field update.

int setElevation (elevation)	
Parameter Type Description
elevation float Elevation of the measurement (meters above sea level)

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

setCreatedAt

Set the created-at date of a multi-field update. The timestamp string must be in the ISO 8601 format. Example "2017-01-12 13:22:54"

int setCreatedAt (createdAt)
Parameter Type Description
createdAt String Desired timestamp to be included with the channel update as a String.
const char * Desired timestamp to be included with the channel update as a character array (zero terminated).

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

Remarks

Timezones can be set using the timezone hour offset parameter. For example, a timestamp for Eastern Standard Time is: "2017-01-12 13:22:54-05". If no timezone hour offset parameter is used, UTC time is assumed.

setTwitterTweet

Set the Twitter account and message to use for an update to be tweeted.

int setTwitterTweet	(twitter, tweet)	
Parameter Type Description
twitter String Twitter account name as a String.
const char * Twitter account name as a character array (zero terminated).
tweet String Twitter message as a String (UTF-8) limited to 140 character.
const char * Twitter message as a character array (zero terminated) limited to 140 character.

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

Remarks

Prior to using this feature, a twitter account must be linked to your ThingSpeak account. To link your twitter account. login to ThingSpeak and go to Apps -> ThingTweet and click Link Twitter Account.

readStringField

Read the latest string from a channel. Include the readAPIKey to read a private channel.

String readStringField (channelNumber, field, readAPIKey)	
String readStringField (channelNumber, field)	
Parameter Type Description
channelNumber unsigned long Channel number
field unsigned int Field number (1-8) within the channel to read from.
readAPIKey const char * Read API key associated with the channel. If you share code with others, do not share this key

Returns

Value read (UTF8 string), or empty string if there is an error.

readFloatField

Read the latest float from a channel. Include the readAPIKey to read a private channel.

float readFloatField (channelNumber, field, readAPIKey)	
float readFloatField (channelNumber, field)	
Parameter Type Description
channelNumber unsigned long Channel number
field unsigned int Field number (1-8) within the channel to read from.
readAPIKey const char * Read API key associated with the channel. If you share code with others, do not share this key

Returns

Value read, or 0 if the field is text or there is an error. Use getLastReadStatus() to get more specific information. Note that NAN, INFINITY, and -INFINITY are valid results.

readLongField

Read the latest long from a channel. Include the readAPIKey to read a private channel.

long readLongField (channelNumber, field, readAPIKey)	
long readLongField (channelNumber, field)	
Parameter Type Description
channelNumber unsigned long Channel number
field unsigned int Field number (1-8) within the channel to read from.
readAPIKey const char * Read API key associated with the channel. If you share code with others, do not share this key

Returns

Value read, or 0 if the field is text or there is an error. Use getLastReadStatus() to get more specific information.

readIntField

Read the latest int from a channel. Include the readAPIKey to read a private channel.

int readIntField (channelNumber, field, readAPIKey)		
int readIntField (channelNumber, field)		
Parameter Type Description
channelNumber unsigned long Channel number
field unsigned int Field number (1-8) within the channel to read from.
readAPIKey const char * Read API key associated with the channel. If you share code with others, do not share this key

Returns

Value read, or 0 if the field is text or there is an error. Use getLastReadStatus() to get more specific information. If the value returned is out of range for an int, the result is undefined.

readStatus

Read the latest status from a channel. Include the readAPIKey to read a private channel.

String readStatus (channelNumber, readAPIKey)	
String readStatus (channelNumber)
Parameter Type Description
channelNumber unsigned long Channel number
readAPIKey const char * Read API key associated with the channel. If you share code with others, do not share this key

Returns

Returns the status field as a String.

String readCreatedAt()

Read the created-at timestamp associated with the latest update to a channel. Include the readAPIKey to read a private channel.

String readCreatedAt (channelNumber, readAPIKey)
String readCreatedAt (channelNumber)	
Parameter Type Description
channelNumber unsigned long Channel number
readAPIKey const char * Read API key associated with the channel. If you share code with others, do not share this key

Returns

Returns the created-at timestamp as a String.

readRaw

Read a raw response from a channel. Include the readAPIKey to read a private channel.

String readRaw (channelNumber, URLSuffix, readAPIKey)	
String readRaw	(channelNumber, URLSuffix)
Parameter Type Description
channelNumber unsigned long Channel number
URLSuffix String Raw URL to write to ThingSpeak as a String. See the documentation at https://thingspeak.com/docs/channels#get_feed
readAPIKey const char * Read API key associated with the channel. If you share code with others, do not share this key.

Returns

Returns the raw response from a HTTP request as a String.

readMultipleFields

Read all the latest fields, status, location, and created-at timestamp; and store these values locally. Use getField functions mentioned below to fetch the stored values. Include the readAPIKey to read a private channel.

int readMultipleFields (channelNumber, readAPIKey)
int readMultipleFields (channelNumber)
Parameter Type Description
channelNumber unsigned long Channel number
readAPIKey const char * Read API key associated with the channel. If you share code with others, do not share this key

Returns

HTTP status code of 200 if successful. See Return Codes below for other possible return values.

Remarks

This feature not available in Arduino Uno due to memory constraints.

getFieldAsString

Fetch the stored value from a field as String. Invoke this after invoking readMultipleFields.

String getFieldAsString (field)
Parameter Type Description
field unsigned int Field number (1-8) within the channel to read from.

Returns

Value read (UTF8 string), empty string if there is an error, or old value read (UTF8 string) if invoked before readMultipleFields(). Use getLastReadStatus() to get more specific information.

Remarks

This feature not available in Arduino Uno due to memory constraints.

getFieldAsFloat

Fetch the stored value from a field as Float. Invoke this after invoking readMultipleFields.

float getFieldAsFloat (field)
Parameter Type Description
field unsigned int Field number (1-8) within the channel to read from.

Returns

Value read, 0 if the field is text or there is an error, or old value read if invoked before readMultipleFields(). Use getLastReadStatus() to get more specific information. Note that NAN, INFINITY, and -INFINITY are valid results.

Remarks

This feature not available in Arduino Uno due to memory constraints.

getFieldAsLong

Fetch the stored value from a field as Long. Invoke this after invoking readMultipleFields.

long getFieldAsLong (field)
Parameter Type Description
field unsigned int Field number (1-8) within the channel to read from.

Returns

Value read, 0 if the field is text or there is an error, or old value read if invoked before readMultipleFields(). Use getLastReadStatus() to get more specific information.

Remarks

This feature not available in Arduino Uno due to memory constraints.

getFieldAsInt

Fetch the stored value from a field as Int. Invoke this after invoking readMultipleFields.

int getFieldAsInt (field)
Parameter Type Description
field unsigned int Field number (1-8) within the channel to read from.

Returns

Value read, 0 if the field is text or there is an error, or old value read if invoked before readMultipleFields(). Use getLastReadStatus() to get more specific information.

Remarks

This feature not available in Arduino Uno due to memory constraints.

getLastReadStatus

Get the status of the previous read.

int getLastReadStatus ()	

Returns

See Return Codes below for other possible return values.

Return Codes

Value Meaning
200 OK / Success
404 Incorrect API key (or invalid ThingSpeak server address)
-101 Value is out of range or string is too long (> 255 characters)
-201 Invalid field number specified
-210 setField() was not called before writeFields()
-301 Failed to connect to ThingSpeak
-302 Unexpected failure during write to ThingSpeak
-303 Unable to parse response
-304 Timeout waiting for server to respond
-401 Point was not inserted (most probable cause is the rate limit of once every 15 seconds)
0 Other error

Secure Connection

Securely connect to ThingSpeak API to use the above features and functionalities.

HTTPS

HTTPS ensures confidentiality as well as authenticity. Confidentiality: SSL Encryption using public-key cryptography. Authenticity: creates "trust", the device knows whether it's connected to the actual api.thingkspeak.com and not a spoof of it.

User Sketch Requirements

Always use #define TS_ENABLE_SSL before #include <thingspeak.h> so as to perform a secure connection. If not, then the default connection would be insecured HTTP.

Confidentiality without Authenticity

Case 1: TS_ENABLE_SSL macro defined + Client capable of doing SSL = Secure HTTPS Connection
Case 2: TS_ENABLE_SSL macro defined + Client not capable of SSL = Defualt HTTP connection with a warning message sent to the user
Case 3: TS_ENABLE_SSL macro undefined + Client capable of doing SSL = Error connecting to ThingSpeak status code returned to user
Case 4: TS_ENABLE_SSL macro undefined + Client not capable of SSL = HTTP connection

Confidentiality + Authenticity

Different client libraries have different methods of performing authenticity.
Some ways: Root Certificate Check, Certificate Fingerprint Check.
Perform the fingerprint and/or certificate check prior to invoking the begin() function.
The certificate has an expiration date associated with it, and hence it's the user's responsibility to fetch the updated certificate for the Confidentiality + Authenticity HTTPS connection to be established.
See the ReadMultipleFieldsSecure example on Fingerprint check HTTPS connection using ESP8266. See the ReadMultipleFieldsSecure example on Root Certificate check HTTPS connection using ESP32.

Special Characters

Some characters require '%XX' style URL encoding before sending to ThingSpeak. The writeField() and writeFields() methods will perform the encoding automatically. The writeRaw() method will not.

Character Encoding
" %22
% %25
& %26
+ %2B
; %3B

Control characters, ASCII values 0 though 31, are not accepted by ThingSpeak and will be ignored. Extended ASCII characters with values above 127 will also be ignored.

More Repositories

1

MATLAB-Simulink-Challenge-Project-Hub

This MATLAB and Simulink Challenge Project Hub contains a list of research and design project ideas. These projects will help you gain practical experience and insight into technology trends and industry directions.
MATLAB
1,188
star
2

awesome-matlab-students

An awesome list of helpful resources for students learning MATLAB & Simulink. List includes tips & tricks, tutorials, videos, cheat sheets, and opportunities to learn MATLAB & Simulink.
MATLAB
298
star
3

MATLAB-extension-for-vscode

This extension provides support for editing MATLAB® code in Visual Studio® Code and includes features such as syntax highlighting, code analysis, navigation support, and more.
TypeScript
237
star
4

jupyter-matlab-proxy

MATLAB Integration for Jupyter enables you to run MATLAB code in Jupyter Notebooks and other Jupyter environments. You can also open MATLAB in a browser directly from your Jupyter environment to use more MATLAB features.
Python
219
star
5

Design-motor-controllers-with-Simscape-Electrical

This repository contains MATLAB and Simulink files used in the "How to design motor controllers using Simscape Electrical" videos.
MATLAB
172
star
6

simulinkDroneReferenceApp

This Simulink Project shows the implementation of a Remotely Piloted Radio-Control fixed-wing aircraft (i.e. Drone, UAV), an autopilot for flight stabilization, and an operator interface to control its trajectory.
C
109
star
7

matlab-with-python

Files demonstrating MATLAB and Python interoperability
Jupyter Notebook
96
star
8

Modeling-TVCd-Rocket-in-Simulink

Code in this repository is discussed in this BPS.Space YouTube video on modeling a thrust vector controlled rocket in Simulink. Thrust Vectoring or Thrust Vector control is the ability of an aircraft or a rocket's propulsion system to manipulate the direction of its thrust to control the rocket or aircrafts attitude or angular velocity.
93
star
9

awesome-matlab-hackathons

This repository is a resource center for hackathon participants! Check out the readme file to find getting started resources and inspiration for your next hack!
89
star
10

MATLAB-language-server

TypeScript
83
star
11

toolboxdesign

Best practices for creating high-quality and user-friendly MATLAB toolboxes, including recommendations for file organization, testing, and releasing the toolbox.
82
star
12

ci-configuration-examples

This repository makes it easy to run your MATLAB tests on some of the most common CI platforms. The configuration files take care of setting up MATLAB and automatically executing your MATLAB tests.
MATLAB
73
star
13

Simscape-Battery-Electric-Vehicle-Model

A Battery Electric Vehicle (BEV) model in Simscape for longitudinal powertrain analysis
HTML
70
star
14

Quadcopter-Drone-Model-Simscape

Quadcopter with multibody, electrical and thermal models follows a path to deliver a package.
MATLAB
68
star
15

AUV-modeling-and-sim

This submission contains the files used in this video on modeling, simulation and control of an Autonomous Underwater vehicle - https://www.mathworks.com/videos/modeling-and-simulation-of-an-autonomous-underwater-vehicle-1586937688878.html. This submission models a 6-DoF autonomous underwater vehicle (AUV) and a position and velocity controller for the AUV. You can switch between low and high fidelity sensor and environment models based on your application needs.
MATLAB
68
star
16

visualization-cheat-sheet

This repo provides a cheat sheet which contains essential tips in creating plots in MATLAB.
64
star
17

msra-walking-robot

Example files for MATLAB and Simulink Robotics Arena walking robot videos.
HTML
63
star
18

matlab-engine-for-python

Python
62
star
19

Battery-Pack-Model-Simscape

Battery pack model for thermal management tasks, with modules of cells in series and parallel.
MATLAB
57
star
20

MATLAB-Live-Task-for-Python

The MATLAB® Live Task for Python® enables you to write and execute Python code directly inside of a MATLAB Live Script.
MATLAB
55
star
21

2D-Lid-Driven-Cavity-Flow-Incompressible-Navier-Stokes-Solver

This repository provides MATLAB code for the lid-driven cavity flow where incompressible Navier Stokes equation is numerically solved using a simple 2nd order finite difference scheme on a staggered grid system.
MATLAB
53
star
22

vehicle-model-predictive-control

This submission contains a model to show the implementation of MPC on a vehicle moving in a US Highway scene.
MATLAB
51
star
23

Simscape-Vehicle-Templates

Set of templates for creating custom vehicle models using Simscape for use within Simulink.
MATLAB
51
star
24

HDL-Coder-Self-Guided-Tutorial

Learn how to deploy an algorithm to an FPGA using MATLAB and Simulink.
MATLAB
45
star
25

jenkins-matlab-plugin

This plugin enables you to run MATLAB® and Simulink® as part of your Jenkins™ build.
Java
44
star
26

Simscape-Multibody-Contact-Forces-Library

Contact force examples and library.
HTML
44
star
27

Simscape-Wind-Turbine

Wind turbine model including blades, nacelle, pitch and yaw actuation, generator and control system.
MATLAB
43
star
28

matlab-proxy

Python® package enables you to open a MATLAB® desktop in a web browser tab.
Python
42
star
29

physionet_ECG_data

This repository contains human electrocardiogram data (ECG) data used in Wavelet Toolbox machine and deep learning examples
42
star
30

MATLAB-Language-grammar

This repository contains a regular expression based language grammar for MATLAB to be used by GitHub Linguist for highlighting MATLAB code on GitHub
MATLAB
42
star
31

Simscape-HEV-Series-Parallel

Model of a parallel-series hybrid-electric vehicle with system-level and detailed variants of electrical system.
MATLAB
37
star
32

Simscape-Hybrid-Electric-Vehicle-Model

A Power-Split Hybrid Electric Vehicle (HEV) model in Simscape
HTML
36
star
33

Industrial-Robots-Simscape

Manipulator and mobile robot models for trajectory planning and actuator analysis.
MATLAB
35
star
34

WindTurbineHighSpeedBearingPrognosis-Data

Data set for Wind Turbine High-Speed Bearing Prognosis example in Predictive Maintenance Toolbox
34
star
35

Fuel-Cell-Vehicle-Model-Simscape

Fuel cell electric vehicle with battery model and cooling system.
MATLAB
34
star
36

Apollo_11_Moon_Landing_-_50th_Anniversary_Model

This example shows how Richard Gran and the other engineers who worked on the Apollo Lunar Module digital autopilot design team could have done it using Simulink®, Stateflow®, Aerospace Blockset™ and Simulink 3D Animation if they had been available in 1961.
MATLAB
33
star
37

how-to-turn-your-script-into-a-simple-app

Demonstration source code for the seminar "How to turn your script into a simple app"
MATLAB
31
star
38

climatedatastore

Climate Data Store Toolbox for MATLAB
MATLAB
30
star
39

quadcopter-simulation-ros-gazebo

Quadcopter control & simulation with ROS, Gazebo and the Robotics System Toolbox
C++
28
star
40

RollingElementBearingFaultDiagnosis-Data

Data set for Rolling Element Bearing Fault Diagnosis example in Predictive Maintenance Toolbox
28
star
41

Simulink-Model-Comparison-for-GitHub-Pull-Requests

Files demonstrating how to diff Simulink models and attach reports to pull requests
MATLAB
28
star
42

OpenTrafficLab

OpenTrafficLab is a MATLAB environment capable of simulating simple traffic scenarios with modular vehicle and junction controllers.
MATLAB
27
star
43

Quantum-Computing-MATLAB

MATLAB examples, functions and otherwise helpful material using the MATLAB Support Package for Quantum Computing
27
star
44

FPGA-Adaptive-Beamforming-and-Radar-Examples

This repository contains FPGA/HDL demonstrations several beamforming and radar designs. Simulink models and MATLAB reference code are provided to showcase high-level simulation and HDL designs of various radar and array processing algorithms.
MATLAB
26
star
45

mpc_implementation_example

当サンプルモデルは、モデル予測制御(MPC)の設計と実装のワークフローを分かりやすく紹介するための資料です。 設計後、コード生成を行い、マイクロコントローラに実装するまでの流れを詳しくまとめています。
MATLAB
25
star
46

Mars-Rover-Terrain-Simscape

Six-wheeled electrically-driven rover that navigates uneven terrain to retrieve a sample.
MATLAB
24
star
47

Simscape-Triplex-Pump

Predictive maintenance algorithm developed using digital twin of hydraulic pump modeled in Simscape
MATLAB
24
star
48

Simscape-Robot-4Legs

Quadruped robot model with electrical actuation, including gait analysis and design workflow.
HTML
24
star
49

buildroot

This buildroot fork contains customized recipes for generating AMD-Xilinx SoC and Intel SoC embedded Linux images for use with MathWorks tools.
C
23
star
50

widgets-toolbox

Additional app building components to efficiently develop advanced user interfaces in MATLAB
MATLAB
22
star
51

Simscape-Essentials-for-Automotive-Student-Teams

The submission introduces a set of models to get the automotive student teams started with physical modeling using Simscape™.
MATLAB
22
star
52

Enigma

MATLAB App for simulating the Enigma encryption machine
MATLAB
21
star
53

deep-traffic-lab

MATLAB
21
star
54

thingspeak-particle

ThingSpeak Communication Library for Particle
C++
21
star
55

Lunar-Mission-Trajectory-Inspired-by-Artemis-I-Mission

Inspired by Orion and the Artemis I mission, this example simulates a lunar mission trajectory in MATLAB and Simulink.
20
star
56

vehicle-modeling

This submission contains a set of models created with Simulink and Powertrain Blockset.
20
star
57

vehicle-pure-pursuit

This submission contains a set of models to show the implementation of a Pure Pursuit controller on a vehicle under different scenarios. About the models: These models show a workflow to implement a Pure Pursuit controller to track a planned path. Steps below describe the workflow: 1. Generating waypoints 2. Formulating required steering angle for lateral control 3. Implementing a longitudinal controller to track the path at higher velocity 4. Visualizing vehicle final path in Bird's-Eye Scope and a 3D simulation environment
MATLAB
19
star
58

Truck-Platooning

Simulink Reference example for modeling smart trucks with the intelligence to form a platoon based on certain criteria.
MATLAB
18
star
59

xilinx-linux

This repository contains Embedded Linux kernel source code for Xilinx devices.
C
17
star
60

Expo-2022-Cleaning-and-Preparing-Time-Series-Data

Contents for "Cleaning and Preparing Time Series Data" talk (MATLAB Expo 2022)
MATLAB
17
star
61

deep-learning-for-time-series-data

The examples showcase two ways of using deep learning for classifying time-series data, i.e. ECG data. The first way is using continuous wavelet transform and transfer learning, whereas the second way is using Wavelet Scattering and LSTMs. The explanations of the code are in Chinese. The used data set can be download on:https://github.com/mathworks/physionet_ECG_data/
17
star
62

Call-Simulink-from-Python

Examples to show the two options to simulate a Simulink model from Python
MATLAB
16
star
63

Climate-IAM-Explorer

MATLAB
16
star
64

model-based-design-dc-dc-converter

Model-Based Design of a DCDC Converter using Simulink, Simscape and Stateflow
MATLAB
16
star
65

build-glibc-bz-19329-patch

This repository provides a Dockerfile and build instructions to apply patch BZ-19329 to glibc
Shell
16
star
66

Awesome-MATLAB-Quant-Finance-

Discover how to leverage MATLAB for quantitative finance modeling
16
star
67

student-competition-code-generation-training

Files for the MATLAB & Simulink Racing Lounge code generation tutorials
C
15
star
68

dotenv-for-MATLAB

Load environment variables from a .env file.
MATLAB
15
star
69

Integrate_Python_code_with_Simulink

MATLAB
14
star
70

FOC-of-PMSM

MATLAB
14
star
71

penrose-tiling

MATLAB functions for Penrose tiling
MATLAB
14
star
72

OpenTelemetry-MATLAB

MATLAB interface to OpenTelemetry
MATLAB
14
star
73

jupyter-matlab-vnc-proxy

Jupyter Integration for MATLAB using VNC
HTML
14
star
74

vehicle-stanley-controller

The submission contains a model to show the implementation of Stanley controller on a vehicle moving in a scene.
MATLAB
14
star
75

matlab-azure-devops-extension

Continuous Integration with MATLAB on Azure DevOps
TypeScript
14
star
76

WordPress_Publishing_Tool

This MATLAB® App provides a fast and easy way for users to publish their MATLAB® live scripts as blog posts to their WordPress sites. What the users type in live script is what the users will see in WordPress.
MATLAB
14
star
77

Simple-Heat-Equation-solver

Simple Heat Equation solver using finite difference method
MATLAB
13
star
78

Time-Series-Forecasting-Simulink

This content shows how to implement time series models provided by Deep Learning Toolbox and Econometrics Toolbox on Simulink model and to update them and forecast value at next time step recursively.
MATLAB
13
star
79

Reinforcement-Learning-Inverted-Pendulum-with-QUBE-Servo2

This is a demo model for Reinforcement Learning Control Design. After designing agent, it is deployed to Raspberry Pi and run real-time hardware.
MATLAB
13
star
80

noaa

Access National Oceanic and Atmospheric Administration (NOAA) Data from MATLAB
MATLAB
13
star
81

SimulinkCoSimulationExample

Examples of Co-Simulation with Simulink
C++
12
star
82

llfs

Low Level File System C++ Library
C++
12
star
83

Fast-Poisson-Equation-Solver-using-DCT

Fast Poisson Equation Solver using Discrete Cosine Transform
MATLAB
11
star
84

robust-matlab-2018

As the size and complexity of your MATLAB® application increases, you want to make sure to structure software projects well, ensuring users can run code without encountering unexpected behaviour or errors, for example. In this talk, you will learn about relevant advanced MATLAB software development capabilities, including error handling, object-oriented programming (OOP), unit testing, version control, and change tracking.
HTML
11
star
85

Simscape-Air-Taxi

Electric and hybrid electric aircraft models for component sizing
MATLAB
11
star
86

Modeling_a_Hybrid_Microgrid

11
star
87

Message-De-Serializer-for-ROS

This project relies on ROS Toolbox functionality to provide basic integration of Simulink® targets, with focus on Simulink Real-Time™ and Speedgoat®, into ROS/ROS2 networks via message serialization.
MATLAB
11
star
88

data-science-predict-weather-events

Explore weather event data and use machine learning to predict the damage costs of storm events based on location, time of year, and type of event
MATLAB
11
star
89

pmsm-drive-optimization

Motor Efficiency Improvements With Optimized Control Parameters
HTML
11
star
90

coder-swig

Examples showing how to use SWIG to wrap MATLAB Coder generated C and C++ code for other languages
MATLAB
11
star
91

Continuous-Integration-Verification-Simulink-Models

This is the example project that is referenced in the Technical Article: Continuous Integration for Verification of Simulink Models. Model-Based Design is used with continuous integration with Jenkins to perform requirements-based testing on an automotive lane-following system.
11
star
92

udacity-self-driving-data-subset

Subset of Udacity Self-Driving Car dataset
10
star
93

Simscape-Medical-Ventilator

Positive-pressure medical ventilator system using Simscape™
MATLAB
10
star
94

requirements-based-testing-example

MATLAB
10
star
95

Simple-Wave-Equation-solver

An example of solving a wave equation using finite difference
10
star
96

Simscape-Multibody-Multiphysics-Library

Extend Simscape Multibody models with physical effects spanning multiple physical domains.
HTML
10
star
97

xilinx-uboot

This repository contains source code for Universal boot loader This repository contains source code for Universal boot loader for use with Xilinx devices.
C
10
star
98

deep-learning-workshop

MATLAB
10
star
99

Simscape-Tutorial-Exercises

Simscape tutorial exercises from hands-on workshop events.
HTML
10
star
100

matlab-codecov-example

Use MATLAB with Codecov
MATLAB
10
star