I have been working with Arduino's for a couple of year now and find them a fascinating, intuitive platform to work on.
I have been working on a couple of autonomous robot type project recently and a seamless interface between the micro-controller and peripheral modules is vital. A motor controller is a common modules on most robotic systems as a majority of micro controllers will not supply enough current to run motors.
The Pololu Qik 2s9v1 is an excellent product with many feature including built in Error detection and CRC checksums. Interfacing with the module is extremely simple through a serial connection at varying baud rate. There are a number of packages available on the web to control this module the most notable I have found is qik2s9v1arduino (code.google.com/p/qik2s9v1arduino/). It is an excellent library which is extremely simple to use and understand. However it does not make use of the module more advanced features such as the CRC error detection. The CRC feature is useful for those who wish to increase the reliability of there system by introducing error detection.
CRC is a cyclic redundancy check, it work by taking calculating a checksum on the data being sent to the module. This checksum is added to end of the data packet. When the module receives the data it hashes the packet and compares the checksum it created to the checksum you sent to it. If they match up then the integrity of the packet is complete and the packet and then be interpreted. If the checksums don't match the packet has not been transmitted correctly and the module will signal the micro-controller with an error. Packet corruption can be can be caused by a number causes including but not limited to:
* Noisy signal lines
* Loose connections
* Unstable power supply
* Software error
This library is based on the work in the before mentioned project however it has CRC features embedded and is ready for interrupt based error detection to be included. The CRC is added by an additional Class. There are reasons for not building the CRC into the controller class. That is that there are many algorithms to compute CRC (in this case CRC7). Some of these methods will do the arithmetics long hand each time and others will pre-hash all the values. There are advantages to both however that is beyond the scope of this. The method that the end user decides to use to generate the checksum is up to them as long as their CRC7 class implements the same interface as the one used in this system. The interface to the CRC7 Class can be found in the documentation (generated by dOxygen) which is enclosed in the attached file.
The CRC feature can be turned on or off at will (however the module will require the jumper to be removed and a reset for this to function correctly). The library makes use of the NewSoftSerial library written by Mikal Hart (available from arduiniana.org/libraries/newsoftserial/). As with the CRC7 object the NewSoftSerial object is passed by pointer and not hardwired into the class. This allows for other classes which exhibit an identical external interface to replace it at will.
The documentation for this system is quite complete and comprehensive however if you feel anything has been overlook please email edwilson1989 [AT] gmail [dot] com.
Note that this library is released as free software. It comes without warranty or being fit for purpose. You use this library entirely at your own risk.
PololuQik2_CRC.tar.gz (144 KB)