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.
|CE||D7 (13)||7||Standby – High = TX/RX mode, Low = standby|
|TXE||B1 (15)||9||TX or RX mode – High = TX, Low = RX|
|PWR||B0 (14)||8||Power up – High = on, Low = off|
|CD||D2 (4)||2||Carrier detect – High when a signal is detected, for collision avoidance|
|AM||–||–||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|
|DR||D3 (5)||3||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
NOTE: On Arduino Mega change INTERRUPT_NUM to 5 in nRF905_config.h and for Arduino Yun it should be changed to 0.
|SO||B4 (18)||12||SPI MISO (Mega pin 50)|
|SI||B3 (17)||11||SPI MOSI (Mega pin 51)|
|SCK||B5 (19)||13||SPI SCK (Mega pin 52)|
|CSN||B2 (16)||10||SPI SS|
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).
UPDATE: Use 470R instead of
4k7 and 1k instead of 10k
UPDATE: Use 470R instead of 4k7
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
- You can call nRF905_receive() straight after calling nRF905_sendData(), this makes the radio go into receive mode once the payload has finished transmitting.
- 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 that chance.
The sizes of the address, payload and CRC can be adjusted for a balance between throughput and latency.
|Address||Payload||CRC||=||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 a maximum of 650us and switching between receive and transmit modes takes a maximum of 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)
A note to developers: This library loads the address bytes in reverse order, keep that in mind if you try to use this library to interface with other radio systems!