«

»

Jan 01 2013

nRF905 AVR/Arduino Library/Driver

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
Documentation

nRF905 ATmega48/88/168/328 Arduino Uno Description
VCC 3.3V 3.3V Power (3.3V)
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
GND GND GND Ground

Some of the module pin names differ from the IC pin names in the datasheet:

Module IC
CE TRX_EN
TXE TX_EN

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).

Divider
UPDATE: Use 470R instead of
4k7 and 1k instead of 10k
Zener
UPDATE: Use 470R instead of 4k7
res_div zener

nrf905_bb

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.


Transmitted packet

Preamble
10 bits
Address
1 or 4 bytes
Payload
1 – 32 bytes
CRC
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.

Transmission time
The sizes of the address, payload and CRC can be adjusted for a balance between throughput and latency.


Example configurations

Address Payload CRC = Throughput (bps) Latency (ms)
4 32 2 = 36940 6.93
1 4 1 = 17680 1.81
1 1 0 = 6838 1.17


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!

475 comments

1 ping

Skip to comment form

  1. HexiuM

    Hi Zak,
    I have been using your library lately and it is a huge improvement compared to the crippled version I got from my supplier of nRF904. Thank you!

    However, I am observing a discrepancy in the frequency set by nRF905_setFrequency and nRF905_setChannel.

    In detail, if I use nRF905_setFrequency(NRF905_BAND_868, 863000000UL);
    I get an SPI configuration (130:14:68:32:32:204:204:204:204:88)

    whereas if I use nRF905_setChannel(NRF905_BAND_868, 91);
    I get (91:14:68:32:32:204:204:204:204:88) as expected since 863 = 844.8 + 91*.2

    I do not know if I am doing something wrong here but I suspect there might be a library problem with the frequency calculation method.

    I would be grateful if you could check this.

    Thank you.

    1. Zak Kemble

      Ah, NRF905_BAND_868 and NRF905_BAND_915 are defined as the value 2, but when they’re used in calculating the channel they should be 1. I will have to get that fixed, thanks for notifying me about it. 馃榾

  2. Baris

    Hi Zak,

    I just bought two of nRF905 modules but cant imagine how to control servos and other escs via the same atmega320, is there a way to communicate with another atmega329 chip via SPI? because ure using main SPI?

    1. Zak Kemble

      There’s no reason why a single ATmega328 can’t control an nRF905 and a bunch of servos and ESCs, there are Arduino libraries available that can control up to 12 servos with a 328 (mostly limited by the number of pins available).

  3. Fritz

    Hi Zak,
    because so far I’ve found nowhere so much to know about the nRF905 as with you, I dare to ask slightly different I’m flying wih gliders and use as an anti-collision system FLARM (transmitting on 868.2 or 868.4 MHz position data) and’ve been trying quite a while to receive my transmissions with a SDR-RTL dongle (which I’ve already done with 1090MHz ADS-B). I know that the built-in FLARM nRF905 encrypts the important data (address(3byte, data(24byte, and noCRC)because of this encryption, I have not yet found away to discover the preamble of which I only know that it is 10bit long.
    Now finally to my questions:
    Is it predictable via frequency and bit rate (probably from hex – to hex)
    Is it the same for each device?
    I’ve got 10 seconds rtl_fm recorded with HDSDR i ‘heard’ 10 times arriving frames , this file would be helpful for you?
    Could you identify the preamble, if I send you my transmitting FLARM?,

    Again I’m sorry because my question are so far away from your project but I hope nevertheless to helpful tips.
    Thanks for everything
    Fritz

    1. Zak Kemble

      Hey,
      The nRF905 datasheet says the preamble is a predefined bit sequence, so I guess it’s the same for all nRF905s. It shouldn’t be too hard to identify and ignore the first 10 bits of the transmission, but don’t forget that the transmission is Manchester encoded, it will look like 20 bits @ 100Kbps before decoding it.
      I’ve only used an SDR for listening to stuff, I haven’t done any capturing and decoding with it yet so I won’t be able to help in with that.
      This might be useful, though – http://www.embeddedrelated.com/showarticle/548.php

    2. filou

      Fritz,

      maybe the below data (which is available on the net) can be useful for decoding.
      Would be interesting to be able to decode FLARM using nRF905 and Arduino.

      > TECHNICAL DETAILS
      >
      > The RF link is built around a standard chip, the Nordic nrf 905. Its microprocessor interface is a standard SPI connection, plus some status lines (mirrored into a status register) and an IRQ line.
      >
      > This chip can operate in different RF bands simply changing the internal PLL programming.
      >
      > All the timing is done with a single 16 Mhz quartz crystal (but other frequencies can be used, software selectable).
      >
      > The device initialization includes the chosen frequency, the packet length, the sync word (VERY important: without the right word the RF stream will be ignored), the type of transmission, and other parameters.
      >
      > The device initialization in this application (for the V4 protocol) is, in Hex:
      >
      > 75 0e 33 18 18 93 9a 0c ff d8
      >
      > For the RX / TX operations, refer to the data sheet of the Nordic chip.
      >
      > The transmission is done randomly between 0.8 and 2.0 seconds.
      >
      > The data packet exchanged, that has the length of 24 bytes, contains the data as described below.
      >
      > Legenda:
      > – the fix bits are marked with 0/1
      > – the known fields are marked with letters and explained
      > – the unknown bits are marked with x
      >
      > Note that for basic use, the x bits are not necessary, especially for the operation of sole reading of the radio packets received.
      > 16 bytes are encrypted, in two blocks of 8, with the encryption algorithm explained below.
      >
      > Below follows the meaning of the bits, AFTER the decoding process.
      >
      > Byte n. contained bits
      >
      > 0 AAAA AAAA
      > 1 AAAA AAAA
      > 2 AAAA AAAA
      > 3 x x 1 x 0 0 0 0
      > 4 LLLL LLLL 1st byte of the 1st chunk of coded data (see later)
      > 5 LLLL LLLL 2nd byte of the 1st chunk of coded data
      > 6 NNNN NNNN 3rd byte of the 1st chunk of coded data
      > 7 NNNN NNNN 4th byte of the 1st chunk of coded data
      > 8 HHHH HHHH (7..0) 5th byte of the 1st chunk of coded data
      > 9 VVVH HHHH (2..0)(12..8) 6th byte of the 1st chunk of coded data
      > 10 1VVV VVVV (9..3) 7th byte of the 1st chunk of coded data
      > 11 ZZTT TTxx 8th byte of the 1st chunk of coded data
      > 12 SSSS SSSS 1st byte of the 2nd chunk of coded data (see later)
      > 13 ssss ssss 2nd byte of the 2nd chunk of coded data
      > 14 KKKK KKKK 3rd byte of the 2nd chunk of coded data
      > 15 kkkk kkkk 4th byte of the 2nd chunk of coded data
      > 16 EEEE EEEE 5th byte of the 2nd chunk of coded data
      > 17 eeee eeee 6th byte of the 2nd chunk of coded data
      > 18 PPPP PPPP 7th byte of the 2nd chunk of coded data
      > 19 pppp pppp 8th byte of the 2nd chunk of coded data
      > 20 xxxx xxxx (Gps status data)
      > 21 FF xx xxxx
      > 22 xxxx xxxx
      > 23 xxxx xxxx
      >
      > Bits explanation:
      >
      > AA… address bits. Different for each device. The byte n. 2 is fixed to DD
      > (but it works with any number)
      >
      > LL.., Latitude, 0000..FFFF is a square around the actual position: because the
      > device tx range is limited, it is enough to transmit only the less significant
      > part of the position.
      >
      > NN.. Longitude, same as before. The dimension of the square changes with the latitude.
      >
      > HH.. altitude, in meters.
      > The altitude is given by the GPS, NOT by the pressure sensor
      > Note that the maximum height can be 8192 meters
      >
      > VV.. vertical speed. Signed. If positive, see FF bits.
      >
      > ZZ 00: free mode. 10: stealth mode. Note that the position and movement data are
      > radio transmitted correctly, with highest available precision, regardless of this setting.
      >
      > TTTT plane type. Starting from 0000 follows the list as described in the manual.
      >
      > SS
      > ss
      > KK
      > kk Horizontal (N/S) speed, signed. The four bytes are different depending on speed.
      > Used for collision forecast
      >
      > EE
      > ee
      > PP
      > pp Horizontal (E/W) speed, signed. The four bytes are different depending on speed.
      > Used for collision forecast
      >
      > FF multiplying factor for vertical speed. Meaningful only if the vertical speed is
      > positive. 00: leave as it is. 01: multiply x2. 10: multiply x4. 11: multiply x8
      >
      > ENCRYPTION
      >
      > The two chunks of data are encrypted with the TEA algorithm, with the following parameters:
      >
      > common data
      >
      > Delta value: 9e 37 79 b9 (standard, i.e. the default delta in every TEA document)
      >
      > Encryption iteration loop: 6 times
      >
      > Keys:
      >
      > 1st chunk:
      > ———
      > DB62
      > 62B9
      > A579
      > 5664
      > 7C97
      > 90A0
      > 27D6
      > FCCE
      >
      > 2nd chunk:
      > ———
      > A2BE
      > C3AC
      > D193
      > 51E1
      > 0801
      > 774F
      > 9074
      > 262E
      >
      > Each iteration loop uses 2 keys.
      > At each iteration loop the word changes. See a TEA description for any doubt

  4. Fernando

    Hi Zack,

    I bought two Arduinos UNO, two NRF905, and ethernet shield. I have made some tests in distance with your Ping program between boards. I found it very useful, thank you very much. I need to send a value from a board to another but I’m not sure how decodes the board that receives the value, I have been reading all the comments and doing some testing but I’m really confused, could someone give me an sketch that allows me to perform this operation?. The sent data would be KW/h, for example: 2, 15,36… one to three digits long with one or two decimals (float).

    Thanks for all info.

    1. Zak Kemble

      The received data is an array of individual bytes, decoding that data will depend on how it was encoded at the transmitting end. You’ll probably use memcpy() to copy the byte data to the location of the floats and other stuff. Upload your current code to pastebin so I can see how it’s being sent then I can give you some code for receiving it.

      1. Fernando

        Hi,
        I have resolved all the doubts I had about sending data between two Arduinos (one with ethernet module). I still have to finish some details, then I can upload the program, thank you very much for all the help.
        My next purpose is to configure the receiver (with the ethernet module) to receive data from multiple Arduinos, but I’m still not sure how to do it without interference.

        1. Zak Kemble

          As long as the transmissions are not done at the same time then interference shouldn’t be a problem. Having collision avoidance enabled will mostly solve the problem of making sure only one transmitter is transmitting at a time. The remaining problem is if the transmitters are out of range of each other, but in range of the receiver, then the collision avoidance won’t work. You could have the receiving station act as a polling master are it transmits a message like “transmitter #2 send me some info” and only transmitter #2 will respond. Then another message from the master station “transmitter #3 send me some info” etc…

  5. Baris

    Hi again Zak,

    Your library and schema is very handful. I did both client and server into arduino uno and standalone atmega328, ping is working very well, but when I tested it in clear area distance was ~100 meters, is it normal? I did not use divider resistors, running it directly 5V still working.

    1. Zak Kemble

      100 meters is about right. The nRF905 on its own has a transmission power of 10mW, but you can get modules with amplifiers like this one with 100mW output power and this one with 2W output power.

  6. Fundy

    Hai Zak

    can i use Arduino NG to work with nRF905?

    im so noob with all this device..

    1. Zak Kemble

      Yeah, the NG should work with the Uno wiring diagram.

  7. dzaba lesku

    Hi Zak,

    i recently bought two nRF905 modules from chip_partner (eBay), and first tried to use Electrodragon library made for 868/915Mhz primary, and it works, but range is only few centimeters, which is probably related to board version itself (i probably got 433 MHz modules, and this is also written on antennas).

    Then i switched to your library (which is excellent), and tried to change frequencies, but i figured out, when i choose channel above 501 – example: nRF905_setChannel(NRF905_BAND_433, 502) , communication doesn’t work (ping timeout). Chip works OK, because i checked it with SDR#, so please try to reproduce this with your modules.

    P.S. My modules works excellent at 300m with LOS, but i will try it tommorow on larger distance.

    1. Zak Kemble

      I just tried it and my modules don’t work too well at higher channel numbers either, the output power goes down the further away it gets from 433MHz. Using channels no higher than 200 would probably be the best thing to do.

  8. Simon

    Hi Zak

    Thanks so much for writing the lib. Ive just been prototyping some basic home automation switches for fun. Problem is I bought a couple of Arduino Nano (http://arduino.cc/en/Main/ArduinoBoardNano) for the projects but now find that I cant figure out the PINs. Do you happen to know if the Nano can be used with your lib and where I might find a pin mapping spec?

    Thanks again
    S

    1. Zak Kemble

      No problem 馃檪 The Nano should work. You can use the same pins as the Uno in the wiring table, when it says pin 7 you would wire that up to D7 on the Nano, 8 to D8 etc.

      1. Simon

        I will give it a try so next week and report back.
        Thanks S

        1. Simon

          Hi Zak. Yes that has worked nicely… Thanks again for the help.
          S

  9. punkie

    Hello Zak,
    could you please consider putting a function in your code that allows the RF config register to be read (and printed to the serial port)?

    I have implemented this functionality in my local copy of your code so that I could check the RX sensitivity, TX power and channel number setup in my radios. I added this because I wanted to confirm the radio settings, as the radio range of my off- the-shelf (ebay) nRF905 modules with stubby 433MHz antenna is only about 90m line of sight ( a big bit less than your other users).

    thanks again for your great code

    1. Zak Kemble

      Alright then, I’ll add reading registers sometime in the next few weeks. About the range, nRF905 sensitivity is -100dBm and with 10mW output power this link says you’ll get a best case range of just under 400m.

      1. punkie

        Thanks Zak and thanks for the link. I’m definitely not getting anywhere near 400m with these ebay modules. I’ll try another 2 and see how I get on.

        1. punkie

          Now have 300m LOS but nRF905 2m above ground.

  10. Eros

    Hello.
    Thanks for writing the lib.
    Which remote control I can use to communicate with nrf905 arduino library driver ?
    example : http://www.telecomandiuniversali.it/index.php?lang=en
    Thank you very much.

    1. Zak Kemble

      I’ve no idea, if you can find a remote control with an nRF905 chip inside then you might be able to get something working.

  11. jainal arifin

    how to sent this result

    int sensor = A1;
    void setup() {
    Serial.begin (9600);

    }
    void loop() {
    int x=analogRead (sensor);
    Serial.println(x);
    delay(250);
    }

    from server to client via library nrf905 .. pleaeeee . tenkyuuuu

    1. Zak Kemble

      This should work, not tested though.
      Client: http://pastebin.com/JsWxYDzk
      Server: http://pastebin.com/ZwGAAhPm

      1. jainal arifin

        if i want sent 2 client to 1 server, how ?

        client 1.

        int sensor = A1;
        void setup() {
        Serial.begin (9600);

        }
        void loop() {
        int x=analogRead (sensor);
        Serial.println(x);
        delay(250);
        }

        client 2

        int sensor = A1;
        void setup() {
        Serial.begin (9600);

        }
        void loop() {
        int x=analogRead (sensor);
        Serial.println(x);
        delay(250);
        }

        i want sent to 1 server..

        tenkyu master .. 馃榾
        This is very helpful

        1. Zak Kemble

          Putting the same code on both clients should work in this case.

      2. salam

        hi I tried this it work but what if they are 5 values A0-A4 ?
        how can they sent ?

        1. Zak Kemble

          Try this:
          Server: http://pastebin.com/GGnmbqtC
          Client: http://pastebin.com/m9P6X4L1

  12. Fundy

    Hi Zak..
    i try using ur low power’s example, here’s the code :
    server :
    http://pastebin.com/xE6iuvZ0
    client :
    http://pastebin.com/qcyLqpUc

    but i always get ‘Fail’ for the Data.
    and if i want to send just a word like ‘Hello’, what is the code for client and server?

    and thank u so much for the great library 馃檪

    1. Zak Kemble

      ATmega8 should work fine. See what it outputs when you put

      Serial.println((char*)buffer);

      Around the OK/Fail areas.

      You should also only use nRF905_getData() once to get the data and you should also see if it returned true (got data) or false (no new data).

  13. Fundy

    oh anyway im using Arduino NG with atmega 8.
    is it affectable??

  14. Fundy

    i tried..
    then the Data i received “yyyyyyyyyyyyb”
    here’s the pic : http://i57.tinypic.com/2n9cd3b.png

    what could be the cause?

    1. Zak Kemble

      Those 每s are ASCII value 255, all bits are 1. Is the MISO connection wired correctly? Does it do the same if you change which Arduino is loaded with client/server code?

      1. Fundy

        hmmm
        not sure if its wired correctly..
        i used UNO wiring diagram like you told me before, but i didnt use any resistor or divider

        its the same if i change it “yyyyyyya”…

        1. Zak Kemble

          UNO diagram should work for the NG.
          Try these:
          Server – http://pastebin.com/bAQsQxep
          Client – http://pastebin.com/h0uq0H5T

          1. Fundy

            this is the output : http://i57.tinypic.com/10p3hao.png
            its same thought

            hmm maybe the error was on my devices.,i’ll try checking ’em and the wiring connection
            i’ll post my result later 馃檪

  15. Fundy

    oh ya.. is there a problem with the address? or Band Frequency?

    1. Zak Kemble

      If the address or frequency were wrong then you wouldn’t get any pings at all, it would just timeout.

      Try these, I’ve removed all the low power and address stuff so it will use the defaults
      Server: http://pastebin.com/Y1qPAYrp
      Client: http://pastebin.com/4QmB5YNM

  16. Ralf

    Hi Zak,

    I had a running communication with two Arduino Unos based on you server and client examples. Now I have replaced the server Uno with a Mega 2560 due to more pin options.

    The pinning is as you described above (Uno) and the only changes are So->50, Si->51 and SCK->52.

    Then I edited nRF905_config.h as CR is on PIN 3:

    #define INTERRUPT_NUM 5

    //#define BIT_EXTERNAL_INT INT5
    //#define INT_VECTOR INT5_vect

    //#define REG_EXTERNAL_INT_CTL EICRB
    //#define BIT_EXTERNAL_INT_CTL (_BV(ISC51)|_BV(ISC50))

    Without touching the code of your server program I compiled it and uploaded. The result was, that I only had once connection to the client and the data the client sent was not received.

    I would appreciate if you could help me in this case.

  17. Ralf

    Hi Zak,

    I got it. Just after writing my comment I saw my mistake. I had to put

    #define REG_EXTERNAL_INT EIMSK
    #define BIT_EXTERNAL_INT INT5
    #define INT_VECTOR INT5_vect

    #define REG_EXTERNAL_INT_CTL EICRB
    #define BIT_EXTERNAL_INT_CTL (_BV(ISC51)|_BV(ISC50))

    without // in front of the code.

    Thanx a lot for your libaries and examples.

    1. Zak Kemble

      Glad you got it working 馃檪 Though the library should have been able to workout the register stuff by itself :/

  18. Rahul

    Hello Zak, Blog nicely explains the use of NRF905 . I am quite new to arduino. I have tried out using RF 434 Mhz ASK modules with arduino but those did not work for me. Range was poor (just 5 to 10Cms).

    Now I am planning to get NRF905 from

    https://www.fabtolab.com/NRF905-transceiver-433MHz-wireless-module

    Have a query around the connections for this.
    Do we need to use registers to connect this module with my arduino board or it can be directly connected to arduino board. Your blog shows connection using registers. I have also seen diagrams without using registers.

    Also, want to check how much range we can expect from these RF modules.

    1. Zak Kemble

      It’ll work without resistors, but without them a fair bit of current will be passing through the internal ESD protection diodes so one day you might find the modules have stopped working.
      Range should be about 300m line of sight with good conditions.

  19. Ricardo

    I recently buy a pair of this. I have one nano and one mega 2560, I do all my best to try this work, but I couldn’t. I change pins 50,51,53 and

    #define INTERRUPT_NUM 5

    #define REG_EXTERNAL_INT EIMSK
    #define BIT_EXTERNAL_INT INT5//default INT1
    #define INT_VECTOR INT5_vect//default INT1_vect

    // Set interrupt to trigger on rising edge
    #define REG_EXTERNAL_INT_CTL EICRB//default EICRA
    #define BIT_EXTERNAL_INT_CTL (_BV(ISC51)|_BV(ISC50))

    but nothing seems work, in nano it work perfect I think. with simple_client example but in mega didn’t happen can someone help?

    In nano serial monitor I see this output

    Client started
    Ping timed out
    Ping timed out
    Ping timed out
    .
    .
    .

    And this continue to the eternity XD

    shows this only once, only that

    Client started
    Ping timed out

    1. Zak Kemble

      Do you have DR connected to pin 3 on the Mega? Maybe a quick fix would be to set NRF905_INTERRUPTS to 0.

      1. Ricardo

        Yes DR is on pin 3. I already tried to put NRF905_INTERRUPTS to 0 but nothing change 馃檨

        I also tried commenting the above lines, and equally without comment on and did not work

        1. Ricardo

          If this help: I see that the simple_client stops here, after the first attempt

          // Send payload (send fails if other transmissions are going on, keep trying until success)
          while(!nRF905_send());

          1. Zak Kemble

            Hmm, maybe one of the connections isn’t correct (TXE, PWR etc). See if setting NRF905_DR_SW to 1 and NRF905_COLLISION_AVOID to 0 does anything.

          2. Ricardo

            Apparently nothing. Just out of curiosity I did two tests.
            1 Both in the Mega and the Nano I disconnect the NRF905 and upload the code(simple_client). The Nano show persistent ping message whitout problems(Of corse, it is not transmitting anything), but in the Mega has the same behavior as explained earlier

            2 I put the Nano as a server and Mega as a client . While I upload the code(simple_client) to Mega or I press the reset button, I get an answer on the server

            Waiting for ping…
            Got ping
            Sending reply…
            Reply sent
            Data: test 0

          3. Zak Kemble

            Sounds like an issue with how you’ve got the TXE, PWR, CE and maybe CD pins connected, could you upload nRF905_config.h to http://pastebin.com/ and a photo of your setup to http://imgur.com/ ?

          4. Ricardo

            Yes 馃檪

            http://imgur.com/5ZQZTkg

            -.- Men I foud someting

            While taking photos, I found an old memory in my mind. Several months ago when I bought the transmitters downloaded the library and put it in the system but not in / home / myUser / sketchbook but in / usr / share / arduino / libraries

            I modified the latter, and it worked perfectly

            I’m a little embarrassed, thank you very much for all the help!!! I appreciate it too much

          5. Zak Kemble

            Aha! Glad you’ve got it all sorted then ^^

  20. Neil Adam

    Hi Zak,

    I have been attempting to set up a short range signalling system, I can get all devices to ping each other successfully and have been writing some code to get them to address using a 74hc165 shift register which works.

    I have only just found a problem with sending and receiving data (in the example code test (value) etc). The data payload is almost always blank, 32 characters. Printing the variable data shows that it is correct but it seem to not being set in the nrf905 and therefore not transmitted. The ping client and server pair both work and a ping takes on average 16ms but the data is a 32 long blank space.

    So far I have checked that the variables are being set which they are. I have tried swapping arduino, rf module and switching between client and server. So far I have had no luck at all.

    The code used is your example code pair ping client and ping server. The setup; 2 arduino uno clones, each with their own nrf905 modules. I am not stepping down the 5v outputs from the arduino (I tried using the resistors and g6ot endless errors with them and could get nothing working at all) I am waiting on some step down chips to be delivered and will implement these ASAP.

    1. Zak Kemble

      Hmm try this server ping code – http://pastebin.com/MKjBNZBP
      It should print out the register configuration of the radio module, post what is shows.

      1. Neil Adam

        OK whilst testing that code I noticed that everything was fine with my arduino nrf905 pair but the devices with a self addressing circuit don’t work at all as intended. I have removed the connected breadboard and it’s gone back to working normally. Sorry to say I couldn’t see the wood for the trees.

        Both use spi is there any reason that only the data wouldn’t be being transmitted?

        The self addressing code used is this:


        #include
        #include
        #define TXADDR {192, 168, 2, 255} //address of target device
        #define TIMEOUT 1000

        const byte SHIFTON = 4; //CE pin for 74hc165
        const byte LATCH = 9;
        byte RXADDRB4; //Byte 4 of address

        void setup ()
        {

        SPI.begin ();
        Serial.begin (9600);
        pinMode (SHIFTON, OUTPUT);
        digitalWrite (SHIFTON, LOW); //enable the shift register
        delay(5);
        pinMode (LATCH, OUTPUT);
        digitalWrite (LATCH, HIGH);

        findRXADDRESS();
        byte RXADDRESS[] = {192, 168, 1, RXADDRB4}; //This devices address
        digitalWrite (SHIFTON, HIGH);

        // Start up
        nRF905_init();

        // Set address of this device
        nRF905_setRXAddress(RXADDRESS);

        // Put into receive mode
        nRF905_receive();
        }

        void loop ()
        {
        Serial.println(F("Waiting for ping..."));

        // Make buffer for data
        byte buffer[NRF905_MAX_PAYLOAD];

        // Wait for data
        while(!nRF905_getData(buffer, sizeof(buffer)));

        Serial.println(F("Got ping"));

        // Set address of device to send to
        byte addr[] = TXADDR;
        nRF905_setTXAddress(addr);

        // Set payload data (reply with data received)
        nRF905_setData(buffer, sizeof(buffer));

        Serial.println(F("Sending reply..."));

        // Send payload (send fails if other transmissions are going on, keep trying until success)
        while(!nRF905_send());

        // Put back into receive mode
        nRF905_receive();

        Serial.println(F("Reply sent"));

        // Print out ping contents
        Serial.print(F("Data: "));
        Serial.write(buffer, sizeof(buffer));
        Serial.println();

        }

        void findRXADDRESS()
        {
        for (int i=0; i < 8; i++) {
        digitalWrite (LATCH, LOW);
        digitalWrite (LATCH, HIGH);
        delay(5);
        }
        RXADDRB4 = SPI.transfer (0);
        }

        I have hacked the code to pieces and I am still learning please don’t be too brutal. As far as I can tell I have not changed any of the functions relevant to data. I have changed the addresses but the pinging still seems to be functional.

        Responses for devices with the address set on the dip switches and not for the others.

        Will I need to bitbang the 74hc165 instead of using spi as it seems to have issue with other spi devices because it’s data out isn’t tristate.

        The code works with the client code as this is a modified server code.

        1. Zak Kemble

          Ah yeah, if the 74HC165 doesn’t tristate its output then other SPI devices won’t be able to use the MISO bus line. You’ll have to use different pins and bitbang it or add a tristate buffer to the shift register output.

          1. Neil Adam

            1st thank you so much for creating the
            Sorry for wasting your time with my self inflicted problem. I’ve ordered a tri state buffer IC and will fit that as soon as it arrives.
            I still have no idea why it only caused issues with the data.

            One last question: Is there anyway using the nrf905 that I can have it listen to more than one address or will I need a second rf module?

            I’m thinking of having a second enhanced priority communication address on the master device but my current system relies on polling a group of devices one at a time meaning I can’t leave the master listening unless I use a secondary transceiver.

          2. Zak Kemble

            No problem 馃槢
            The library only uses MISO for reading the received payload, so if something is wrong with that line everything will work but the received data won’t be correct.
            To support more than 1 address you will have to set the all the receive and transmit addresses to the same values (don’t call the nRF905_setAddress() or nRF905_setTXAddress() functions and it will use the default {0xE7, 0xE7, 0xE7, 0xE7}) then put the address as part of the payload data and process it in software on the microcontroller.

  21. Simon Lennon

    Hi Zak

    I wonder could I ask your opinion please on a wee design problem I have with the NRF905. Im using your lib, which is doing great, and have wired up to some mid priced NRF905 modules I found on EBay. Its basically a basestation with sensors at outposts reporting back building information. It works well for the most part but some of the further out stations cant be received at the base. I imagine its just the amount of brickwork walls in between.

    I am wondering if I were to use one of the RFC-33A NRF905 components on the base station only would it help receiving the signal do you think.

    And secondly Im wondering if the RFC-33A model is compatible with your lib. Im not sure exactly how to use the extra 5V pins as I haven’t found a data sheet yet.

    The board Im thinking about is as below.

    http://www.ebay.com/itm/RFC-33A-Wireless-Module-NRF905-2w-3000-meters-433MHz-ISM-100dBm-GFSK-w-Antenna-/111004436169?ssPageName=ADME:X:RTQ:US:1123

    Thanks again for all the help in the past and the great lib.

    S

    1. Zak Kemble

      Hey Simon, the RFC-33A nRF905 just contains an RF amplifier which doesn’t need any extra interaction, the lib should just work like with the normal nRF905 modules. Apply the extra 5V supply to the VCC5 pins and it should work.

  22. Irfan

    hi Zak..
    if i want to send a data i got from SHT1x sensor that i connected to my arduino with nrf905.,how’s the code/sketch for the client??

    i already have a library for SHT1x.,here is the example’s sketch :

    #include

    // Specify data and clock connections and instantiate SHT1x object

    #define dataPin 10
    #define clockPin 11
    SHT1x sht1x(dataPin, clockPin);

    void setup()
    {
    Serial.begin(38400); // Open serial connection to report values to host
    Serial.println(“Starting up”);
    }

    void loop()
    {
    float temp_c;
    float temp_f;
    float humidity;

    // Read values from the sensor

    temp_c = sht1x.readTemperatureC();
    temp_f = sht1x.readTemperatureF();
    humidity = sht1x.readHumidity();

    // Print the values to the serial port
    Serial.print(“Temperature: “);
    Serial.print(temp_c, DEC);
    Serial.print(“C / “);
    Serial.print(temp_f, DEC);
    Serial.print(“F. Humidity: “);
    Serial.print(humidity);
    Serial.println(“%”);

    delay(2000);
    }

    and thank you for this Awesome Library 馃檪

    1. Zak Kemble

      Try this
      Client: http://pastebin.com/AfagLd5c
      Server: http://pastebin.com/4iZZvKzm

  23. Irfan

    its working Zak!!
    working so well.. 馃榾
    ur blog n libraries are so helpfull..
    really grateful to u 馃檪

  24. john

    Hi zak.

    I have two arduino mega 2560 and two nrf905. I need write code for SPI comunication between nrf905 and arduino. And code for wireless comunication between two arduino. I watched http://www.electrodragon.com/w/index.php?title=NRF905_Transceiver_433MHz-Wireless_Module . But It does not work. Maybe is error in pin conection. Sorry for some gramar mistakes in my english..

    I will be glad if you have some time for help to me or give me any advices.
    thanks

    1. Zak Kemble

      The electrodragon page uses different pins connections. See the chart in my blog post above about where to wire up TXE, PWR, CD, DR and CE (AM is not used), the Mega uses the same pins as the Uno.
      MISO, MOSI, SCK and CSN stay the same (50, 51, 52, 10).

  25. jafff

    Hi! Trying to learn to work with modules, download and install your library with examples, the module is connected, but using examples get:
    Client started
    Ping time: 14ms
    Data from server:

    Server started
    Waiting for ping…
    Got ping
    Sending reply…
    Reply sent
    Data: :29:

    Why Data From server: empty?
    Why Data: :29: ?
    And how to pass an array prermenuyu or from one device to another?

    thank you

    1. Zak Kemble

      Are you using the resistor voltage dividers? See if it works without them. For passing an array, if its 32 bytes or less then you can just pass it the same way as the buffers/data in the examples are passed – nRF905_setData(myArray, sizeof(myArray));

  26. Kyle

    Hi Zak, I’m working on a project with an Arduino Pro Trinket 3v and an nRF905/SI4432 CC1101 433MHz Transceiver module. Your blog has been the single most helpful thing I’ve found online thus far. I’m very new to Arduino projects and haven’t worked with an nRF905 before this. I first tried the code from Electrodragon since I just need it to transmit, and as far as I can tell it seems to be working. However I can’t seem to be able to pick up any output on a spectrum analyzer.

    Electrodragon code: http://www.electrodragon.com/w/index.php?title=NRF905_Transceiver_433MHz-Wireless_Module#Documentation

    Transceiver Module: http://www.ebay.com/itm/2pcs-NRF905-SI4432-CC1101-433MHz-Wireless-Transceiver-Module-with-SMA-Interface-/200964258194?pt=LH_DefaultDomain_0&hash=item2eca673992

    Pins for Transceiver: http://www.bestrepairtool.com/images/ebay/wellparts/a/a01/A0114_B5.jpg

    I think I need to change the code to just output a Sine wave instead of the “Hi Arduino, #” output so that I can see it on a spectrum analyzer. Also, the code defaults to using a much higher frequency around 900 Mhz instead of 433Mhz. These are things that I’m sure need to be changed. Your code seems to be very similar to the code on Electrodragon, but you use both the transmit and receive functionality of the module and it looks like I would have to change a good deal of it to make it work for my purpose. Is there any advice or information you could offer to a newbie like me? I feel like I’m missing some obvious things, and I don’t think it should be too big of a change to get it to work. Any help will be greatly appreciated!!

    1. Zak Kemble

      The Electrodragon library also has receive functionality too, otherwise it would be kinda useless :/
      The nRF905 IC does all the analogue stuff inside it, you don’t need to give it a sine wave. If it’s transmitting you should see it on your spectrum analyser (I’m able to see my modules on an RTL-SDR). You also need to make sure the transmission frequency matches the modules you have (433MHz range or 868/900MHz range), if not then the output transmission power will be very low.
      You can still use my library even if you only want to transmit, just ignore any received data.
      Also, the module you linked to looks like it has a CC1101 or CC110L chip, which is very different from an nRF905.

      1. Kyle

        As I read it, the Transceiver module has both a CC1101 and an nRF905. I wrote some short code to try to get it to transmit in the 433 MHz range and I wasn’t able to get any output. I think it’s obvious that I’m doing it wrong. If you have time, could you look over my short code and see if there’s anything I’m missing? I’m moderately familiar with programming, and I’ve had no issues getting it to compile and to load it to my Trinket board, but it just seems like I haven’t done something correctly. I may just be missing a couple lines.

        Here it is:

        #include
        #include

        #define RXADDR {0xFE, 0x4C, 0xA6, 0xE5} // Address of this device (4 bytes)
        byte data[NRF905_MAX_PAYLOAD];

        void setup()
        {
        nRF905_init();

        byte addr[] = RXADDR;
        nRF905_setRXAddress(addr);

        nRF905_setChannel(NRF905_BAND_433, 433200000);

        nRF905_setData(data, sizeof(data));

        nRF905_setTransmitPower(NRF905_PWR_6);
        };

        void loop()
        {
        Serial.write(data, sizeof(data));
        nRF905_send();
        }

        I’m pretty sure I don’t need to set the address of the device since it’s not really listening for any signals, nor is it sending to another Receiver module that would require it. I greatly appreciate your quick reply, and you’ve been very helpful in getting me this far!

        1. Zak Kemble

          The trinket only has 5 IOs which isn’t enough to connect an nRF905 which needs at least 7. I’m pretty sure you have a CC1101/CC110L. Did the wiring diagram not throw you off a bit, with all the missing pin names which are not present on your module (TRX, PWR, DR etc)?

          Anyway, transmit code, removed the address stuff so it use the default, changed setChannel() to setFrequency() and added a while() loop around send():
          http://pastebin.com/JknXn83g

  27. SciLor

    Hey,
    I want to use this module to copy several Remotes of 434 and one of webasto (868) http://www.digades.de/sites/default/files/Product%20PDFs/digades_telestart_t90_webasto_0.pdf

    any idea how to do that with that module/lib

    1. Zak Kemble

      Those key fobs say they use FSK modulation, but the nRF905 radio uses G-FSK. You could try using a CC1101/CC110L or Si4463 module which support FSK.

  28. Irfan

    Hi again Zak 馃檪
    the library use 10dBm as a default power.,is there any different if i use 6dBm or even -10 dBm??
    i’ll do some experiment with that but i’d like to know ur opinion first 馃檪

    1. Zak Kemble

      The only differences are range and power consumption, higher output power will give longer range but use more power. So it’s up to you which way you want to go.

  29. aniq

    i am connecting client with arduino uno and server with mega but on client side reply is clinent started then pinged timed out .. while on server side it shows server started then waitning for ping it’s not working whats thwe solution ..
    thanks in advance.

    1. Zak Kemble

      How have you wired up the Mega? Also check the nRF905_config.h file for setting pins etc (the interrupt pins are a little different on the Mega).

  30. vmail

    Hi, not sure what I am doing, is it wrong to use 2 same resistors in the potential divider to bring the voltage down to 2.5 volts instead of 3.3 volts for the 6 pins. I’m using an Arduino Uno

    Here is my code trying to read data from a device on 433.92 MHz. the RF data is transmitted every 6 seconds but I cant see any data


    #include
    #include

    byte data[NRF905_MAX_PAYLOAD];

    void setup()
    {
    // Start up
    nRF905_init();

    //433.92
    nRF905_setFrequency(NRF905_BAND_433, 433900000);
    nRF905_setData(data, sizeof(data));
    nRF905_setTransmitPower(NRF905_PWR_6);

    // Put into receive mode
    //nRF905_receive();

    Serial.begin(9600);
    Serial.println(F("Server started"));
    }

    void loop()
    {
    Serial.println(F("Waiting for Data..."));
    Serial.write(data, sizeof(data));
    while(!nRF905_getData(data, sizeof(data)));
    }

    1. Zak Kemble

      By “from a device” do you mean another radio transmitter that isn’t an nRF905?

      1. vmail

        Yes. Its a Current Cost EnviR Transmitter and CT Clamp

        http://www.smartnow.com.au/products/envir-energy-monitor/envir-transmitter/

        1. Zak Kemble

          (Your post got caught in the spam filter) Ah right, there’s a lot more to a radio than just what frequency it’s transmitting at. If you want the nRF905 to receive transmissions from other devices then they must use the same modulation and packet format as the nRF905. Modulation should be GFSK with 卤50KHz deviation, the data must be Manchester encoded and sent at 100Kbps and the packet format must have 10 preamble bits (I’m not sure of the bit pattern), 1 or 4 bytes for the address, 1 – 32 bytes for the payload and 0 – 2 bytes for the CRC (not sure of the CRC algorithm either). You’ll have to open up the device to see what kind of radio it uses. CC1101, CC110L and Si4463 are some radio ICs that have a lot more options with what modulations, encoding etc they can receive and transmit.

  31. guitux

    Hi Zak,

    Thanks for this Library, with my two arduino Uno It work well

    At this time I’m looking for this module in order to replace a remote that work on 434,5Mhz (so Channel 121)
    I’ve tried with the default address and don’t see anything with the read function.

    Do you think it possible, to ear on all adress in order to do reverse engineering ?

    Thanks a lot for your help

    1. Zak Kemble

      Does device you’re trying to receive data from contain a radio that isn’t an nRF905? If so then it is very unlikely that an nRF905 will work with it (see the comment posted just above yours).

      1. guitux

        Well,
        the frame format must be similar to http://www.touteladomotique.com/forum/viewtopic.php?f=6&t=8706&start=120
        It seem to be a manchester

        I think it possible to play with the payload and address to be similar as the remote control ?

        1. Zak Kemble

          That link seems to be showing the decoded data, nothing to do with the actual radio part. An nRF905 is very unlikely to work with non-nRF905 devices.

  32. vmail

    Hi, I’ve found this article
    http://www.aoaforums.com/forum/hardware-hacking/50725-hacking-currentcost-energy-monitor.html

    From the code at http://www.aoaforums.com/forum/attachments/hardware-hacking/26046d1347713060-hacking-currentcost-energy-monitor-pic16-currentcost.x.zip it does look like it uses Manchester encode. In the code I can see FSK but no GFSK.

    The RF module looks like a RFM02 or a RFM12B

    1. Zak Kemble

      Hmm, the link doesn’t say anything about data rate. I think it would be best to buy a RFM02 or RFM12B radio module from ebay or aliexpress.

  33. vmail

    I’ve just ordered one but I still want to use the nrf905. I want to use the nrf905 as a sniffer on 433 and 868. I have 3 RF devices.

    From http://gangliontwitch.com/ccPower.html I found 433, Xtal osc, 9.5pf, 67kHz, disable CLK

    1. Zak Kemble

      The nRF905 is definitely the wrong radio to use for sniffing, you are limited to a single modulation, data rate and packet format. The 10-bit preamble is fixed and the datasheet doesn’t say what the bit pattern is.

      Even though the nRF905 supports 433/868/915MHz bands, the components on the PCB module are only tuned for a particular frequency band, usually 433MHz. Using a different freq band will result in poor receive sensitivity and low transmission output power.

  34. tony

    hi there, im trying to compile the example code for lowpwr server but i keep getting compile errors, loads of them..

    ive followed your guide on installing the library but this isnt helping

    one of the errors is this…. there are lots of this type

    C:\Program Files (x86)\Arduino\libraries\SPI/SPI.h:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘SPIClass’

    thank you

    1. Zak Kemble

      I think you’re using the files for non-Arduino stuff, for Arduino you copy the files from .zip/master/arduino/ to arduino/libraries/nRF905/.

  35. tony

    thanks Zak, its sorted…can this code be adapted to work on the Mega 2560 board?

    1. Zak Kemble

      Yup, CTRL + F for “2560” through the previous comments and you should be able to find all the info you need to get it running.

  36. Rahul

    Hello Zak,
    I was working with NRF24L01+ modules for my home automation. While surfing I came across NRF905 and library written by you. I got my NRF905 and tried it with your library. It worked without any issues. Range also seems to be very good as per my requirement.

    I just had another query on this. Can I have central hub with NRF905 which can communicate with multiple nodes similar to NRF24L01 which has 6 pipes for listening on different addresses.

    1. Zak Kemble

      Indeed you can. The nRF24L01 doesn’t actually have pipes, it’s all done in software. So with the right code the nRF905s can work in the same way as your nRF24L01 setup. If you leave the address stuff (nRF905_setRXAddress() and nRF905_setTXAddress()) out of your code all modules will receive each others transmissions. Then in your code send the addresses as part of the payload and filter the transmissions you want to process by looking at the first byte of the payload.

      EDIT: Actually nRF24L01 does the pipes stuff in hardware, not software. The same thing can be achieved in software for the nRF905.

  37. skywalker

    Hi Zak,

    Thanks for you library and support about this NRF905

    A/ I wonder if this is possible to have several “emitter” (about 50) connecting to only one receiver ?
    B/ How to get the emitter address ?

    C/ I was looking this NRF905 because it was said that it can have automatic resend in case of non transmission ( I may have several emitter sending at same time and don’t want “loose” them, is this facility (auto_retran) embedded in your library page 23 of 41 in Nordic nrf905 data sheet – 9.4 RF- configuration Register description ?

    1. Zak Kemble

      You can have as many transmitters as you want. To get the transmitter address you will have to manually send it as part of the payload.
      nRF905 retransmit feature is kinda dumb, it simply retransmits its payload until it’s told to stop by the controller, it doesn’t have automatic acknowledgements like the nRF24L01. My library doesn’t fully support auto-retransmissions, but if you want to try it then set NRF905_AUTO_RETRAN to NRF905_AUTO_RETRAN_ENABLE in nRF905_config.h and don’t call nRF905_receive() until you want it to stop retransmitting.
      To stop multiple transmitters from transmitting at the same time use the collision avoidance feature (enabled by default, see NRF905_COLLISION_AVOID in nRF905_config.h) which will check to see if there are any ongoing transmissions before transmitting.

      1. skywalker

        Many thanks for your complete a clear response, I will try and give back my experiment ASAP

        Rgds

  38. Rahul

    Hello Zak,

    Thanks for your inputs. I will try out the approach suggested by you. Really appreciate your quick response.

    Regards,
    Rahul

  39. MN

    I have some questions regarding the operation of nRF905. Since, I’m using Arduino UNO as transmitter and Arduino MEGA as receiver, there may have some mistakes that I’m unable to detect.

    a) Does CSN pin need to be connected to SS pin of the Arduino?
    b) While interfacing with Mega, I first changed “…… #define CSN 10…… ” to “……..#define CSN 53……” in the header and then saved it and uploaded the code. Did I miss anything in this part ?

    the pin connections are given in the respective codes :

    http://pastebin.com/3T9LMeUf
    http://pastebin.com/ih0wCgDM

    1. Zak Kemble

      CSN can be connected to any pin, just be sure the #define CSN is updated which you’ve done. CTRL + F these comments for ‘2560’ and ‘mega’ might give some helpful tips.

      Since the nRF905_send() is usually successful on first try the digitalWrite() inside those loops is very unlikely to be ran. Really the only thing that should be in an nRF905_getData() or nRF905_send() while loop is some code for timing out. Put the digitalWrite() just after the loops.

      buffer[1] = digitalRead(A0);
      Should be buffer[0], arrays start at 0.

      Pin connections look fine.

  40. rhino

    Hm. I’m having issues with the 1.6.3 ide. It doesn’t like the spi library for some reason. I first had to manually pass a parameter to the compiler, but then the error list was too long and beyond me..

    Anyone ran this library on 1.6.3(current)? What am I doing wrong? The low power client example compiles, but not the serial one.. I’m confused ..

    1. Zak Kemble

      Hi, wireless serial link example works on 1.6.3 for me, I just had to move the .h and .cpp files into the src directory. Could you post the errors to http://pastebin.com and link them here?

  41. Rahul

    Hello Zak,

    I have been experimenting with NRF905 using your library, things have been working well. I just had another query around this.

    Is there a way to dynamically assign the the address to the receiver at run time. The receiver can have initial default address and objects can be initialized as per the defaults but it should be updated to listen to new address if I send an instructions in the payload. After this the arduino should reset and NRF905 should be able to listen on new address.

    Is this possible or there is any limitation in doing this?

    Regards,
    Rahul

    1. Zak Kemble

      Yup, you can use the nRF905_setRXAddress(addr) function, it’s used in some of the examples. The new address will come into effect straight away, no need to reset the arduino. You just need to make sure the instruction transmission was successfully received before transmitting to the new address.

  42. R@Y

    GOOD NIGHT, I AM WORKING WITH ARDUINO + NRF905, TRY TO CONNECT WITH A NRF905 + USART + TTL TO USB DRIVE THROUGH HYPERTERMINAL, ME COULD HELP DEVELOP A CODE FOR ARDUINO SHOWING THAT RECEIVES TRANSMISSION ??

    1. Zak Kemble

      Check out the provided examples, ping_server and ping_client.

  43. Rahul

    Dear Zak,
    I have successfully used your library for 433 MHz. But this band is not legal at the place where I live. At my place
    865MHz to 867MHz is legal band. How should I configure this for my needs.

    Is this possible?

    Regards,
    Rahul

    1. Zak Kemble

      You can use the nRF905_setFrequency(band, freq) or nRF905_setChannel(band, channel) functions. The channel one is probably easier to use – nRF905_setChannel(NRF905_BAND_868, 5);
      You also need to make sure your module is tuned for 868MHz, otherwise receive sensitivity and transmit power will be poor.

  44. Symentz

    Hi,
    You said

    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).

    But in the Nordic Semiconductor’s datashhet, i don’t see when they explain that some pins need 5V and others need 3.3V. Moreover, the Elechouse’s shield doesn’t this conversion. Can you explain me why do you do this conversion please ?
    Thanks

    1. Zak Kemble

      None of the nRF905 pins need 5V. The supply voltage should be between 1.9V and 3.6V and the IO pins should be no higher than the supply voltage + 0.3V. So with a supply voltage of 3.3V the IO pin voltage should not exceed 3.6V. This is all shown in the “Absolute maximum ratings” and “Electrical Specifications” sections of the datasheet. Without level conversion you will shorten the life of the module as you are exceeding its’ maximum ratings.

      1. Symentz

        So the Elechouse’s shield is dangerous for the module ? In them schematic, Arduino pins are directly linked with the nRF905.
        http://www.elechouse.com/elechouse/images/product/NRF905_NRF24L01_Wifi%20wireless%20module%20shield%20for%20Arduino/sch.pdf

        1. Zak Kemble

          Yeah, that shields design isn’t good for the nRF905.

      2. Symentz

        I just find the reply you made for Kevin P, he was in my school last year and had to use the nRF too ^^
        Thank you for your help 馃檪

  45. aldy

    hello Zak ,

    I have been experimenting with NRF905 using your library, I have 2 arduino uno and 2 nrf905 modules, I had tried your example “ping client and ping server” . I had followed your instructions and connected according your design . But I got some problem here ,the serial monitor server showed .:
    Reply sent
    Data: 每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每
    Waiting for ping…
    Got ping
    Sending reply…
    Reply sent
    Data: 每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每
    Waiting for ping…
    Got ping
    Sending reply…
    And serial monitor client showed :
    Client started
    Ping timed out

    what must I do,I’m a newbie in arduino ?
    thank you

    1. Zak Kemble

      I might have put the resistance divider values too high in the design, see what happens when you change the values from 4.7K to 470R and the 10K to 1K.

      1. aldy

        I had tried ,but now serial monitor server show:
        Server started
        Waiting for ping…

        and client serial monitor show:
        Ping time: 0ms
        Raw: 每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每
        Data from server: Fail
        Ping timed out
        Ping timed out

        I still cant receive and transmit data,what can I do now Zak ?

        1. Zak Kemble

          Hmm, difficult to tell what’s wrong. Could you post a photo of your setup?

  46. R@Y_

    Hi, PLEASE, I need the diagram conection with arduino Nano, How are the conecction??

    Thk..

    1. Zak Kemble

      The connections are the same as the Uno, just add D to the number so pin 7 on the Uno becomes D7 on the Nano.

  47. MarkW

    Hi All Arduino-ers,

    I have a problem with my nrf905 and hoping someone can help. I’m using an nrf905 with my arduino nano. I have a logic level converter working using resistors and my setup is working fine but only if I run my finger over all the pins of the nrf905. After I do that it works great no problem but once I reset my arduino it stops working (receiving).

    I’m so baffled… Any suggestions?

    Mark

    1. Zak Kemble

      Heya, see if swapping the 4k7 resistor for 470R and the 10k for 1k has any effect.

      1. MarkW

        I will try that, thanks for the suggestion.

  48. salam

    hi ; thanks for this informations , I tried the client and server examples ; the client was fine with no errorrs and the serial monitor showed the demanded data but I have aproblem with rhe reciving side , the Rx led did not light on and nothing in the serial monitor had been showed .
    what’s the matter !?
    this is the server code : and I did’nt change anything in both codes :
    // nrf905_server.pde
    // -*- mode: C++ -*-
    // Example sketch showing how to create a simple messageing server
    // with the RH_NRF905 class. RH_NRF905 class does not provide for addressing or
    // reliability, so you should only use RH_NRF905 if you do not need the higher
    // level messaging abilities.
    // It is designed to work with the other example nrf905_client
    // Tested on Teensy3.1 with nRF905 module
    // Tested on Arduino Due with nRF905 module (Caution: use the SPI headers for connecting)

    #include
    #include

    // Singleton instance of the radio driver
    RH_NRF905 nrf905;

    void setup()
    {
    Serial.begin(9600);
    while (!Serial)
    ; // wait for serial port to connect. Needed for Leonardo only
    if (!nrf905.init())
    Serial.println(“init failed”);
    // Defaults after init are 433.2 MHz (channel 108), -10dBm
    }

    void loop()
    {
    if (nrf905.available())
    {
    // Should be a message for us now
    uint8_t buf[RH_NRF905_MAX_MESSAGE_LEN];
    uint8_t len = sizeof(buf);
    if (nrf905.recv(buf, &len))
    {
    // nrf905.printBuffer(“request: “, buf, len);
    Serial.print(“got request: “);
    Serial.println((char*)buf);

    // Send a reply
    uint8_t data[] = “And hello back to you”;
    nrf905.send(data, sizeof(data));
    nrf905.waitPacketSent();
    Serial.println(“Sent a reply”);
    }
    else
    {
    Serial.println(“recv failed”);
    }
    }
    }

    1. Zak Kemble

      The code you have posted seems to be for a different nRF905 library and it looks like you’ve only posted the server side code.

      1. salam

        thanks for reply …
        yes I ysed the Radiohead library it does’nt give errors , is that problem I used it ?!
        I tried others but now it;s the only one in arduino library anyway Iam trying the client and sercer examples from radiohead library ,the chient is good and it seems it sending data but the recieving side no !! ( am using two arduino UNO , and I did’nt hange things in the library ) (I onnected it like : (CE>4….AM>9…MISO>12….SCK>13…..CSN>10…..MOSI>11….DR>8….CD>7……PWR>3
        …TXE>5)……. this chient code :
        // nrf905_client.pde
        // -*- mode: C++ -*-
        // Example sketch showing how to create a simple messageing client
        // with the RH_NRF905 class. RH_NRF905 class does not provide for addressing or
        // reliability, so you should only use RH_NRF905 if you do not need the higher
        // level messaging abilities.
        // It is designed to work with the other example nrf905_server.
        // Tested on Teensy3.1 with nRF905 module
        // Tested on Arduino Due with nRF905 module (Caution: use the SPI headers for connecting)

        #include
        #include

        // Singleton instance of the radio driver
        RH_NRF905 nrf905;

        void setup()
        {
        Serial.begin(9600);
        while (!Serial)
        ; // wait for serial port to connect. Needed for Leonardo only
        if (!nrf905.init())
        Serial.println(“init failed”);
        // Defaults after init are 433.2 MHz (channel 108), -10dBm
        }

        void loop()
        {
        Serial.println(“Sending to nrf905_server”);
        // Send a message to nrf905_server
        uint8_t data[] = “Hello World!”;
        nrf905.send(data, sizeof(data));

        nrf905.waitPacketSent();
        // Now wait for a reply
        uint8_t buf[RH_NRF905_MAX_MESSAGE_LEN];
        uint8_t len = sizeof(buf);

        if (nrf905.waitAvailableTimeout(500))
        {
        // Should be a reply message for us now
        if (nrf905.recv(buf, &len))
        {
        Serial.print(“got reply: “);
        Serial.println((char*)buf);
        }
        else
        {
        Serial.println(“recv failed”);
        }
        }
        else
        {
        Serial.println(“No reply, is nrf905_server running?”);
        }
        delay(400);
        }
        and this server code :
        // nrf905_server.pde
        // -*- mode: C++ -*-
        // Example sketch showing how to create a simple messageing server
        // with the RH_NRF905 class. RH_NRF905 class does not provide for addressing or
        // reliability, so you should only use RH_NRF905 if you do not need the higher
        // level messaging abilities.
        // It is designed to work with the other example nrf905_client
        // Tested on Teensy3.1 with nRF905 module
        // Tested on Arduino Due with nRF905 module (Caution: use the SPI headers for connecting)

        #include
        #include

        // Singleton instance of the radio driver
        RH_NRF905 nrf905;

        void setup()
        {
        Serial.begin(9600);
        while (!Serial)
        ; // wait for serial port to connect. Needed for Leonardo only
        if (!nrf905.init())
        Serial.println(“init failed”);
        // Defaults after init are 433.2 MHz (channel 108), -10dBm
        }

        void loop()
        {
        if (nrf905.available())
        {
        // Should be a message for us now
        uint8_t buf[RH_NRF905_MAX_MESSAGE_LEN];
        uint8_t len = sizeof(buf);
        if (nrf905.recv(buf, &len))
        {
        // nrf905.printBuffer(“request: “, buf, len);
        Serial.print(“got request: “);
        Serial.println((char*)buf);

        // Send a reply
        uint8_t data[] = “And hello back to you”;
        nrf905.send(data, sizeof(data));
        nrf905.waitPacketSent();
        Serial.println(“Sent a reply”);
        }
        else
        {
        Serial.println(“recv failed”);
        }
        }
        }

        1. salam

          I don’t know if I have to install another library which I did before and there was errors , Iam using nrf905/433MHZ.

  49. salam

    hi 馃檪
    I installed this library and finally the two examples are working … thanks alot soon Iam going to code my programme ..

    1. Zak Kemble

      Glad you got it working then 馃檪

  50. ika

    Hi!

    Thanks for that great post.

    So, here is the situation. I modified your code to port it to PIC32, without interrupts. It works… but the problem is i only get packets full of 0’s…

    Strange, right?

    On the transmitter side, i verify the content of the TX Payload (display it on terminal) just before sending the packet, and it’s correct (i fill the 32 bytes with 0x55). I do transmit a new packet once per 10 seconds.

    On the Rx side, i do get a new packet once every 10 seconds. but when i print out the content of the read buffer, i get only Zeros.

    Tomorrow i’ll continue testing (and debugging).. but, from the top of your head, can you think of anything?

    Oh, and by the way, i am sure the SPI connection words, since i am able to read-back all configuration data for sanity checking…

    scratching my head quite hard tonight……. 馃檪

    1. Zak Kemble

      Hmm, that’s a toughy lol. Is nRF905_getData() returning true to say it successfully read the payload?

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Are you human? *