Edison Lim in Discussions
上次活动时间: 2023-7-30

I am able to modify the chart setting to display the average data with a timescale of 30 minutes. However, when I export the csv file, it shows the reading of 15 seconds. How should I export the average per 30 minutes? Cannot export csv file with average data of 30minutes timescale You can use a parameter at the end of the api call. See the <https://www.mathworks.com/help/thingspeak/readdata.html read api> for the details. First parameter has ? After that you can add parameters with &. I think you want &average=15. Thanks alot for the suggestion! I had figured it out >w< csv thingsspeak
Asif Iqbal in MATLAB Answers
上次活动时间: 2023-7-11

Hello Frineds I am very new to this platform and just explore some very usefull features. I did test to send data from LabVIEW to thingspeak and also upload my csv file. what i want is that as my csv file updated on daily basis so i want this updated data should also send to thingspeak. Any guid or help please? Thanks Asif
Jakub R in MATLAB Answers
上次活动时间: 2022-9-18

Hello, I have a problem to write a bulk-update using csv format. I have some experience with thingspeak using JSON update method, but I need to change it because *csv format would be more RAM-saving method in case of bulk update (less characters = less memory needed). I was trying to change my code written for JSON method to csv according to instructions: https://www.mathworks.com/help/thingspeak/bulkwritecsvdata.html but my example-string csv_feed is not accepted by Thingspeak server. I don't have ideas where is the problem, I tried to comment "//" some non-necessery lines, because in API's example, those lines doesn't appears in code. Thingspeak response code is always the same: 401, meaning "authorization required". But I wrote in code "write_api_key" properly I think (I'm sure that API key and channel number is the same as it is in channel settings on Thingspeak page). The key is authentic, I don't have important data on this channel and I'll change the key after getting rid problems with that code. Without success, I've been changing csv_feed content with diffrent time format (I'd like to use EPOCH time), diffrent number of commas representing field values and I'm still stuck with that code. Could anybody show my mistake? Thank you in advance, Jakub char csv_feed[] = "write_api_key%3DxxxxxxxxxxxxxxxxC%26time_format%3Dabsolute%26updates%3D1662883022%2C20%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C"; String csv_lenght = String(strlen(csv_feed)+1); if(client.connect(server, 80)){ client.println("POST /channels/647137/bulk_update.csv HTTP/1.1"); client.println("Host: api.thingspeak.com"); //client.println("User-Agent: mw.doc.bulk-update (Arduino ESP8266)"); //client.println("Connection: close"); client.println("Content-Type: application/x-www-form-urlencoded"); client.println("time_format: absolute"); //client.println("write_api_key: xxxxxxxxxxxxxxxx"); client.println("Content-Length: "+csv_lenght); client.println(); client.println(csv_feed);
Craig Larson in MATLAB Answers
上次活动时间: 2021-8-9

This link showed me how to successfully do a JSON bulk upload from an ESP8266 to ThingSpeak. I would like to post 60 values in one bulk upload to save on batteries. I know that it is possible to do a CSV bulk upload of data that does not include the "delta_t" or "field1" ascii text for every datapoint as with JSON. This repeated JSON text really bloats the data transfer (about 2000 characters for 60 values). I did successfully complete the Postman example provided in this link but I am unable to mimic this action in the code on my ESP8266. Does anybody know where example code exists - I've been looking for days? Sorry so cryptic but I'm trying to keep my query trim.
Daniel Nouri in MATLAB Answers
上次活动时间: 2021-8-7

I exported my channel feed to CSV format, deleted the channel feed data, then tried to import the CSV back into the channel without making any modification to the CSV file. I recieve the error "The file was not uploaded because it contains duplicate timestamps. See Channel Data Import for more information." I have confirmed that there is no duplicate timestamp data in the CSV. This seems to have been an issue in the past: https://www.mathworks.com/matlabcentral/answers/506094-can-t-import-csv-file-into-thingspeak How can I upload the CSV data back into the channel? Thanks!
Jacob Mielczarek in MATLAB Answers
上次活动时间: 2021-8-3

Hello. I am trying to read online sensor data using the ThingSpeak API. I format my url in the following way: https://api.thingspeak.com/channels/{}/feeds.csv?api_key={}&average=60&offset=0&round=2&start=2021-04-01 00:00:00&end=2021-07-31 00:00:00 Where the two '{}' are replaced with the channel ID and read Key respectively. The problem is that the data returned only spans about 10 days which is only a fraction of what the url specified. Is there a way to avoid this limit and retrieve all the data requested in a single call, or do multiple API calls have to be made if the timeframe I need is greater than 10 days? Thank you in advance!
Sebastian Mondi in Discussions
上次活动时间: 2021-5-28

