Data not visible while sending for multiple fields | ThingSpeak API | Forum

The ThingSpeak community site has been upgraded to a new site. This site is currently in read-only mode. You can ask questions or post and read discussions on the new site.

Please consider registering

sp_LogInOut Log In sp_Registration Register

8   +   4   =  

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Data not visible while sending for multiple fields
No permission to create posts
October 12, 2020
8:26 am
New Member
Forum Posts: 1
Member Since:
October 12, 2020
sp_UserOfflineSmall Offline

Hello!! i'm trying to send data on thinkspeak for multiple fields but i'm only getting data for my field1 and field2 is not getting update. please help me in this ,Thank You.

#define USE_ARDUINO_INTERRUPTS true // Set-up low-level interrupts for most acurate BPM math.
#include // Includes the PulseSensorPlayground Library.
#include //Software Serial library
SoftwareSerial espSerial(2, 3); //Pin 2 and 3 act as RX and TX. Connect them to TX and RX of ESP8266
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
#define DEBUG true
String mySSID = "XXXX"; // WiFi SSID
String myPWD = "xXXX"; // WiFi Password
String myAPI = "XXXXX"; // API Key
String myHOST = "";
String myPORT = "80";
String myFIELD1 = "field1";
String myFIELD2 = "field2";
int sendVal1;
int sendVal2;
const int PulseWire = 0; // PulseSensor PURPLE WIRE connected to ANALOG PIN 0
const int LED13 = 13; // The on-board Arduino LED, close to PIN 13.
int Threshold = 550; // Determine which Signal to "count as a beat" and which to ignore.
int myBPM; // Use the "Gettting Started Project" to fine-tune Threshold Value beyond default setting.
// Otherwise leave the default "550" value.

PulseSensorPlayground pulseSensor; // Creates an instance of the PulseSensorPlayground object called "pulseSensor"

void setup()

espData("AT+RST", 1000, DEBUG); //Reset the ESP8266 module
espData("AT+CWMODE=1", 1000, DEBUG); //Set the ESP mode as station mode
espData("AT+CWJAP=\""+ mySSID +"\",\""+ myPWD +"\"", 1000, DEBUG); //Connect to WiFi network
//Wait for connection

pulseSensor.blinkOnPulse(LED13); //auto-magically blink Arduino's LED with heartbeat.

// Double-check the "pulseSensor" object was created and "began" seeing a signal.
if (pulseSensor.begin()) {
Serial.println("We created a pulseSensor Object !"); //This prints one time at Arduino power-up, or on Arduino reset.

Serial.println("Adafruit MLX90614 test");



void loop()
/* Here, I'm using the function random(range) to send a random value to the
ThingSpeak API. You can change this value to any sensor data
so that the API will show the sensor data
sendVal1 = myBPM;
String sendData1 = "GET /update?api_key="+ myAPI +"&"+ myFIELD1 +"="+String(sendVal1);
espData("AT+CIPMUX=1", 1000, DEBUG); //Allow multiple connections
espData("AT+CIPSTART=0,\"TCP\",\""+ myHOST +"\","+ myPORT, 1000, DEBUG);
espData("AT+CIPSEND=0," +String(sendData1.length()+4),1000,DEBUG);

myBPM = pulseSensor.getBeatsPerMinute(); // Calls function on our pulseSensor object that returns BPM as an "int".
// "myBPM" hold this BPM value now.

if (pulseSensor.sawStartOfBeat()) { // Constantly test to see if "a beat happened".
Serial.println("♥ A HeartBeat Happened ! "); // If test is "true", print a message "a heartbeat happened".
Serial.print("BPM: "); // Print phrase "BPM: "
Serial.println(myBPM); // Print the value inside of myBPM.

sendVal2 = mlx.readObjectTempF();
String sendData2 = "GET /update?api_key="+ myAPI +"&"+ myFIELD2 +"="+String(sendVal2);
espData("AT+CIPMUX=2", 1000, DEBUG); //Allow multiple connections
espData("AT+CIPSTART=0,\"TCP\",\""+ myHOST +"\","+ myPORT, 1000, DEBUG);
espData("AT+CIPSEND=0," +String(sendData2.length()+4),1000,DEBUG);

Serial.print("\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");



String espData(String command, const int timeout, boolean debug)
Serial.print("AT Command ==> ");
Serial.println(" ");

String response = "";
long int time = millis();
while ( (time + timeout) > millis())
while (espSerial.available())
char c =;
response += c;
if (debug)
return response;

October 27, 2020
2:11 pm

Forum Posts: 885
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

If you are a free user, you cannot update a channel more often than once every 15 seconds. But you can do both updates in a single post. Have a look at the Write data page to see how to write multiple fields in the same update.
Just add &field2= to the end of the request and it will update both fields at the same time. etc...

We also recommend you use the ThingSpeak communication library.

FYI, MATLAB answers is the preferred location for ThingSpeak Community support.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
36 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

bogart, estebanmateo93, mikewrite, onlinebusiness, winzy99, Zark_zeugan

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457