Thing Speak

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

ThingSpeak

Hans-Petter Halvorsen http://halvorsen.blog


ThingSpeaks
• ThingSpeak is a Web Service (REST API) that lets you collect and
store sensor data in the cloud and develop Internet of Things
applications.
• It works with Arduino, Raspberry Pi and MATLAB (premade
libraries and APIs exists).
• But it should work with all kind of Programming Languages, since
it uses a REST API and HTTP.

https://thingspeak.com
* ThingSpeak is free for small non-commercial projects 2
ThingSpeak

https://thingspeak.com
ThingSpeak
• ThingSpeak is an IoT analytics platform service that lets you
collect and store sensor data in the cloud and develop Internet of
Things applications.
• The ThingSpeak service also lets you perform online analysis and
act on your data. Sensor data can be sent to ThingSpeak from any
hardware that can communicate using a REST API
• ThingSpeak is a Web Service (REST API) that lets you collect and
store sensor data in the cloud and develop Internet of Things
applications.
https://thingspeak.com
* ThingSpeak is free for small non-commercial projects 4
What is ThingSpeak?

https://se.mathworks.com/videos/introduction-to-thingspeak-107749.html
ThingSpeak + LabVIEW

Hans-Petter Halvorsen http://halvorsen.blog


ThingSpeak + LabVIEW

LabVIEW www.ThingSpeak.com
The Cloud
Configuration and Settings
SubVI
ThingSpeak
+ Web Browser
Hans-Petter Halvorsen http://halvorsen.blog
ThingSpeak + Web Browser
• We can use a standard Web Browser in order to put data to
ThingSpeak or to get data from ThingSpeak

Write Data Example:


https://api.thingspeak.com/update?api_key=<WriteKey>&field3=2
Read Data Example:
https://api.thingspeak.com/channels/<ChannelId>/fields/3/last.jso
n?key=<ReadKey>
14
Set and Read Values using a Web Browser

Set Kp Remotely Example:


Enter the following in a Web Browser (or from a Programming Language like LabVIEW,
MATLAB, etc)
We set Kp=2
https://api.thingspeak.com/update?api_key=<WriteKey>&field3=2

Read Kp Remotely Example:


https://api.thingspeak.com/channels/<ChannelId>/fields/3/last.json?key=<ReadKey>

Response in Browser: {"created_at":"2017-06-26T07:41:54Z","entry_id":1270,"field3":"2"}


We read Kp=2
ThingSpeak + MATLAB

Hans-Petter Halvorsen http://halvorsen.blog


ThingSpeak + MATLAB
The “ThingSpeak Support Toolbox” lets you use desktop MATLAB
to analyze and visualize data stored on ThingSpeak.com

ThingSpeak Support from Desktop MATLAB:


http://se.mathworks.com/hardware-support/thingspeak.html
ThingSpeak + Arduino

Hans-Petter Halvorsen http://halvorsen.blog


ThingSpeak + Arduino
Arduino Example:
https://www.arduino.cc/en/Tutorial.WiFi101ThingSpeakDataUploader

21
Arduino WiFi Shield + ThingSpeak
• ThingSpeak is a Web Service (REST API) that lets you collect and
store sensor data in the cloud and develop Internet of Things
applications.
• It works with Arduino, Raspberry Pi, MATLAB and LabVIEW, etc.
https://thingspeak.com
Arduino Example:
https://www.arduino.cc/en/Tutorial.WiFi101ThingSpeakDataUploader
Data Collection

www.ThingSpeak.com

The Cloud Data Analysis


Arduino + Wi-Fi Shield
ThingSpeak + C#

Hans-Petter Halvorsen http://halvorsen.blog


ThingSpeak + Visual Studio/C#

Visual Studio www.ThingSpeak.com


C# The Cloud
Configuration and Settings
void SaveMeasurementData()
{
string apiKey;
double tagValue;

string server = "https://api.thingspeak.com/";


string webMethod;
string uri;

var webclient = new WebClient();

apiKey = “xxxxxxxxxxxxxxxxxxxxx";

tagValue = Convert.ToDouble(txtMeasurementValue.Text);

webMethod = "update?api_key=" + apiKey + "&field1=" + tagValue;

uri = server + webMethod;

webclient.UploadString(uri, "POST", "");

}
27
Hans-Petter Halvorsen
University of Southeast Norway
www.usn.no

E-mail: [email protected]
Web: http://www.halvorsen.blog

You might also like