The tiny NRF24L01 modules you see in the photo to the right (the module handing off the board to the left) make great short distance communication units for Arduino projects – using the RF24 library. The main attraction of these radio units is their cost – under £2 each module from China (Ebay). The downside is they are short range, maybe 80 metres or so in a straight line but dramatically less through walls. The main board you see is something I put together as a general purpose Arduino-compatible board, soon to be revised.
I’ve done a fair bit of experimenting with these radio modules as they make really cheap radio communications possible – the RF24 library works ok but the first thing to do is change the default 1Mbps data rate to 250Kbps. Still quite fast, considering you only send short packages – but this adds maybe 50% to the range depending on obstacles. I found the variations with a better aerial were only marginally better than these green10-pin modules.
The real breakthrough is to use these in a network – I have scoured the web and found almost nothing out there to do the job –some academic half-finished projects… but there is one… RF24NETWORK. I had to go into the main library file and change the speed (one location, easy to find) and in the test file do the address assignment in code (the example accepts a single digit from the serial input – if you don’t have anything attached to the input and leave it floating, you’re asking for trouble as the format is too simple – but then I am just talking about an example – one would assume you’d burn in the address by another method in production.
The fellow has documented everything well but beginners beware – if you see a leading zero, he’s using OCTAL (base 8, ie 0 1 2 3 4 5 6 7 10 11 etc.) numbers which threw me off for a few minutes…
So the idea is you connect units in a tree structure… the root is device ID 0… then at the first level up you have devices 1,2,3,4,5. The modules can listen to 5 channels at once so that’s how he’s based his network – here’s where the octal comes in -siblings of device 2 would be 012,022,032,042,052 (they are Octal numbers). Any of those 5 can listen to 5 more etc. It is possible to put thousands of modules in this network (though I would not recommend it) and I’ve already proven to myself that it works by making 3 units (the photo above is a board I designed some time ago as a general-purpose Arduino board) and spacing them so that the last board could not possibly communicate with the first one by sheer distance.
Works a treat – well worth investigating. Here is a conversation (with debugging turned on) and you’ll see the messages being passed around. Note line 8014. This log is coming from device 0.
Update May 2013: This article was originally written in 2012. Note that I have written a later article here – there are still issues with the networking software as you will see.