Skip to main content
. 2019 May 2;19(9):2047. doi: 10.3390/s19092047

Table 2.

ThingSpeakTM update executed by the presented prototype.

/* … */
byte server[[] = {184, 106, 153, 149};  // IP Address (or api.thingspeak.com) for the ThingSpeak (https://thingspeak.com/)
String writeAPIKey = “E18Q*X*TY**8A*4U”; // Write API Key for a ThingSpeak Channel
updateThingSpeak(“field1=” + String(RMSPower) + “&field2=” + String(peakPower));
void updateThingSpeak(String tsData) { // RMSPower, peakPower, …, more 1
  
  if (client.connect(server, 80)) {
  Serial.println(F(“Connected to ThingSpeak...”));
  client.print(“POST /update HTTP/1.1\n”);
  client.print(“Host: api.thingspeak.com\n”);
  client.print(“Connection: close\n”);
  client.print(“X-THINGSPEAKAPIKEY: “+writeAPIKey+”\n”);
  client.print(“Content-Type: application/x-www-form-urlencoded\n”);
  client.print(“Content-Length: ”);
  client.print(tsData.length());
  client.print(“\n\n”);
  client.print(tsData);
  }
  …
  
}

1 The current readings are calibrated by scaling factors [59] for power computation.