Hello everyone. Yesterday i started my project and now im trying to export data files (CSV) but it is empty. It cointains just the headers and last read (i think). Anyone knows what is happening? Example CSV exported created_at,entry_id,field1,field2,field3,latitude,longitude,elevation,status 2021-05-26 19:39:23 -03,1,25.00,"43.00 ",,,,, 2021-05-26 19:39:39 -03,2,24.80,40.00" Export data CSV - empty file Have you waited until the file has completed download before opening up the CSV-file? Yes, many times Maybe try a different browser to download the file? If you still see the problem, can you attach your downloaded CSV-file? I tried the download on multiple channels and I see a CSV-file with data. I've tryed with Chrome and Edge, same problem. There is attached the file downloaded. Thank you!! That file seems to have 1156 records as I see it. The data seems to be one minute apart, from 5/26 to 5/27. export csv data report
Guus Eltink in MATLAB Answers
上次活动时间: 2021-1-25

Tens of thousands of stored GPS data on ThingSpeak can be plotted much faster on a map in a simple way, if MATLAB would be willing to change the order of variables in the channel feed csv-file to make it match directly as input file for the ROUTECONVERTER program. I use a NEO-6M GPS module to store GPS data on ThingSpeak. I tried to find an easy way to plot many GPS coordinates on a map. However, within ThingSpeak there is no possibility to do so. Each time I was linked to Google maps for which I needed an API key to show my GPS results (it is a cumbersome method to finally see the GPS data on a map). I discovered that there is a much easier way to achieve this. ROUTECONVERTER ( www.routeconverter.com ) is a free, user friendly GPS tool to display, edit, enrich and convert routes, tracks and waypoints. It enables the use of a large number of maps, download of maps and supports specific Google maps for which an API key has to be filled in within the program. ROUTECONVERTER supports more than 81 of the most common GPS file formats. It automatically detects a file format, which thereafter can be converted to any other file format. One of the file types is the csv-file format which is also used by ThingSpeak. For THINGSPEAK the channel feed csv-file looks like this: Date&Time, Entry_id, Latitude, Longitude 2021-01-21 12:27:11 +0100, 15, 52.612135, 4.722695 But for ROUTECONVERTER the csv-file should have a format like this: Longitude, Latitude, a string of text (double quotes are needed, if comma’s or semicolons occur in this text string!) 4.722695, 52.612135, 2021-01-21 12:27:11 +0100 If the export csv-file of ThingSpeak would have the same format as the input csv-file for ROUTECONVERTER, it could be used immediately as an input file for ROUTECONVERTER and would therefore immediately show all GPS positions on a map. I presume that ThingSpeak/MATLAB would prefer to have “Entry_ID” and “Date&Time” to be inserted in their csv-file. This might be realized in the “text string” by using a specific character e.g. “#” (no comma’s and semicolons!) to separate both as can be seen below: Longitude, Latitude, Entry_ID # Date&Time 4.722695, 52.612135, 1 # 2021-01-21 12:27:11 +0100 Both items in the text string still enable immediate plotting of the GPS coordinates on a map by opening this file in ROUTECONVERTER and still enable easy splitting of the text string in an Excel spreadsheet. ThingSpeak only presents the field charts of both latitude and longitude against time, but these are absolutely not very helpful or clarifying. An adjusted export feed csv-file and a reference to ROUTECONVERTER in ThingSpeak would enable the GPS-ThingSpeak users to see immediate GPS results on a map. Therefore my question: Is ThingSpeak/MATLAB willing to adjust the format of their export feed csv-file in order to enable immediate plotting of GPS coordinates on a map by ROUTECONVERTER?
Cleophus in MATLAB Answers
上次活动时间: 2021-1-15

Hello everybody. Ich have built my own logging device for temperature and air-humidity. Everything worked fine. Now I moved the device to another room and I wanted to clear all the channel data. So I went into the channel settings and pressed the "Clear Channel"-Button. I was asked if I am sure and clicked OK. Then a message showed up telling me the channel is being cleared but unforzunately nothing happens. What am I doing wrong. Do you have any advice for me? Best wishes, Bernd
Jenna R in MATLAB Answers
上次活动时间: 2020-4-20

