The nRF905 is a radio transceiver IC similar to the well known nRF24L01, but operates at 433/898/915MHz instead of 2.4GHz, has a much longer range and a few extra IO pins. However the nRF905 data rate is only 50Kbps compared to nRF24L01′s 2Mbps.
This library offers quite a bit of flexibility: Optional use of interrupts, 2 of the connections to the module are optional since their states can also be accessed by the ICs status register, and supports basic collision avoidance.
Download from GitHub
||Stand by – High = TX/RX mode, Low = standby
||Transmit or receive mode – High = transmit, Low = receive
||Power up – High = on, Low = off
||Carrier detect – High when a signal is detected, for collision avoidance
||Address Match – High when receiving a packet that has the same address as the one set for this device, optional since state is stored in register, not used by this library
||Data Ready – High when finished transmitting/High when new data received, optional since state is stored in register, if interrupts are used this pin must be connected
Some of the module pin names differ from the IC pin names in the datasheet:
The nRF905 is not 5V compatible, so some level conversions will need to be done with the Arduino outputs, a simple voltage divider or resistor and zener diode will do the trick, only TXE, CE, PWR, SI, SCK and CSN pins need level conversion (not CD, AM, DR and SO).
The nRF905 has 511 channels ranging 422.4MHz – 473.5MHz in 100KHz steps on the 433MHz band and 844.8MHz – 947MHz in 200KHz steps on the 868/915MHz band (remember to check which frequencies are legal in your country!), but each channel overlaps adjacent channels so there is only a total of 170 usable channels at once.
Searching for nRF905, PTR8000 and PTR8000+ should yield some results for modules on Ebay and DealExtreme, you should be able to get 2 for around £10.
Library coding tips
- http://blog.zakkemble.co.uk/wp-content/themes/graphene/images/list-style-image.png);">You can call nRF905_receive() straight after calling nRF905_sendData(), this makes the radio go into receive mode once the payload has finished transmitting.
- http://blog.zakkemble.co.uk/wp-content/themes/graphene/images/list-style-image.png);">Calling an nRF905_set***() function will put the radio into standby mode (radio must be in standby mode to change registers), if you want it to carry on receiving you must call nRF905_receive() again.
Nitty-gritty radio stuff
Actual air data rate of nRF905 is 100Kbps, but the data is Manchester encoded which halves it to 50Kbps. The modulation is GFSK with ±50KHz deviation. The radio also adds a few extra bits of data to the address and payload; a preamble and CRC.
1 or 4 bytes
1 – 32 bytes
0 – 2 bytes
The CRC is used to detect errors in the received data. Having a CRC doesn’t eliminate all bad packets, there is always a small chance of a bad packet passing the CRC. Using larger CRCs helps to reduce the chance.
The sizes of the address, payload and CRC can be adjusted for a balance between throughput and latency.
Throughput and latency for each configuration
|Config #||Throughput (bps)||Latency (ms)|
Throughput is how much useful data can be sent (the payload part), assuming no delays for setting the payload.
Latency is how long it takes for the transmission to complete.
Switching from standby mode to receive or transmit mode takes max 650us and switching between receive and transmit modes takes max 550us.
Transmission time can be worked out with:
t = tstartup + tpreamble + ((Naddress + Npayload + NCRC) / BR)
tstartup is the time to switch mode as stated above (650us / 550us).
tpreamble is 200us for the 10 bit preamble.
Naddress, Npayload and NCRC are the address, payload and CRC sizes in bits.
BR is the bit rate which is 50,000.
For config 1, switching from standby to transmit:
t = 0.00065 + 0.0002 + ((32 + 256 + 16) / 50000)
t = 0.00693 seconds (6.93ms)