I am looking for a serial protocol, preferably with a library for Arduino and Java/Android, with delivery confirmation and some sort of message integrity check.
Any suggestions?
I have been using Firmata and it does the job quite well, but it doesn't support the above.
PPP (Point to Point Protocol) is the Internet protocol fro serial lines. You can implement TCP over that to get checksums, retries, guaranteed in-order arrival, etc.
The CANbus spec includes both a CRC check for integrity and an ack message for receipt. It is a "broadcast" protocol in which the transmitting node sends a message (frame) and any node that receives it is entitled to ack it. Whether the receiving node uses the message or not depends on what masks and filters are set, and how the MCU is programmed to use (or not use) the data. So, data integrity is ensured. Also, simultaneous messages or near simultaneous messages, can't conflict as there is a robust adjudication process. Thus, you are always assured that SOME receiving module has gotten an intact message. What you can't know without some more work is whether a particular intended recipient has gotten it. CAN does need some extra hardware. On the 8-bit Arduino series, you need both a CAN controller and CAN transceiver for each node. The Due has two CAN controllers built in, but you'd still need to add transceivers.
There is a hefty learning curve to CAN, but it is a very robust protocol. You'll find some fairly informative CAN threads here, and lots of data sheets and application notes at the Microchip web site. There's also a CAN forum there for when you get in trouble.
Lenny, thanks for the informations.
I came across the CANBus shield, but I couldn't find any CANBus library for the Arduino.
Just to be clear, I am after a library that runs over serial, in the Arduino, so I can apply the protocol to a bluetooth serial connection.
I am surprised that such library isn't overly popular yet, as there are plenty of robots out there being controlled by and android bluetooth connection.
I would have thought that integrity check and delivery confirmation would be a must for this type of devices.
Alternatively, I have started implementing CRC check on top of firmata. Let's see how it goes.
CANbus is CANbus and does not mix well with other serial protocols, and any link to an android device or bluetooth will not be by CANbus (unless you can find Android and bluetooth CAN programs and hardware). Your original post essentially talked about robust communication, and CANbus excels at that - that's why Bosch invented it for heavy machinery and why it's become the basis of automobile systems. BUT, it is a thing "apart".
There is no "standard" Arduino CANbus library, and most of the libraries about are aimed at people who want to use an Arduino to read their motor vehicle's data stream, not for people who want to implement a CANbus. Nevertheless, you can find a thread in the Due forum about developing a CAN library for the due, and a thread I started in Project Guidance, but with important contributions from several people, about a multi-node CANbus project. I don't think that CANbus will do for you, now that you've added a bit more about what you want to accomplish, but to satisfy your own curiosity you might want to look at those threads.