9:50 pm


Silver
October 4, 2018

I every one, I have the following problem:
I'm working with an ESP32, a LIdar lite v3 and two servos, I'm trying to upload the data that I collect with Lidar, this data are rectangular coordinates like this:
0 0 119
3 0 93
5 0 77
5 0 55
4 0 33
3 0 22
The problem is, that I can see I am uploading "something" but when I want to export the data, I have nothing (attached the "supose data")
I dont know waht i'm doing bad, clearly is wrong,I need the data as it is, to analyse with matlab.
Please your help, I'm desperate
9:59 pm


Silver
October 4, 2018

10:04 pm


Silver
October 4, 2018

3:36 pm


Moderators
March 7, 2017

Each thingspeak feed has a timestamp, eight fields of data, latitude, longitude, elevation, and status. Each field is a string that is 255 characters (except the position info)
Can you label where you want your data to appear?
i.e.:
time1 field1 field 2 field 3
2018-1-1:18:0:0 0 0 119
time2 field1 field 2 field 3
2018-1-1:19:0:0 3 0 93
time3 field1 field 2 field 3
2018-1-1:19:0:0 5 0 77
etc.
Alternatively, you could write the whole thing as a string that would be recognized by MATLAB as an array.
Something like:
field1=[0,0,119;3,0,93;5,0,77;5,0,55;4,0,33;3,0,22]
Then if you read the data from thingspeak, MATLAB can easily convert it to a matrix, though thingspeak will think of it as a string.
The Thingspeak communication library is now compatible with ESP32. I think it would be much easier to use that than formatting the HTTP commands yourself.
Look here:
https://github.com/mathworks/thingspeak-arduino
There is an ESP32 example in the examples included in the library.
5:05 pm


Silver
October 4, 2018

Hi,
Thanks for the answer, I can understand and I have seen the information that you post, really thaks.
Howevwr I still have problems, I'm so sorry, let me explain a little bit, maybe is too simple, but really I can not see. The Lidar is taking the rectangular coordinates, I can take more or less data depends on the degrees of the servo, so much more degrees less data, and viseversa. So what I´m doing now y copy and paste all the data on my serial monitor in an excel sheet, then I load this in matlab and then calculate the volume of the point cloud that describes the LIDAR.
So, all the data that I copy and paste from my serial monitor I attach some pictures, first whith and example how I have the data on serial monitor, better to say how I copy and paste the data from the monitor.
At the oher attachment "N° de datos you can see the number of it 5265.
I think I'm a little far, please your help.
9:36 pm


Silver
October 4, 2018

Hello,
i have done some changes to my code, but I´m getting now this kind of information when I export the data in csv:
This is part of my code:
String data_to_send = api_key;
data_to_send += "&field1=";
data_to_send += (String) value1;
data_to_send += "&field2=";
data_to_send += (String) value2;
data_to_send += "&field3=";
data_to_send += (String) value3;
client.print("POST /update HTTP/1.1
");
client.print("Host: api.thingspeak.com
");
client.print("Connection: close
");
client.print("X-THINGSPEAKAPIKEY: " + api_key + "
");
client.print("Content-Type: application/x-www-form-urlencoded
");
client.print("Content-Length: ");
client.print(data_to_send.length());
client.print("
");
client.print(data_to_send);
Some advice?
Thanks
11:06 am


Moderators
March 7, 2017

You need a '?' before the first parameter.
...
data_to_send += "?field1=";
data_to_send += (String) value1;
data_to_send += "&field2=";
...
I would add Serial.println(String(data_to_send)); at the end to make sure its formatted correctly.
You might try formatting the request in POSTMAN before you program it, to make sure you have it right.
Does the ? work for you?
Most Users Ever Online: 166
Currently Online:
28 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:
huldacormier, bogart, estebanmateo93, mikewrite, onlinebusiness, winzy99Moderators: cstapels: 460
Administrators: Hans: 405, lee: 457