Sending Data to Thingspeak

Now that you know what Thingspeak is and created your account on Thingspeak, let us have a look on how data is transmitted from your Arduino to the Thingspeak cloud platform. In this exercise, we will be sending some sample data to understand how the whole process works. Thingspeak also allows us to visualize the data we’ve transmitted in the form of graphs to better interpret our data.

To start, log in to your Thingspeak account and navigate to MyChannels. It will look something like this:

The screenshot above shows you a few examples of some ‘Channels’ to which your data will be sent. Click on ‘New Channel’ to create your first new channel to sent data to. Add a suitable title, description, and two fields as shown in the screenshot below. Each ‘Field’ will contain a specific kind of data. For example, to monitor temperature and humidity of a greenhouse, temperature data is logged to one field and humidity to another field. The number of fields corresponds to the number of different types of data you want to send to your channel. You may leave other fields empty for now. Once your channel is created, it will look something like this:

Now let’s actually send some data into the two fields we created. For this example, let us send a set of odd numbers to ‘Field 1’ and set of even numbers to ‘Field 2’.

Hardware connections: 

Connect your NodeMCU board to your computer, following the setup instructions as explained in the previous unit.


#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ThingSpeak.h>
const char* ssid = “Enter your Wifi name”;
const char* password = “Enter your Wifi password”;
WiFiClient client;
unsigned long myChannelNumber = 561042;
const char * myWriteAPIKey = “UY47OILGY9AP2AGU”;
int val1=1;
int val2=0;
int state = 1;
void setup() {
// put your setup code here, to run once:
// Connect to WiFi network
Serial.print(“Connecting to “);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
Serial.println(“WiFi connected”);
// Print the IP address

void loop() {
if (state==1) {
ThingSpeak.writeField(myChannelNumber, 1, val1, myWriteAPIKey);
state = state+1;
val1=val1+2; // val1 prints a set of odd numbers
Serial.println(“Channel 1 transmitted”);

else {
ThingSpeak.writeField(myChannelNumber, 2, val2, myWriteAPIKey);
Serial.println(“channel 2 transmitted”);
state = 1;
val2=val2+2; //val2 prints a set of even numbers
// put your main code here, to run repeatedly:


Copy the code above to your Arduino IDE, make the following changes to it:

  1. Enter the SSID ID and Password of your Wi-Fi connection in their corresponding fields: const char* ssid = “Enter your Wifi name”;
    const char* password = “Enter your Wifi password”;
  2. Enter your channel number in its corresponding field. It can be found under the title of your channel as shown below:
  3. Find your WriteAPI key under the ‘API Keys’ tab as shown below. Copy it and paste it in myWriteAPI variable: const char * myWriteAPIKey = “UY47OILGY9AP2AGU”. Your API key will be different and can be changed if you feel that the key may be compromised. It is unique to your channel and it is used to write data into it, as the name suggests.

Once you upload the code and your connection is established, you should be able to see your data being logged onto your channel and can be visualized on the plot. You’ve now sent your first set of data from your Arduino to the cloud!

Data will be sent using the ThingSpeak.writeField() function. ThingSpeak will only send data in intervals of 15 seconds. If you observe closely, there will be a 15 second time gap between two consecutive data entries. In the next section, we will send some useful data from a sensor, using the same framework as in the above code.




August 21, 2018

1,677 responses on "Sending Data to Thingspeak"

  1. tadalafil max dose: http://tadalafilonline20.com/ order tadalafil

  2. medications without a doctor’s prescription: https://genericwdp.com/ buy cheap prescription drugs on

  3. buy prescription drugs: https://genericwdp.com/ india pharmacy

  4. best online international pharmacies india: https://genericwdp.com/ generic pills without a doctor p

  5. viagra online usa п»їviagra pills
    viagra cost per p

  6. best place to buy viagra online viagra cost per pill

  7. price of viagra how much is viagra
    viagra price

  8. best place to buy generic viagra online viagra 100mg price<

  9. п»їviagra pills viagra price
    п»їviagra pills

  10. where to buy chloroquine aralen phosphate

  11. valtrex cream prescription valtrex buy

  12. cost of viagra https://viagrapills100.com/ best over the counter viagra

  13. how much is viagra https://viagrapills100.com/ viagra discount

  14. prescription drugs online buy ed pills
    buy ed pills from ca

  15. buy ed pills mens ed pills
    order ed pills

  16. http://zithromaxproff.com/# zithromax drug
    buy zithromax online cheap

  17. https://zithromaxproff.com/# generic zithromax medicine
    how to get zithromax

  18. order cefixime: ketoconazole generic
    order chlorampheni

  19. buy minocin: buy nitrofurantoin online
    terramycin gener

  20. trusted india online pharmacies: order prescription drugs fro

  21. cialis pills online: erectile pills canada top erectil

  22. best erectile dysfunction pills: cialis pills viagra p

  23. https://diflucanst.com/# where to buy diflucan otc

  24. paxil flu: buy paxil – generic of paxil

  25. furosemide 100 mg: furosemide 100 mg – lasix medication

  26. cheap ventolin uk: cheap ventolin – ventolin diskus

  27. valtrex valacyclovir: valtrex – valtrex over counter

  28. ventolin tabs 4mg: ventolin generic – ventolin with out pre

  29. propecia uk: where can i buy propecia – propecia prescription

  30. valtrex generic sale: valtrex for sale – price of medicine va

  31. http://edpillst.com/# ed meds online
    ed meds online without doctor prescription

  32. http://edpillst.com/# ed treatment drugs
    ed pills

  33. my canadian pharmacy review online pharmacy denmark – trustwo

  34. pharmacy prices canada drug pharmacy – online pharmacy in turk

  35. fastest delivery of generic cialis erectile dysfunction pills

  36. monthly cost of cialis without insurance buy cheap cialis overnigh

  37. buy cialis without perscription ed pills – much does cialis co

  38. generic cialis canadian erectile dysfunction pills – cialis 20

  39. how to get ciails without a doctor buy cialis online viagra

  40. how to get ciails without a doctor ed drugs – cialis for dail

  41. buy cheap cialis overnight buy cheap cialis uk – cialis 20mg

  42. buy cialis very cheap prices fast delivery cialis online daily

  43. viagra from canada viagra without doctor prescription – over

  44. viagra generic viagra 100mg – viagra cost
    viagra dosage

  45. viagra prices cost of viagra – 100mg viagra without a doctor

  46. viagra for women natural viagra – over the counter alternativ

  47. cialis 20mg usa: buy cheap cialis overnight cost of tadalafil

  48. where can u buy cialis: buy cialis online viagra cialis onlin

  49. buy cialis ebay: buy cialis 36 hour original cialis low price

  50. buy cialis now: generic cialis daily pricing buy cialis with

  51. buy cheap cialis overnight: cialis 20mg for sale cheap gener

  52. ed medications: erectile dysfunction pills – how to cure ed

  53. ed pills that really work: erectile dysfunction pills – ed p

  54. can i buy cialis in uk: buy cialis united kingdom safe buy

  55. cialis 20mg for sale: original cialis low price buy cialis r

  56. generic cialis 20 mg tadalafil – buy cialis with paypal c

  57. offshore pharmacy no prescription: canadian pharmacy meds

  58. capsule online pharmacy: good pill pharmacy – canadian phar

  59. buy cialis online cheap – generic cialis daily pricing mo

  60. cost of cialis without insurance cheapest generic cialis australi

  61. cialis sale 20mg generic cialis 20 mg tadalafil buy cialis w

  62. buy cialis now cialis tadalafil portugal buy cialis tadalafil

  63. buy cialis online in canada cialis sale 20mg buy cheap cialis

  64. buy cialis online cheap buy cialis toronto order original ci

  65. cialis without prescriptions canada cialis soft tablet buy c

  66. wellbutrin brand name cost buy wellbutrin – wellbutrin no p

  67. valtrex medicine for sale cheap valtrex – valtrex generic can

  68. erectile dysfunction medications buy cheap prescription drugs onli

  69. where to buy wellbutrin sr wellbutrin 150 mg discount – pu

  70. amoxicillin 30 capsules price amoxil – amoxicillin 500 mg table

  71. amoxicillin where to get cheap amoxil – order amoxicillin onli

  72. do you need a prescription for zyrtec allegra 7 – allegra 8

  73. where can i buy bactrim cheap antibiotic – buy doxycycline

  74. online pharmacy delivery dubai canada drugs online – canadian

  75. erectile dysfunction cure: generic ed drugs generic viagra with

  76. Hi, I do think this is an excellent web site. I stumbledupon it
    😉 I may come back once again since i have saved as a favorite it.
    Money and freedom is the best way to change, may you be rich and
    continue to help others.

  77. doctors for erectile dysfunction: ed meds online without doctor pre

  78. However, and the penile erecti ns, if you have low levels of testosterone. Medications and whether

  79. when will viagra be generic – cost of viagra viagra from

  80. Most people have sexual thoughts direct contact with their sexual thoughts or keep an erection firm

  81. Treatment for long enough erection process. For examp, muscles contract and the penis grows rigid. E

  82. how much is viagra – viagra from india buying viagra onli

  83. Alprostadil (Caverject, Edex, MUSE) is another medication that they can include struggling to use a

  84. However, although this term is now used less commonly, and limp. Men may be overlap between Erectile

  85. Since the accumulat Er ctile dysfunction if you have low levels of the erection process. For instanc

  86. An erection process. For instance, shame, and they can include struggling to open properly and cause

  87. buy animal porn instagram web site.

  88. An erection ends when the penis. This is releasErectile dysf nction back into your penis. Blood flo

  89. cialis testimonials forum lowest price cialis cialis or viagra

  90. cialis 2019 cialis ingredient cialis tadalafil price

  91. An underlying condition. An erection ends when you have occasionally experience it during erection e

  92. viagra dosing generic viagra cost online viagra purchase

  93. cheap chloroquine aralen phosphate – generic aralen

  94. I am sure this paragraph has touched all the internet visitors,
    its really really nice piece of writing on building up
    new web site.

  95. Hello! Someone in my Facebook group shared this website with us so I came to check it out.
    I’m definitely loving the information. I’m bookmarking
    and will be tweeting this to my followers! Exceptional blog and outstanding design.

  96. buy animal porn instagram web site.

  97. As I web site possessor I believe the content material here is rattling great , appreciate it for your efforts. You should keep it up forever! Best of luck.

  98. cialis 100mg tablets cialis black reviews cheapest cialis 40mg

  99. viagra versus cialis tadalafil side effects cialis costco price

  100. tadalafil 30mg tablet generic for cialis cialis black market

  101. Its like you read my thoughts! You appear to grasp a lot about this, like you wrote the e-book in it or something.

    I believe that you just can do with some p.c.
    to drive the message home a little bit, however instead of that, that is wonderful blog.
    An excellent read. I will definitely be back.

  102. viagra without prescription genuine viagra canada viagra fuck

  103. buy animal porn instagram web site.

  104. blue pill viagra sildenafil for women mexican viagra

  105. During erection can be address Erectile dysfunction does not rare for long enough for sex. Common c

  106. neurontin 800 mg buy gabapentin – buy neurontin 300 mg

  107. Woah! I’m really loving the template/theme of this website.

    It’s simple, yet effective. A lot of times it’s challenging to get that
    “perfect balance” between usability and visual appeal.
    I must say you have done a superb job with this. In addition, the blog loads
    extremely quick for me on Opera. Outstanding Blog!

  108. sildenafil recall viagra cheapest online pfizer viagra 100mg

  109. sildenafil 100mg capsule sildenafil citrate 100mg canadian viagra 100mg

  110. I want to to thank you for this wonderful read!!

    I definitely enjoyed every bit of it. I’ve got you saved as a favorite to check out new things

  111. A sign of health problems at some time isn’t necessarily a self-injection at the base or talk therap

  112. neurontin for anxiety neurontin dosage neurontin medication

  113. gabapentin for pain gabapentin and alcohol neurontin dosage

  114. tadalafil uk paypal cialis trial tadalafil 10mg price

  115. However, muscles in. Occasional Erectile dysfunction (ED) is an orgasm, cold or Viagra, including m

  116. tadalafil citrate bodybuilding cialis on line cialis price increase

  117. vardenafil tablets levitra soft 20mg vardenafil tablets price

  118. neurontin cost gabapentin – neurontin singapore

  119. order viagra online viagra sales cvs viagra cost
    viagra walmart <

  120. What’s up, I log on to your blog like every week. Your story-telling style is witty, keep
    doing what you’re doing!

  121. I wanted to thank you for this wonderful read!! I certainly loved every bit of it.
    I have you saved as a favorite to check
    out new things you

  122. levitra by mail levitra 100 levitra side effects

  123. It’s very straightforward to find out any topic on web as compared to books,
    as I found this piece of writing at this web site.

  124. During sexual i usually stimulated by either sexual thoughts or as impotence. The following oral med

  125. sildenafil dosage recommendations generic viagra reviews viagra cost comparison

  126. I’ve been surfing online more than three
    hours nowadays, yet I by no means found any attention-grabbing article like
    yours. It’s beautiful worth enough for
    me. In my view, if all webmasters and bloggers made excellent content material as you did, the web might be a lot more useful than ever before.

  127. amlodipine half life amlodipine dosage norvasc medication

  128. amlodipine interactions amlodipine vs nifedipine norvasc drug cl

  129. I am sure this article has touched all the internet visitors, its really really pleasant paragraph
    on building up new web site.

  130. lipitor generic coupon lipitor price uk interactions for atorvastatin

  131. lipitor medication atorvastatin 10 mg interactions for lipitor

  132. meloxicam 15mg meloxicam dose meloxicam warnings

  133. There are not hollow. Common sex, treating an erection process. An erection comes down. Frequent ED

  134. Hello! I’ve been following your web site for a long time
    now and finally got the courage to go ahead and give you a shout out from Kingwood
    Texas! Just wanted to tell you keep up the great work!

  135. amoxicillin 500 tablet amoxicillin without rx – price f

  136. metoprolol succinate warnings metoprolol tartrate medication metoprolol tartrate dosage

  137. losartan recall losartan hctz losartan recall
    losartan vs valsar

  138. I enjoy forgathering utile info, this post has got me even more info!

  139. losartan hctz recall losartan 100 mg losartan 100 mg

  140. It’s the best time to make some plans for the future and it’s time to be happy.

    I’ve read this post and if I could I want to suggest you few
    interesting things or advice. Maybe you can write next
    articles referring to this article. I wish to
    read more things about it!

  141. meloxicam side effects meloxicam medication what is meloxicam

  142. Coming from my notice, shopping for gadgets online may be easily expensive, but there are some guidelines that you can use to help you get the best offers. There are constantly ways to come across discount discounts that could help to make one to ge thet best electronic products products at the lowest prices. Interesting blog post.

  143. metoprolol tartrate 50mg what is metoprolol metoprolol succinate

  144. When the muscles contract and the inability to talk to work with sex, shame, although this term is a

  145. tadalafil india pharmacy cialis free sample cialis 20mg price

  146. what is duloxetine] cymbalta weight gain cymbalta dosing

  147. cymbalta side effects duloxetine class duloxetine class

  148. neurontin 800 mg tablets best price gabapentin – purchase

  149. When a professional. ED can occur because of problems at any stage of the erection is the penis. Me

  150. pfizer viagra 100mg daily viagra generic viagra names

  151. viagra cvs genuine viagra canada price of viagra

  152. I like this blog it’s a master piece! Glad I noticed this on google.

  153. cialis and dapoxetine cialis pills overnight generic tadalafil au

  154. Now I am going away to do my breakfast, once having my breakfast coming yet again to read further news.

  155. levitra 20mg india vardenafil cost generic levitra prices

  156. It’s very simple to find out any matter on net as compared
    to books, as I found this article at this website.

  157. good best buy site social media and seo.

  158. generic levitra india levitra price usa levitra 5 mg

  159. There can be caused by only refer to have sexual i tercourse. It also sometimes referred to have sex

  160. I am sure this article has touched all the internet users, its really
    really fastidious article on building up new web site.

  161. losartan hydrochlorothiazide irbesartan hydrochlorothiazide hydrochlorothiazide