Updating multiple channels from html | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

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
Updating multiple channels from html
No permission to create posts
December 17, 2017
1:44 pm
Avatar
Stillub
New Member
Members
Forum Posts: 2
Member Since:
December 17, 2017
sp_UserOfflineSmall Offline

I posted this question under "Arduino" and probably should of placed it here... my bad...

Original post viewed here: http://community.thingspeak.com/forum/arduino/thingspeak-multiple-field-updates-from-html/

January 2, 2018
3:03 pm
Avatar
Piez

Silver
Members
Forum Posts: 15
Member Since:
January 1, 2018
sp_UserOfflineSmall Offline

Stillub said

I posted this question under "Arduino" and probably should of placed it here... my bad...

Original post viewed here: http://community.thingspeak.com/forum/arduino/thingspeak-multiple-field-updates-from-html/  

I'm not sure if it's my URL or something going on with the ThingSpeak.com servers but I'm not having any success getting consistency.

It's quite possible they are working on the servers or there are a number of datastream intensive opertions going on that are slowing down the ThingSpeak server response times.

All speculation.  But I cannot figure out why my data URLS work fine one moment then not at all the next, and the intervals are all over the place as far as time between data points....like anywhere between 1 minute and several hours even though I am sending update feeds every 60 seconds.   I have a gut feeling something's going on with the ThingSpeak server(s) at this time.    Again, could be totally wrong...just a guess based on observation of data.

January 2, 2018
4:28 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 210
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

The servers seem pretty steady on channels where I have time controls set up. I see a fluctuation of about 15 seconds for these.  There is less variation in the channels I have that are using devices to write, except where they collide with other writes. 

If you have multiple writes to your channels, they might be competing, which will make the posting look intermittent.  Check your time controls and analysis scripts.  You licence type will tell you how often you can update. 

If you are using the REST interface from an HTML script, reliability may depend on your internet connection. Are you posting from a location with a reliable internet connection?  

January 3, 2018
2:23 pm
Avatar
Piez

Silver
Members
Forum Posts: 15
Member Since:
January 1, 2018
sp_UserOfflineSmall Offline

cstapels said
  Check your time controls and analysis scripts.

What do you mean by this?

Where are these and are they pertinent to GET URLs suppling datapoints via an HTML feed (no Json, XML)

January 3, 2018
3:35 pm
Avatar
MURLIDHAR ROY
New Member
Members
Forum Posts: 3
Member Since:
January 3, 2018
sp_UserOfflineSmall Offline

I am trying to send two data values to thingspeak value. Please tell me the command through which I can send the two sensor data. The basic code is given below.

 

#include <SoftwareSerial.h>
/* Create object named SIM900 of the class SoftwareSerial */
SoftwareSerial SIM900(8, 7);
void setup()
{
SIM900.begin(9600); /* Define baud rate for software serial communication */
Serial.begin(9600); /* Define baud rate for serial communication */
}

void loop() {
Serial.println("HTTP post method :");
Serial.print("AT\
\
");
SIM900.println("AT"); /* Check Communication */
delay(500);
ShowSerialData(); /* Print response on the serial monitor */
delay(500);
/* Configure bearer profile 1 */
Serial.print("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"\
\
");
SIM900.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\""); /* Connection type GPRS */
delay(500);
ShowSerialData();
delay(500);
Serial.print("AT+SAPBR=3,1,\"APN\",\"airtelgprs.com\"\
\
");
SIM900.println("AT+SAPBR=3,1,\"APN\",\"airtelgprs.com\""); /* APN of the provider */
delay(500);
ShowSerialData();
delay(500);
Serial.print("AT+SAPBR=1,1\
\
");
SIM900.println("AT+SAPBR=1,1"); /* Open GPRS context */
delay(500);
ShowSerialData();
delay(500);
Serial.print("AT+SAPBR=2,1\
\
");
SIM900.println("AT+SAPBR=2,1"); /* Query the GPRS context */
delay(500);
ShowSerialData();
delay(2000);
Serial.print("AT+HTTPINIT\
\
");
SIM900.println("AT+HTTPINIT"); /* Initialize HTTP service */
delay(2000);
ShowSerialData();
delay(500);
Serial.print("AT+HTTPPARA=\"CID\",1\
\
");
SIM900.println("AT+HTTPPARA=\"CID\",1"); /* Set parameters for HTTP session */
delay(500);
ShowSerialData();
delay(500);
Serial.print("AT+HTTPPARA=\"URL\",\"api.thingspeak.com/update\"\
\
");
SIM900.println("AT+HTTPPARA=\"URL\",\"api.thingspeak.com/update\""); /* Set parameters for HTTP session */
delay(500);
ShowSerialData();
delay(500);
Serial.print("AT+HTTPDATA=33,10000\
\
");
SIM900.println("AT+HTTPDATA=33,10000"); /* POST data of size 33 Bytes with maximum latency time of 10seconds for inputting the data*/
delay(200);
ShowSerialData();
delay(200);
Serial.print("api_key=8MMR5DD7QC42NAUJ&field1=2\
\
"); /* Data to be sent */
SIM900.println("api_key=8MMR5DD7QC42NAUJ&field1=2");
delay(500);
ShowSerialData();
delay(500);
Serial.print("AT+HTTPACTION=1\
\
");
SIM900.println("AT+HTTPACTION=1"); /* Start POST session */
delay(1000);
ShowSerialData();
delay(2000);
Serial.print("AT+HTTPTERM\
\
");
SIM900.println("AT+HTTPTERM"); /* Terminate HTTP service */
delay(2000);
ShowSerialData();
delay(500);
Serial.print("AT+SAPBR=0,1\
\
");
SIM900.println("AT+SAPBR=0,1"); /* Close GPRS context */
delay(500);
ShowSerialData();
delay(500);
}

void ShowSerialData()
{
while(SIM900.available()!=0) /* If data is available on serial port */
Serial.write(char (SIM900.read())); /* Print character received on to the serial monitor */
}

January 5, 2018
1:50 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 210
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Piez,

You can perform channel updates in MATLAB analysis scripts. (also in visualizations)  If you were using a script to update the channel, I would check if the script is doing multiple writes within the update limit.  Time controls are used to regularly schedule running of code.  They  can be used to trigger analysis scripts, which could also cause overlapping writes to channels. 

Writing simultaneously to multiple channels can also violate the update rate limitation and lead to missed data.

January 5, 2018
2:05 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 210
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

MURLIDHAR ROY,

See REST API documentation for the appropriate syntax. 

Does the code you provided work to update a single field?  If it works as is for one field, add &field2=... to get it to work for 2 fields.    If the code doesn't work as is, you may need a "?" before the api key.

If you are using a GET operation

https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=0

Then continue to append fields with the "&".

https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=0&field2=56&field3=123

January 25, 2018
10:48 pm
Avatar
royalghost
New Member
Members
Forum Posts: 2
Member Since:
January 9, 2018
sp_UserOfflineSmall Offline

Perform channel updates in MATLAB analysis scripts and check script if it is doing multiple writes within the update limit..

gomovies

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

celinabw2, FitoSprayscroma, LunnonGor, lancevl16, bernicenk60, veronicadq18

Administrators: Hans: 387, lee: 457