December 17, 2017
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).
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.
March 7, 2017
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 https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=0 or
GET https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=0&field2=24&field3=567 etc.
You can also use MQTT publish, and this example shows how to update multiple fields simultaneously.
Let us know if this helps.
December 17, 2017
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.
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:
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.
Most Users Ever Online: 166
Currently Browsing this Page:
Guest Posters: 1
Newest Members:briskpanda, Dejw0089, Yassine Ben Salah, anis, 43994554AKS, suda
Moderators: cstapels: 460
Administrators: Hans: 405, lee: 457