Hello all, For context to my issue, I have a Raspberry Pi successfully uploading pH, turbidity, and temperature sensor data to ThingSpeak using a basic program. I was asked to implement a way for the results to be uploaded even if there was no internet connectivity, so in Python, the results should save to a CSV file which will later be automatically uploaded when the program runs and has internet connectivity again. So, the logic is: If the Pi has internet, upload the sensor readings to ThingSpeak using the POST method. That's all. If the Pi does not have internet, save the readings to a CSV file. When the program is ran again, if the internet is still disconnected, it will save the readings to the CSV again by amending the file (not overwriting it). When the program is ran again, if the internet is connected, it will automatically upload the CSV file to ThingSpeak using the POST bulk-write CSV method. I have been searching the web for example code on how to get the bulk CSV upload for ThingSpeak working in Python. Most of the people asking for help are using the JSON method or Arduino code, but the ones who are using POST and Python (like I will be) have fixed their own issue without really going into detail on how they fixed it. I have checked the API thoroughly, but it is still confusing to me, even after checking out the examples that were in the MATLAB (such as this one: https://uk.mathworks.com/help/thingspeak/continuously-collect-data-and-bulk-update-a-thingspeak-channel-using-a-raspberry-pi-board.html ) Let me say that I am still quite new to Python/ThingSpeak. I've done my best to try to understand how the single write process works and apply it to the bulk write process, but I'm just drawing a blank. I guess my main question is that the URL in the API doesn't make sense to me: https://api.thingspeak.com/channels/channel_id/bulk_update.csv I understand I'm supposed to put my channel ID into the URL, but how does my CSV file data apply to the "bulk_update.csv" part of the URL? Am I supposed to read in the results of the CSV and insert them into the URL? Am I thinking about this the wrong way? For reference, here's the Python code I use to upload single entries (I cut out the parts of code that don't apply). Any help is greatly appreciated. import http.client import urllib import time import serial #Assign ThingSpeak read API key to a variable apiKey = 'XXXXXXXXX' def readSensors(): #Read sensor data (Code omitted, but it basically just grabs sensor data from the Arduino) return pH, turbidity, temperature def uploadReadings(): #ThingSpeak upload pH, turbidity, temperature = readSensors() params = urllib.parse.urlencode({'field1': pH, 'field2': turbidity, 'field3': temperature, 'key':apiKey}) headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"} conn = http.client.HTTPConnection("api.thingspeak.com:80") try: print("Attempting to contact ThingSpeak") conn.request("POST", "/update", params, headers) response = conn.getresponse() print ("Upload status: ", response.status, response.reason) conn.close() except: print("Connection failed") while True: uploadReadings() break
Yam Schuster in MATLAB Answers
上次活动时间: 2020-2-20

Hey, (sorry about my english) since yesterday I got , during CSV Upload, the Error message : "The file was not uploaded because it contains invalid location fields" My investigation, what is wrong with the csv-file, was not helpfull, I found nothing (for me) obvious wrong. The upload procedure I have done a lot of times in the past, w/o any issue!!! but now ????? (I double checked the file with Excel, notepad++, textpad... deleted rows in the file, added manualy some field values in an row,.... reduced a dummy file to only 10 rows.... ==> some times it worked, sometimes not.) What is the KEY Reason for this error massage? a certain coding? after checking since hours, trying different minor/major changes, I have no glue what is wrong. I need a simple hint in what direction or on what "Point (?)" I have to check?!?! .... The File I wants to upload is from TS downloaded -> deleted some (faulty) rows -> upload again. The Upload procedure I make 1000 of times in the past.... but since yesterday, I was not lucky. :-((( cheers & thanks in advance Joachim
Alberto Maccioni in MATLAB Answers
上次活动时间: 2019-5-8

I'm not able to perform the bulk update using either an embedded system (ESP8266) or sending a POST request via web based service (https://reqbin.com). I always get a 400 response with "The request cannot be fulfilled due to bad syntax." No problem using the standard write data interface (but of course it's limited to one message). The POST request content is (I have my key instead of XX): write_api_key=XXXXXXXXXXXXXXXX&timeFormat=relative&updates=4,1.1,2,0.3,6,7.7,0.8,0,0,41.2,9,1,ok I did a lot of trials changing the number of parameters and the time format, but always with the same result. Is anyone able to perform any kind of bulk update?
allan mitchell in MATLAB Answers
上次活动时间: 2018-9-11

I'm trying to extract readings from a single field on a feed at 12 hour intervals in csv fromat using a restful api GET method. If i use the following call: http://api.thingspeak.com/channels/XXXXX9/fields/4.csv?start=2017-01-01%2000:00&end=2018-01-01%2023:59&median=daily the returned file has a years worth of entries with one reading for each day. I had expected that if I used: http://api.thingspeak.com/channels/XXXXX9/fields/4.csv?start=2017-01-01%2000:00&end=2018-01-01%2023:59&median=720 that I would get a years worth of entries with 2 readings for each day but what I actually get is about a weeks worth of entries with 2 readings per day. I guess that a weeks worth of entries at one minute intervals corresponds to about 8000 data points which is the download limit. The "daily" parameter seems to overcome this restriction but I would like to know if there is a way to overcome the restriction using some kind of half day or quarter day interval. Thanks in anticipation.

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.