Thingspeak multiple field updates from html | Arduino | Forum


Please consider registering

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
Thingspeak multiple field updates from html
No permission to create posts
December 17, 2017
1:31 pm
New Member
Forum Posts: 2
Member Since:
December 17, 2017
sp_UserOfflineSmall Offline



I have been dabbling with HTML for several years but I still have a limited skill set in this area.

Recently have been introduced to the "Arduino world" and the "possibilities" and have just begun the "learning curve".

I have a web page loaded via Micro SD on an ethernet shield.


With that in mind, I have downloaded an Arduino sketch I found online that sets up a web server with outputs (A2, A3). The html page I have created is a marriage between two different files found online. The web page functions as it should with one exception: I am only getting one Field updated in my Thingspeak channel. I have spent several hours researching the net looking for the solution but cannot find anything that "fits" my coding given the way the page is formatted. The page is a "test" model for a future version that will need to have 5-6 sensors (temperature) displayed and the values of, uploaded to Thingspeak. The other thing I should point out, is that the original script was "voltage" related and not temperature, so I am not totally sure of the changes to make in those regards. My ultimate goal is create a web page that will display 5 temperature guages and 5 display graphs that will display temperatures from a solar panel (hot water augmentation).

Here's a partial screen shot: Enlarger

I removed the Thingspeak "write key" before taking the screen shot. It should also be noted that the original script had "voltage" in place of where I now have "data" (circled in red)

I would greatly appreciate any help offered.


December 26, 2017
9:55 am

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

Can you copy ans paste the relevant parts of your code into the window instead of a screen shot?

I think you are tying to update multiple fields of a ThingSpeak channel.  It looks like your function call only has space for one field at a time.  I am guessing that your device is calling that function multiple times within the  update limit for ThingSpeak.  If you have a free account that is 15 seconds.  Even with a paid account, you are still limited to updates once every second, and your device probably calls much faster than that.  

If this is indeed the issue, there are two ways around that issue.  One is to add a delay between every call, and the second is to update multiple fields at once.  

This example shows how to update fields from an Arduino device, though you already have some basic code.  See the documentation on updating fields.  The documentation describes using POST http commands.  You can send multiple fields the the body of your post.   

If you are using the GET HTTP method, you can append additional field data in the same call using the & to append further data.  

GET etc.

You can also use MQTT publish, and this example shows how to update multiple fields simultaneously.  

Let us know if this helps.

January 1, 2018
10:52 am
New Member
Forum Posts: 1
Member Since:
December 17, 2017
sp_UserOfflineSmall Offline

Thank you for response and suggestions. Much appreciated!

I believe I have resolved the issue by making a few slight changes to both my HTML script and in the settings in ThingSpeak.

My first issue was a mistake in how I had named the "Fields". The name I used in the ThingSpeak channel did not match what was written in the script.

function ThingSpeakSend(api_write_key, temperature)

I had the word "data" in place of "temperature". The Field name in ThingSpeak (Temperature) must match the name in the HTML script (temperature). It can be anything you want, but the two must match.

The other thing I needed to do in order to get "multiple Fields" updated all at once was to change the script to this:

var req_str = "" + api_write_key + "&field1=" + sensor1 + "&field2=" + sensor2;


At this point, everything appears to be working correctly. I have made changes so that ThingSpeak updates every 5 minutes. I have also tried settings in ThingSpeak to log 100 inputs which equates to just over 8hrs (based on 5 minute updates). The only thing I have noticed and it appears to be random, is that ThingSpeak stops updating at random times without reason. It doesn't do this all the time. Some days it runs flawless (8hrs+) and yet other days it will run for a few hours and then stop. I'm not sure if it's a hardware issue or something in the HTML script that needs tweaking.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
18 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:

briskpanda, Dejw0089, Yassine Ben Salah, anis, 43994554AKS, suda

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457