Electronic – arduino – A visible light communication question concerning a preamble sequence

arduinocommunication

I have a question about preamble and preamble breaker.

I am implementing a simple visible light communication using arduino. I have used a Manchester encoding scheme. While I have understood that a preamble is required in order to have a synchronization at the word/packet level since Manchester encoding is helpful only at the bit level and not at the word or packet level, I am not sure what properties the preamble should have.

At this point I have tried sending a simple message like "Hello World" using a preamble of 10101010. I sent this without much understanding of a suitable sequence for the use as a preamble. I have sent two preambles like that, a "preamble breaker", and a Start of frame byte before the transmission of actual data, ending the whole frame with the ETX(End of frame)

Just before sending the STX(start of the frame), for preamble breaker I selected 00101010 with just the last bit differing.

Could someone please explain me the choice of a suitable preamble and also if such a preamble breaker is necessary because there is already a Start of Frame byte(0x02 in my case) before actual data is being transmitted?

Thank you.

Edited the two extra bits in preamble to make it a byte.

Best Answer

Preamble are used for byte level synchronization in the Ethernet Layer which is basically a byte oriented protocol, unlike HDLC a bit oriented protocol it works on frames/packets which are byte sized.

In all the developed protocols the synchronization of the bits,bytes and packets has remain a topic to deal with and various algo has been developed for efficient overhead generation. In bit oriented protocols Flags are used which are represented as 01111110 sequence of bits which helps to identify the start of the frame, when this sequence was identified in the payload it was replaced by the receiver.For more information see bit stuffing.

In case of byte-stuffing protocols such that Ethernet preamble is used to synchronize the bytes,same problem can arise for byte-stuffing also where data may be appear as the preamble pattern inside the payload, to avoid this various types of algorithms are used as stated, and special ESC bytes are stuffed in between when flag or additional ESC occurs in data.

Considering your case it depends which type of compatibility your system desires, you can design variable preamble but the main idea will be to limit its occurrence, i.e using a less likely pattern which reduces the times your receiver will encounter data same as that of your preamble.

Its purely a system dependent call, you can simplify you design ,if your data is limited to alphabetical and numerical context, then any special character in extended ASCII can be used as preamble, but if it involves complex data types, and formats then ofcourses you will need to generate a preamble code wisely, also it is rather suggested to go according to the IEEE standards.