Tutorial: Querx and ThingSpeak
Sending measured data to ThingSpeak
The Querx range of sensors supports the cloud service ThingSpeak, which lets the devices send measured data directly to the cloud. There they can be viewed or visualized and are available via the ThingSpeak programming interface.
The published data differs between the individual variants of Querx, as the models support different types of sensors. In this tutorial we will use a Querx PT100 which measures temperature with the help of a Pt100 sensor to exemplify the configuration. Nonetheless, the tutorial is valid for all variants.
In order to complete this tutorial, you will need to know the IP address at which the Querx sensor that will be sending its data to the cloud can be accessed. The address can, for example, be determined by using our tool Device Discoverer. The application can be downloaded here.
Alternatively, you can use the name provided by mDNS. If you have not specified a different name, the default name will be querx000000.local. In this string 000000 is a placeholder for the last 6 digits of the MAC-address printed on the device’s casing.
After completing this tutorial you will be able to retrieve your tracked data via ThingSpeak. This does not require any direct interaction with Querx itself. ThingSpeak further enables the visualization and further processing of data in other applications.
Signing up for ThingSpeak
In order to use ThingSpeak, you will require a MathWorks account. Therefore, you need to register at https://thingspeak.com/users/sign_up. After registration you are immediately logged in to ThingSpeak. Should this not be the case, you can log in at https://thingspeak.com/login.
ThingSpeak arranges the data it receives in channels. An automatically generated Write API Key is required in order to write data into the channel.
Creating a Channel for Querx
First off, a channel on which Querx can communicate with ThingSpeak needs to be created.
Enter a name and a description for your channel into the input fields Name (1) and Description (2) in the tab Channel Settings. Enter Temperature into Field 1 (3). Place a check mark next to the field, in order to activate it.
You should also select the option Make Public (1). This will let you test the configuration simply by following the URL.
Notice: The option Make Public will allow anyone who knows the URL to view the channel’s data. Select Private View if you do not want your channel to be public.
All other settings are optional. The section Help provides additional information concerning their functionality.
Click the button Save Channel (2) in order to save your settings and create the channel.
Retrieving the Key for the API
The channel has been created, but as mentioned above, you will still require the Write API Key in order to send data to the channel.
The following page will display your random generated keys. The Write API Key (1) is required to write data to the channel. The Read API Key is required if you want to read the data out in other applications.
Your channel’s Write API Key and Channel ID (2) are required for the configuration of ThingSpeak in the Querx web interface.
Configuring ThingSpeak in the Querx Web Interface
Enter your Querx sensor’s IP address or the name assigned by mDNS into your web browser’s address-bar, in order to access the Querx web interface. (See the section Preparations for more info on how to determine the sensor’s address and name.)
If you have set up a password, click Login in the top right corner and enter your user data. If you have not set up a password, you can skip this step.
Click Configuration (1) and then Cloud (2) in the menu Interfaces, in order to open the page that will let you configure the cloud services.
The page lists several cloud services, but in this tutorial we will only be concerned with ThingSpeak.
First, click the button Activate (1) to activate the ThingSpeak function and make it possible to enter data into the other input fields.
Now enter the Write API Key into the input field API Key (2) and the Channel ID into the input field Channel number (3).
The Temperature field ID (4) determines into which of the 8 possible ThingSpeak fields Querx will write the measured temperature data. Therefore, a number between 1 and 8 will need to be entered. Since we activated the first field earlier on, we will enter 1 as the field ID
The field Update rate (5) determines how frequently Querx sends its data to ThingSpeak. Select the rate in minutes.
Click the button Test (6) to test the configuration. Querx will then send the current values to ThingSpeak.
The data can can then be retrieved via your browser at https://thingspeak.co/channels/channelid. In this URL channelid is a placeholder for your channel’s ID.
Click Save in the Querx web interface after a successful test, in order to save your configuration.
Querx will now send the connected sensor’s current values to ThingSpeak at the specified interval.