Hello,
There are many, many things to consider when designing a protocol like this. I don't know precisely what your application is, so I can only guess at something that might work for you.
There is no need to concatenate commas because floats are a fixed length (4 bytes on Arduino IDE). You can just send 12 bytes out (four bytes for each float). CAVEAT: this method will create a dependency on arduino's exact hardware float format, and the two arduino modules will have to be using the same machine architecture. If the data is read by some other machine architecture that uses a different float format you'll possibly have to do a nasty conversion of some kind. However, you said "arduino to arduino" so let's ignore that issue by assuming both arduinos use the same float format.
Now, you will need a header of some kind so you can be sure you're starting at the first byte of the first value. Plus, you really will want a checksum at the end because you are going to lose some data here and there due to static and noise. You do not want to log data that is possibly bad.
The checksum can just be the lower byte of the sum of all the data bytes. The header could be any magic number you like, I would suggest at least two characters.
An example protocol would be:
-
Literal string "SD" as header (start data).
-
four bytes for each of three floats. (You could do least significant byte first or most significant byte first, just be consistent on both sides of the connection).
-
A one byte checksum which is the lowest byte of the sum of the 12 data bytes. If this does not match on the other side of the communication, then you will ignore that data packet.
On the receiving side, you will flush data until you see the literal character 'S'. You'll then see if the next character is 'D'. (A simple state machine is a good way to do this). If you don't see a 'D' then you'll go back to the state where you're looking for an S. once you get both S and D, you'll read the next 12 bytes into a buffer then cast each 4 byte chunk into a float. Then, you'll go into a state where you wait for the checksum byte. Once you get that, you will see if it matches the sum of the 12 data bytes. If not, you throw away the packet and maybe log an error somewhere. If it's good, you do whatever you were planning to do with the data.
Again, I do not know all the particulars of your specific application, so I can't say whether or not the above is sufficient. If it's crucial for you not to lose any data, you'd have to implement some kind of retransmission protocol along with a packet numbering scheme, or you could implement a more sophisticated checksum method that allows for error correction.
For an example of protocol, here's the spec on the robot control protocol I use for Vorpal the Hexapod:
https://vorpalrobotics.com/wiki/index.php/Vorpal_The_Hexapod_Radio_Protocol_Technical_Information
Hope this helps,
Steve P.