GitXplorerGitXplorer
j

lakrits

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
3a4790d126644ab821f3a0585bee04c3d2a64691

Update README.md

jjpettersson committed 13 years ago
Unverified
36e2fdf59b5a1653ddeb38f3c1151ac35906926a

Updated documentation

jjpettersson committed 13 years ago
Unverified
71dd04f45e798d0447e6524997633c35fa8a155d

Updated the ruby implementation to use Integers instead of Strings in the payload Array. Updated the ruby documentation.

jjpettersson committed 13 years ago
Unverified
2e9ed958040f6deef79ac7355e0335d49a5d6c68

Switched to the MIT License

jjpettersson committed 13 years ago
Unverified
af431623fe4b83c46fdcc7f2f274374e92587506

Updated examples

jjpettersson committed 13 years ago
Unverified
a5be2d3ac90b013c5940644055fc379745c7f59e

Removed the incomplete arduino documentation for now

jjpettersson committed 13 years ago

README

The README file for this repository.

#lakrits - a tiny communications protocol. Suitable for AVR and other microcontrollers with limited memory.

##Features

  • 16 bit addressing
  • 16 bit message type
  • LRC error checking
  • 64 byte payload per message

Example implementations are available for Arduino and Ruby.

##Specification

Several lakrits devices can be connected simultaneously over a wireless connection like XBee (Series 1 and 2). In theory the devices could be connected electrically, but more effort would have to go into avoiding data collision and better error handling since the XBee does a lot of this for you. The current implementation of the protocol assumes a star topology and can only send messages back and forth between the server and the devices.

A lakrits device send and receive messages. A message is transferred in the form of a packet. A packet consist of a header, a payload and a trailer. The header is divided into 8 bytes and contains the "start of transmission" byte, addressing, message type and payload length. The payload begins directly after the header and continues as defined by the payload length value. After the payload, the trailer follows with a LRC checksum that is calculated over all the bytes between STX and the end of [payload]. The LRC checksum is followed by a "end of transmission" byte.

[STX 0x02			]	Start of transmission.
[recipient id low	]	The low 8 bits of the receiving device id.
[recipient id high	]	The high 8 bits of the receiving device id.
[sender id low		]	The low 8 bits of the transmitting device id.
[sender id high		]	The high 8 bits of the transmitting device id.
[message type low	]	The low 8 bits of the message type.
[message type high	]	The high 8 bits of the message type.
[payload length		]	Indicates the number of bytes in the payload.
[payload			]	The payload can be up to 64 bytes long.	
...						
...
...
[LRC Checksum		]	
[ETX 0x03			]	End of transmission.

##Why?

I created lakrits to power my home automation system. I needed a reliable way of transmitting tiny messages between a server and a lot of sensors and actuators. At the time I needed to concentrate on the harder problem of designing the automation system and various ways of controlling it, so I decided to stick to the minimal requirements and create the messaging protocol myself.

I learnt a lot about serial communication while building this and the system has been running almost flawlessly for over a year, so I figured I'll make it available in case anyone is on the same journey as I was.