Communications Protocol

The Libre Tag communications protocol is based on serial transmission over IR. By using serial transmission and Picaxe chips, the complexity of sending data over IR is greatly reduced.

The serial protocol is transmitted at 2400 baud. I tested it at 4800 baud and found I was getting data corruption problems, possibly caused by slow response of the IR receivers. Looking at the specs for the IR receivers 4800 baud maybe possible, however the amount of data currently being transmitted at the moment still allows for hundreds of rounds per second even at 1200 baud. For this reason I see no reason to try and get higher baud rates working at the moment.

Everytime you press the trigger, assuming you have bullets left a virtual bullet is transmitted from the gun. Each virtual bullet, or data packet, contains a header byte followed by the data byte(s). The header byte consists of:-

‘10101010’ or ‘170’ in decimal.

The primary purpose or the header byte is to make sure the receiver knows that any infra-red that it receives is actually something to do with the Libre Tag system. During development I found that it was quite common for blocks of 1’s or 0’s to be incorrectly generated by the IR receiver. However never did I see it generate a random pattern that matched the header byte. Using the header byte effectively reduced unwanted IR noise to zero.

The second byte and third bytes contains the actual data of the virtual bullet. The third byte is just a copy of the second and allows the receiving gun to check that it is receiving the correct data. If more data is needed to be transmitted in the future, it maybe necessary to rethink this data integrity check and go with something with parity as is used in RAID 3.

p p p p t t x y

p=Player ID    t=Team ID
x=unused         y =unused

The last 4 bits (remember binary goes from right to left) of the byte are the played ID of the player shooting the bullet, bits 4 and 3 are the team ID. The x and y bits are currently unused, they maybe used in future to indicate what gun the virtual bullet came from so variable damage can be applied. Or I may use the extra 2 bits to extend the protocol to support 32 players. A complete a example of a Virtual bullet is below

hhhhhhhh   ppppttxx   ppppttxx

If a gun receives a byte that contains the player 0, it is handled differently. Player 0 is used to send system commands between guns or other devices communicating on the LibreTag protocol. A complete example of a command transmission is below

hhhhhhhh   ppppxxxx   ppppxxxx   yyyyyyyy  yyyyyyyy  zzzzzzzz   zzzzzzzz

h=Header Byte   p=PlayerID (will be 0)
x=Not Used         y=Command Code
z=Command Parameters (If needed)

Comments are closed.