Implementing CSMACA for the SmartPacketRadios

One of the projects during my research visit at the Monash University’s Wireless Sensor and Robot Networks Laboratory was the implementation of CSMACA for the SmartPacketRadios. The SPRs run on an Atmel AT90USB1286 microcontroller and the Hope RFM22B transceiver. It was lots of fun to program and play around with the sensor nodes. So far, they used ALOHA for the MAC layer. A new shipment of nodes was just rolling in to extend the testbed in Clayton. Thus, a more sophisticated MAC protocol was required to minimize message collisions.


The CSMACA implementation is pretty straightforward. Before the actual transmission, the node checks if the medium is busy, and if an ongoing transmission is sensed, the message is deferred with a randomly calculated backoff. Otherwise, the node proceeds to transmit the frame. The RFM22B transceiver provides clear channel assessment (CCA) functionality that can be conveniently used for this purpose. When the received signal strength exceeds a specified threshold, an interrupt is thrown which aborts the current transmission attempt. The firmware with the CSMACA implementation is open source and available at Google code.

In a first test, we set up on SPR node was configured as sink node to receive packets. Up to 4 source nodes generated 1000 packets each and transmitted these to the sink as fast as possible. The total number of all transmission attempts (successful and failed) is regarding the MAC protocol and the number of source nodes is shown in the following plot. As shown in the following plot, with ALOHA, about 1200 transmission attempts per node were required and only 1020 with CSMACA. As expected, the carrier sensing of CSMA helps to reduce the overall transmission attempts, especially with the growing number of source nodes.


Posted in code Tagged with: , , , , , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *