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 1200 baud. I tested 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 2400 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.
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 and 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 pattern such as in the header byte. Using the header byte effectively reduced unwanted IR noise to zero.
The second byte contains the actual data of the virtual bullet
p p p p t t x y Where p = Player ID t= Team ID x=indicates single or burst shot y = Parity byte
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 3 and 4 are the team ID. The x bit indicates if the shot was one of a burst of bullets or a single shot. The final bit, y, is the parity. This is included to hopefully avoid data corruption and although being only one bit it is not 100% fool proof, it seems to work pretty well.