Sending Telemetry with Serial in one time or Seperately?

Hello everyone, I have question about sending telemetry.
Assume that my telemetry looks like that:
<111>,<15>,<15.00>,<30.00>,<15.00>,,<15.00>,<15.00>,<15.00>,<15.00>
I’m sending this telemetry with Serial.print(telemetry) everything is okay its working in test However,
I’ll do this with Xbee so, I’m thingking that Is the distance effect this telemetry?

If I send telemetries one by one Is it more accurate or nothing going to change?
(Sending in one package is more easier)

Sending one by one ex :
Serial.print("<111>,");
Serial.print("<15>,");

Maybe the receiver, about which you say nothing, demands data formatted like this, but it all looks a bit weird, and probably smothered in technobabble. You appear to be simply Serial.printing comma-separated data, just like anybody else would, but using superfluous markers - </>, and converting numbers to text. This doesn’t mean it won’t work but may mean you are wasting time and resources. This may be because it looks like plain-vanilla data from a sensor or w.h.y., but are actually dummies that you have made up. I think you need to explain this, and posting your entire code would be a good idea.

Essentially, sending coherent data anywhere need be not that much different from sending it to the serial monitor

Further, while sending a single package is indeed easier than sending several, the benefit is unclear, as you have to assemble the package from the several - and you seem to be making a particularly hard job of it. No advantage in accuracy either.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

What are you testing with at the moment, model Arduino, RF tx/rx?

Thanks.. Tom... :slight_smile:

@mecxpmk

Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

There is no difference between

Serial.println("<111>,<55>");

and

Serial.print("<111>");
Serial.print(",");
Serial.println("<55>");

Whatever you print is first placed in a software buffer from where it will be read and transmitted.

Note that the buffer is 64 bytes; trying to put more in there will block your code till there is space.

Are you sending the data using the Xbees in transparent mode rather than API mode?

Xbees in transparent mode are susceptible to Tx buffer overflow which results in corrupted data at the receiving end.

You can minimize the risk by using the Xbee CTS hardware flow control combined with a slow baud rate and short Serial.print statements.

Essentially you sit in a loop checking to see if the sending Xbee is ready to accept data from the Arduino. If so then you send a small chunk of data, wait a few milliseconds, then check the sending Xbee to see if you are allowed to send more data and so on.

Nick_Pyner:
Maybe the receiver, about which you say nothing, demands data formatted like this, but it all looks a bit weird, and probably smothered in technobabble. You appear to be simply Serial.printing comma-separated data, just like anybody else would, but using superfluous markers - </>, and converting numbers to text. This doesn’t mean it won’t work but may mean you are wasting time and resources. This may be because it looks like plain-vanilla data from a sensor or w.h.y., but are actually dummies that you have made up. I think you need to explain this, and posting your entire code would be a good idea.

Essentially, sending coherent data anywhere need be not that much different from sending it to the serial monitor

Further, while sending a single package is indeed easier than sending several, the benefit is unclear, as you have to assemble the package from the several - and you seem to be making a particularly hard job of it. No advantage in accuracy either.

Okay Nick I will Remove the unnecessery part which is “<” and “>”.

mikb55:
Are you sending the data using the Xbees in transparent mode rather than API mode?

Xbees in transparent mode are susceptible to Tx buffer overflow which results in corrupted data at the receiving end.

You can minimize the risk by using the Xbee CTS hardware flow control combined with a slow baud rate and short Serial.print statements.

Essentially you sit in a loop checking to see if the sending Xbee is ready to accept data from the Arduino. If so then you send a small chunk of data, wait a few milliseconds, then check the sending Xbee to see if you are allowed to send more data and so on.

Most Probably it will be in transparent mode. I mean when I send the data I will wait for the response from computer which is about Okay… I got the whole data , that means its transparent mode.
I wrote Functions for my code to send it via Serial in one time. And I will use actually STM32 Blue Pill with arduino botloader.

Those things for my Satelleite. Maximum distance will be 700 meeters or 800 meeters. after that distance will decrease second by second and I have to catch telemetries.

I will use Baudrate as 9600.

String Communucation::prepareString()
{

    
    String will_return;
    will_return +=String(TEAM_ID)+",";
    will_return +=String(package_number)+",";
    will_return +=String(data.pressure)+",";   
    will_return +=String(data.altitude)+",";
    will_return +=String(data.temperature)+",";      
    will_return +=String(data.SatelleiteStatus)+",";
    will_return +=String(data.pitch)+",";            
    will_return +=String(data.roll)+",";
    will_return +=String(data.yaw)+",";
    will_return +=String(data.turn_number); 
    return will_return;
}

void Communucation::sendtoGround()
{   
    Serial.println(prepareString());
}

Google CSV data.

It may save you a lot of time and trouble and is a widely accepted format.

Bob.

ballscrewbob:
Google CSV data.

It may save you a lot of time and trouble and is a widely accepted format.

Bob.

Bob thank you for your answer but the main question is :
Which one is the best choice for sending data like this style:

String whole_telemetry = "111,15,15.00,30.00,15.00,SEPERATING,15.00,15.00,15.00,15.00";
Serial.println(whole_telemetry);

or
Is this a best choice for sending data like this style:

String first_data = "111,";
String second_data = "15,";
String third_data = "15.00,";
String fourth_data = "30.00";
String fifth_data = "15.00";
Serial.print(first_data);
Serial.print(second_data);
Serial.print(third_data);
Serial.print(fourth_data);
Serial.print(fifth_data);
// And continue....

Which one is more preferable? Does it make difference while I communucating with two Xbees at the long distance?
By the way telemetries will be transfered in 1Hz.

If this was my project I would send the data like this <111,15,15.00,30.00,15.00> as a single message and receive it with the parse example in Serial Input Basics

Separately, it is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. This can happen after the program has been running perfectly for some time. Just use cstrings - char arrays terminated with ‘\0’ (NULL).

…R