Setting up a Device Channel in ThingSpeak IoT Cloud

In this post we will see the process of Setting up a device channel in the IoT Cloud platform ThingSpeak.

Step-1: The first step is to create an account. The good part is that ThingSpeak does not require a Credit card (like AWS/Azure) for signing up. You may sign up here.

Step-2: After signing up on ThingSpeak, login here.

Step-3: Create a new ThingSpeak channel by clicking on the "New Channel" button shown below.

Create New ThingSpeak Channel

Step-4: In the new channel creation screen, fill out the details of the device from which data will be received.

Create New ThingSpeak Channel

Step-5: In the new channel creation screen, scroll down further and make this channel public. So that you can post data to it.

Create New ThingSpeak Channel

Step-6: After saving the channel, the channel details screen will get displayed (as shown below). Notice that there will be 5 tabs: Private View, Public View, Channel Settings, API Keys and Data Import/Export. You are all set! Browse through them to get a feeling of the contents. Make note of the Channel ID, as you will need it for posting and reading data to ThingSpeak.

Create New ThingSpeak Channel

Step-7: Now we will see how to log data and read data to and from this channel. Browse to the API Keys tab for your channel. Note down the read and write api_keys (as shown below), as you will need it for posting and reading data to ThingSpeak. I have obscured the api keys for my channel intentionally. Never share your channel api keys with unintented recipients as they might spam the channel inadvertently ;)

Create New ThingSpeak Channel

Step-8: Use the following URL format to log data to ThingSpeak.

https://api.thingspeak.com/update.json?api_key=<your-write-api-key>&field1=58

Upon hitting the above URL, the data '58' will get logged in the ThingSpeak IoT cloud. You will see the below response on your browser.

How to use ThingSpeak for IoT

Correspondingly, you can also see the logged data in the ThingSpeak channel's Private/Public View tabs, as shown below.



Step-9: Use the following URL format to read the logged data from ThingSpeak.

http://api.thingspeak.com/channels/<your-channel-id>/feeds.json?key=<your-read-api-key>&results=1

On hitting the above URL in the browser, you will receive the last posted data row from ThingSpeak, as shown below.




To conclude, I hope you liked this post on creating a device channel in ThingSpeak. I love hearing from you, so don't forget to leave your comments and share your experience using the ThingSpeak IoT cloud.

Cheers!
KBRC

No comments:

Post a Comment