Read rectangular coordinates in a channel | ESP Wi-Fi | 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
Read rectangular coordinates in a channel
No permission to create posts
November 1, 2018
9:50 pm
Avatar
alejandra84

Silver
Members
Forum Posts: 6
Member Since:
October 4, 2018
sp_UserOfflineSmall Offline

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

Exported-data.PNGImage Enlarger

sp_PlupAttachments Attachments
November 1, 2018
9:59 pm
Avatar
alejandra84

Silver
Members
Forum Posts: 6
Member Since:
October 4, 2018
sp_UserOfflineSmall Offline

This is my code:

November 1, 2018
10:04 pm
Avatar
alejandra84

Silver
Members
Forum Posts: 6
Member Since:
October 4, 2018
sp_UserOfflineSmall Offline

Captura-1.PNGImage Enlarger

Captura-2.PNGImage Enlarger

Captura-3.PNGImage Enlarger

Captura-4.PNGImage Enlarger

Captura-5.PNGImage Enlarger

sp_PlupAttachments Attachments
November 2, 2018
3:36 pm
Avatar
cstapels
Moderator
Members


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

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.

November 4, 2018
5:05 pm
Avatar
alejandra84

Silver
Members
Forum Posts: 6
Member Since:
October 4, 2018
sp_UserOfflineSmall Offline

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.
Ejemplo-datos-excel.PNGImage Enlarger

N°-de-datos.PNGImage Enlarger

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.

sp_PlupAttachments Attachments
November 6, 2018
9:36 pm
Avatar
alejandra84

Silver
Members
Forum Posts: 6
Member Since:
October 4, 2018
sp_UserOfflineSmall Offline

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:

CSV.PNGImage Enlarger

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

sp_PlupAttachments Attachments
November 12, 2018
11:06 am
Avatar
cstapels
Moderator
Members


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

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?

Forum Timezone: America/New_York

Most Users Ever Online: 166

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