6 minutes to read How it's used It is generally very easy to use. All you have to do first is create a new channel through the web interface or via the API. Then you can send your data to the channel using simple HTTP requests: POST https://thingspeak.com/update?key=channelWriteApiKey&field1=value1&field2=value2&...&field8=value8 By specifying the Write API key of the desired channel, a maximum of eight numeric and alphanumeric values in the fields 1 to 8 can be sent to the channel. In addition, it is also possible to specify a location in the form of latitude, longitude and altitude (parameters lat, long and elevation) and a status message (parameter status). This data is stored in the channel and can be visualised in ThingSpeak or on external websites. Retrieving data from a channel is done with different options. For example, the whole channel feed (maximum 8000 entries), only the last entry, a special entry or all values of a certain field can be retrieved. ThingSpeak can send the response in plain text, JSON or XML. Gesamter Channel-Feeds als JSON: GET https://api.thingspeak.com/channels/channelId/feeds.json Letzter Eintrag in einem Channel-Feeds als XML: GET https://api.thingspeak.com/channels/channelId/feeds/last.xml Alle Werte eines Feldes in einem Channel-Feed als Text: GET https://api.thingspeak.com/channels/channelId/entryId Visualisierung ThingSpeak bietet von Haus aus die Möglichkeit, Daten zu visualisieren. Jeder Channel hat dazu eine öffentliche und eine private Ansicht, die unterschiedlich konfiguriert werden können. Die öffentliche Ansicht eines Channels kann auch komplett deaktiviert werden. It is also possible to implement JavaScript plugins for advanced visualisations and to embed the diagrams on external web pages in an iFrame. ThingSpeak Apps As well as the actual core functionality and the previously mentioned channels that contain the actual data, ThingSpeak provides five features known as Apps: React: React enables you to respond to certain messages in a channel. To do this, the channel and data field to be monitored must first be selected via the web interface. Depending on the type of data field, different operators are available for the check function, such as contains, starts with, ends with, is equal to, is greater than, is less than, etc. After stipulating the test frequency (when inserting new data, or every 10, 30 or 60 minutes), all that remains is to set the desired action. This is where two other Apps, ThingHTTP and ThingTweet, come into play, as they can be executed if a data set checks positively. In the case of ThingTweet, the checked value can be inserted in the text of the status update using the placeholder %%trigger%%. ThingHTTP: this App enables ThingSpeak to access external APIs on the web. The HTTP verbs GET, POST, PUT and DELETE are supported, as well as functions such as Basic Authentication, encryption via SSL, HTTP 1.0 and 1.1, as well as any Content Types and Headers, among others. On the one hand, as mentioned earlier, ThingHTTP can be used as an action in a React. On the other hand, it also allows "connected" devices or sensors to send data to or retrieve data from external APIs via ThingSpeak. Data can be sent using the following example request: POST https://thingspeak.com/apps/thinghttp/send_request?api_key=thingHttpApiKey&message=requestBody ThingTweet: Wie der Name schon vermuten lässt, kann man mit ThingTweet Statusupdates auf Twitter posten. Für die Konfiguration dieser App muss lediglich ein Twitter-Konto inklusive der dazugehörigen Zugangsdaten hinterlegt werden. Anschließend kann die so erstellte ThingTweet-Instanz als Aktion in einem React verwendet oder die Nachricht auch direkt an sie gesendet werden: POST https://thingspeak.com/apps/thingtweet/thingTweetId/statuses/update?api_key=thingTweetApiKey&status=twitterMessage TalkBack: a TalkBack can be used to give instructions to "connected" devices by sending commands to a "TalkBack queue" in ThingSpeak. The devices can then retrieve these commands and perform a corresponding action. As long as you do not give a new command an explicit position, it is processed in accordance with the FIFO principle, i.e. the command that entered the queue first is also delivered first when commands are retrieved. If an explicit position is assigned, the new command is inserted at this position in the queue and all subsequent commands are moved back by one position. Abschicken einen neuen Kommandos: POST https://api.thingspeak.com/talkbacks/talkBackId/commands?api_key=talkBackApiKey&command_string=makeCoffee Abrufen des nächsten Kommandos: GET https://api.thingspeak.com/talkbacks/talkBackId/commands/execute?api_key=talkBackApiKey TweetControl: TweetControl enables ThingSpeak to respond to Twitter updates. To do this, the application uses the Twitter streaming API to listen for new status updates from a user and/or a hashtag. If a new tweet with the configured keyword is detected, a ThingHTTP instance can be executed. Hosting or Open Source? There are two different variants of ThingSpeak that you can use. On the one hand, there is a hosted version, which can be reached at https://thingspeak.com/. Here you only have to register and create a channel, and then you can start immediately. On the other hand, you can also run ThingSpeak in an open source version yourself. In this case, the relevant code can be downloaded from a GitHub-Repository. You can also find installation instructions for Linux (Ubuntu) there. Unfortunately, both variants have their particular disadvantages. The hosted version, for example, as a freely accessible and free-of-charge service has a limit of one message every 15 seconds. I.e. a device that wants to send its data to a ThingSpeak channel can only do this every 15 seconds. This limitation may mean, for example, that microcontrollers or low-level devices have to be used to collect and aggregate data over this period, which naturally requires computing power and memory and can therefore result in increased power consumption. The open source version, on the other hand, has the limitation that the Apps are completely missing, which unfortunately is not mentioned either on the official websites or in the GitHub repository. This means that you cannot forward the ThingSpeak data to another platform, for example, or retrieve additional data from the Internet. This in turn means that you are completely restricted to the channel functionality and visualisation possibilities of ThingSpeak itself. At this point, of course, there is still the possibility of covering more complex scenarios by retrieving the data from another application and processing it there. ThingSpeak: "Pros and Cons." ThingSpeak is a free and easy to use IoT platform that is well suited for rapid prototyping. In addition, ThingSpeak already offers good data visualisation capabilities for simple scenarios. In practice, however, the channels themselves, with only eight data fields, and the very limited data processing and data forwarding options can quickly prove to be restrictions that are simply too great. Author: Gerd Pühl
Life Science and Pharmaceutical Industry – Compliant Framework for Cloud-Based Innovation in Pharma & MedTech Learn more