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

125 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

Leave a Message

Your email address will not be published.


Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved