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.

NOTE: v3.0.0 of the library was released on 12th September 2017, the default CD pin has changed and the AM pin is now used by the library.

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 D4 (6) 4 Carrier detect – High when a signal is detected, for collision avoidance
AM D2 (4) 2 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, if interrupts are used (default) then this pin must be connected
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 (default) then this pin must be connected
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

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.

Callbacks
Since v3.0.0 this library uses callbacks which are ran when events occur. If the option to use interrupts is enabled then the callbacks will run from the interrupt routine so be sure that any global variables you use in them are declared ‘volatile’, just as you would when dealing with normal ISRs. These events will wake the microcontroller if it is sleeping.

Event Callback Notes
New packet incoming NRF905_CB_ADDRMATCH
Valid packet received NRF905_CB_RXCOMPLETE
Invalid packet received NRF905_CB_RXINVALID
Packet transmission complete NRF905_CB_TXCOMPLETE This only works if the nextMode is NRF905_NEXTMODE_STANDBY when calling nRF905_TX()



Nitty-gritty radio stuff
The 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 address is also used as the syncword and should have as many level shifts as possible. 10100110 01100101 00011010 11011010 (2791643866) would be a good address to use, but 00000000 00000000 00000000 0010000 (32) would not be.

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.
When the CRC is set to 16 bit the radio uses the CRC16-CCITT-FALSE (0xFFFF) algorithm. I’m not sure what it uses for 8 bit CRCs.

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: Before v3.0.0 this library would load the address bytes in reverse order, keep that in mind if you’re using an old version of the library to interface with other radio systems!

501 comments

2 pings

Skip to comment form

    • skywalker on August 4, 2015 at 11:17 am
    • Reply

    Hi Zak,

    Thanks a lot for this library an support.
    I started from your example lowpwer_client and move pin 3->4 and pin2->3 to get Pin2 free expecting using for interrupt vector 0 and make the system in sleeping mode for the rest of time.
    I made some change in nrf905_config.h
    // Arduino pins
    #define TRX_EN 7 // Enable/standby pin
    #define PWR_MODE 8 // Power mode pin
    #define TX_EN 9 // TX / RX mode pin
    #define CD 3 // old : 2 Carrier detect pin (for collision avoidance, if enabled)
    #define CSN 10 // SPI slave select pin

    // Data ready pin
    // If using interrupts (NRF905_INTERRUPTS 1) then this must be
    // an external interrupt pin that matches the interrupt register settings below.
    #define DR 4// old : 3

    in code I include sleep library : #include
    in setup I place
    attachInterrupt(0, wakeUpNow, LOW); // use interrupt 0 (pin 2) and run function
    // wakeUpNow when pin 2 gets LOW

    When compiling I get error message :

    C:\Users\francis\AppData\Local\Temp\build4528700206971743173.tmp/core.a(WInterrupts.c.o): In function `__vector_2′:
    C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/WInterrupts.c:326: multiple definition of `__vector_2′
    nRF905\nRF905.cpp.o:C:\Program Files (x86)\Arduino\libraries\nRF905/nRF905.cpp:589: first defined here
    collect2.exe: error: ld returned 1 exit status
    Erreur lors de la compilation.

    Any idea what is wrong ? I probably miss something to modify elsewhere !

    1. Hey skywalker, the nRF905 library already contains the interrupt stuff and will automatically wake up the Arduino when new data is received. You don’t need to use attachInterrupt() on the DR pin.

        • skywalker on August 5, 2015 at 9:31 am
        • Reply

        Hey Zak,

        Thanks for the answer, I miss one essential element that is my emitters are remote control and have to wake up on keypress ONLY (I don’t wait for upstream from central at this time) so I place all my button in parallel trough diode to pin 2 to wakeup the arduino and on different I/O to check which button has been pressed
        For this I move previous pin2 to Pin3 and previous pin3 to Pin4….

        1. All pins support interrupt wakeup, you just need to use a 3rd party library like https://github.com/GreyGnome/EnableInterrupt
          With that library you don’t need to use the diode stuff with your switches.

            • skywalker on August 18, 2015 at 2:32 pm

            Hi Zak,

            Thank for this links I test this marvelous library from Mike and it’s working good !
            But the problem occurs when I try to mix nRF905 with interrupt this always give me compile error ;

            nRF905\nRF905.cpp.o: In function `__vector_2′:
            C:\Program Files (x86)\Arduino\libraries\nRF905/nRF905.cpp:589: multiple definition of `__vector_2′
            Emmetteur_Press_Call_interrupt.cpp.o:C:\Program Files (x86)\Arduino\libraries\ei/EnableInterrupt.h:1028: first defined here
            collect2.exe: error: ld returned 1 exit status

            Do you have some short example to show me the ways ?

            Rgds

          1. Try adding this right at the top of your sketch code – #define EI_NOTINT1 or #define EI_NOTINT0, see what works.

            • skywalker on August 19, 2015 at 2:31 pm

            Hello Zak, thank for your help

            adding the #define EI_NOTINT1 or #define EI_NOTINT0 change error message now I get :

            C:\Program Files (x86)\Arduino\libraries\ei/EnableInterrupt.h: In function ‘void __vector_1()’:
            C:\Program Files (x86)\Arduino\libraries\ei/EnableInterrupt.h:1003:5: error: ‘functionPointerArrayEXTERNAL’ was not declared in this scope
            (*functionPointerArrayEXTERNAL[0])();

          2. Try #define EI_NOTEXTERNAL instead.

            • skywalker on September 3, 2015 at 2:15 am

            Thanks a lot Zak

            this is working now !

    • skywalker on August 4, 2015 at 11:22 am
    • Reply

    Hi zak,

    On the receiver part I need to transmit received data trought W5100 ethernet shield, as this use also SPI I saw your note about this in nRF905_config.h
    “NOTE: If you have other devices connected that use the SPI bus then you will need to call nRF905_interrupt_off() before using SPI comms and then RF905_interrupt_on() once you’ve finished.”

    Do you have any example how to deal with nRF905 and Ethernet Shield ?

    With best regards

    1. Example code: http://pastebin.com/knT3yQBy

        • skywalker on August 5, 2015 at 11:50 am
        • Reply

        Hi Zak,

        Thanks for the sample I will test it soon . Should I also enable/disable the Ethernet opposite tonRF905

        1. No, the Ethernet library doesn’t use interrupts so you don’t need to worry about doing the opposite.

        • skywalker on October 12, 2015 at 3:15 pm
        • Reply

        Hi Zak,
        this was long time I didn’t ask for your help 馃槈
        The project is at final phase but I had a problem with Nrf905 and Ethernet W5100 Shield :

        If I disconnect the module, my code give me the received buffer, but when I connect the Shield I get the info of available date but can’t get them ???
        It seem that having the ethernet shield simply connected stop data receiving !

        Any suggestion ?

        1. Sounds like an issue with the SPI bus, have you setup the correct pins for the slave select (SS/CSN) stuff? Might be an idea to post your pin connections and the bit of your code that does all the initialisation.

            • skywalker on October 13, 2015 at 4:27 pm

            * 4 -> pin dip switch low
            * 5 -> pin dipswich
            * 6 _> pin dipswich high
            * 7 -> CE
            * 8 -> PWR
            * 9 -> TXE
            * 2 -> CD
            * 3 -> DR
            * 10 -> CSN Shared with W5100
            * 12 -> SO Shared with W5100
            * 11 -> SI Shared with W5100
            * 13 -> SCK Shared with W5100

            effectively CSN is same for your lib and W5100 lib…. where can I change in your lib ?

          1. Ah, the SPI select pin cannot be shared. You can change it in nRF905_config.h, look for #define CSN about half way down and change it to some other pin that isn’t in use.

            • skywalker on October 13, 2015 at 4:57 pm

            Can this be changed in Arduino IDE better than in nRF905_config.h ?
            because I have already finish pcb for the emitting part that use the pin 10 and need to adjust (wired) only the receiver that transmit to ethernet, else what should I modify to have both version of your lib to compile ?

            Rgds

          2. If the tranmitter doesn’t have anything sharing the select pin then you can keep that as pin 10 and only change the receiver. You’ll need to change the CSN in nRF905_config.h each time you upload to the different board, or you could create a copy of the whole Arduino IDE install and use one for the transmitter and the other for the receiver. Acually I think it’s possible to copy the .h to your sketch folder instead of using a single one in the lib folder, you’ll have to look into that yourself though.

            • skywalker on October 14, 2015 at 2:57 pm

            Hi Zak,

            how are you today ?
            Following your recommandation,
            I move the CSN pin for nRF905 to A0

            * 0 -> Rx
            * 1 -> Tx
            * 2 -> CD
            * 3 -> DR
            * 4 -> pin dip switch poid faible
            * 5 -> pin dipswich
            * 6 _> pin dipswich poid fort
            * 7 -> CE
            * 8 -> PWR
            * 9 -> TXE
            * 10 -> CSN for W5100
            * 12 -> SO Shared with W5100
            * 11 -> SI Shared with W5100
            * 13 -> SCK Shared with W5100
            * A0 -> CSN for NRF905

            in nRF905_config.h I change this
            #define CSN A0 // SPI slave select pin // moved from pin10 (original version) to A0

            I compile but result keep the same : with W5100 unplugged I got the data when firing emitter bur as soon as the W5100 module is plugged data is empty 馃檨

            // Printout ping contents
            Serial.print(F(“Data: “));
            Serial.write(buffer, sizeof(buffer));
            Serial.println();

            For your undestanding I use this module :https://arduino-info.wikispaces.com/Ethernet
            and this module is working properly

            • skywalker on October 16, 2015 at 2:08 pm

            Hi ZAk,

            I maybe find the explanation of the problem :

            If your shields use SPI communications to the Arduino they can all co-exist on the same SPI bus, with the exception of the “SS” (“slave select”) line (sometimes called “CS”, or “chip select”) which will need to be configured differently for each board. The “MISO”, “MOSI”, and “SCLK” pins can all be shared by multiple shields. If you have multiple shields that use SPI and they also use the same pin for SS you may need to modify one of the shields. A typical approach is to cut the track going to SS on one of the shields and use a jumper wire to connect it to an alternative pin, and then modify the software for that shield to use that pin when communicating with the shield.

            One little catch is with Ethernet shields based on the Wiznet W5100 chipset, which includes the official Ethernet shield and many third-party shields. The W5100 has a design flaw that causes it to maintain control of the SPI bus even when another device has been selected, making it very tricky to combine the official Ethernet shield with other shields that use SPI. The Freetronics Ethernet Shield uses the W5100 chipset but includes a fix in hardware so it doesn’t have that problem and will happily share the bus with other SPI devices.

            So I found some guy that use virtual SPI to use with nRF24 module and Ethernet W5100 (https://github.com/shnae/rf24_plus_softSPI) do you ever have used this solution (virtual SPI) ? do you think this can be used with nRF905 module ?

            Rgds

            • Zak Kemble on October 17, 2015 at 10:02 am
              Author

            Well that’s a pain with the W5100 chip :/ Yeah the nRF905 will work with virtual/software SPI, though I don’t have time to look into it myself.

    • skywalker on August 4, 2015 at 5:38 pm
    • Reply

    Hi once again,
    As I ask few month ago I need to have several remote emmitter to One receiver, and you suggest to send the serial number in the payload .
    I would like to put a unique serial number in EEPROM and read it to set the RXARDR instead of have it as constant as there is in your demo code

    #define RXADDR {0xFE, 0x4C, 0xA6, 0xE5} // Address of this device (4 bytes)

    Could you explain what is this for
    byte addr[] =RXADDR ;

    I was thinking this way array of value and I try do do this as function but don’t work 馃檨
    void read_serial()
    {
    byte chiffre=0;
    for (int i=0;i<4;i++)
    {
    //Read EEPROM
    chiffre = EEPROM.read(i);
    RXADDR[i]=chiffre;
    }
    }

    Thanks for you advice

    1. The #define thing is called a macro, when the program is compiled it basically does a find for RXADDR and replaces it with {0xFE, 0x4C, 0xA6, 0xE5}
      So byte addr[] = RXADDR; becomes byte addr[] = {0xFE, 0x4C, 0xA6, 0xE5}; which is an array with 4 elements. This variable is passed to the functions that set the RX/TX addresses.
      Your RXADDR[i]=chiffre; becomes {0xFE, 0x4C, 0xA6, 0xE5}[i]=chiffre; which isn’t going to work 馃槢
      This will read in 4 bytes from EEPROM and set the receive address http://pastebin.com/SFEPTYBL

        • skywalker on August 5, 2015 at 9:24 am
        • Reply

        Great ! thanks a lot for this support and clear explanation !

    • Folkert on August 8, 2015 at 11:25 am
    • Reply

    Hi, thanks for this nice guide!

    I have bought 2 of these here: http://www.aliexpress.com/snapshot/6207041929.html.
    It’s the nrf905 that you’re using, but combined with a stc15f204. I think this chip is used to port the spi from the nrf905 to serial, to which you can connect an arduino. I thought this should make it a lot easier to use, however, if I send messages from arduino serial port to the nrf905 I can’t receive them with another arduino + nrf905 + stc15f204. Unfortunately I don’t have any idea to program the stc15f204 or what commands I should send from the arduino in order to configure the device somehow.

    Do you have any idea how I can use this combination of hardware with the arduino?

    Thanks,

    Folkert

    1. Well, I can’t find any info on the serial converter module thing, but this is the datasheet for the STC controller – http://www.stcmcu.com/datasheet/stc/stc-ad-pdf/stc15f204ea-series-english.pdf
      The product description does say about contacting the seller for a datasheet, other than that I always thought you just send a little bit of data to one converter and it pops out the other converter without any configuration.

    • Lester on August 10, 2015 at 2:07 pm
    • Reply

    Hey there, so I am doing my thesis project about detecting the real-time location of a passive rfid tag. And somebody told me to use arduino and rf transceiver, is it possible? Thanks.

    1. You could use the signal strength, but that’s very unreliable (objects will block the signal to some areas). Triangulating the RF source would be best but moving the source by 30cm will mean you have to detect a time difference of about 1 nanosecond, which is nowhere near possible with an Arduino and an RF transceiver. I think you chose a very hard project to do, it’s like GPS but in reverse.

    • Lester on August 11, 2015 at 3:38 pm
    • Reply

    Really? Any recommendation about what to do or what to use? Thanks man. I really dont know what to do.

    1. Sorry, I’ve no idea what kind of equipment you’d need for your project.

        • Lester on August 18, 2015 at 3:45 am
        • Reply

        One more thing, Can it read data stored in an rfid? Thanks man.

        1. Well, since RFID simply means wirelessly transferring data for the purpose of identification then you could use nRF905s to send identification data to each other and then you’ve technically made and read some RFIDs. But I guess you really mean normal, passive RFID tags, in which case no nRF905s can’t read them. Wikipedia has tons of info about RFID.

          • Lester on August 22, 2015 at 2:40 pm
          • Reply

          I’m a bit confuse. Sorry . So can nRF905 receive data from the tag?

          1. No

    • skywalker on August 17, 2015 at 3:25 pm
    • Reply

    Hi Zak,

    Thanks again for for you kind help , now I have almost finished the “remote controller” part.
    The question now is about clock of CPU :
    To reduce consumption I intend to port the code from ARDUINO MICRO to ARDUINO pro MINI board at 8mhz and 3 volts power supply from CR2032
    is your library sensitive to this clock change ? what should I adapt ?

    Rgds

    1. The library should work fine at any clock frequency

        • skywalker on August 19, 2015 at 2:35 pm
        • Reply

        Hello Zak

        Thank for this confirmation
        Great new, I was worried about having to modify my firmware

    • Seth on September 1, 2015 at 8:40 pm
    • Reply

    I’m having trouble getting my setup working. I’m using two nRF905 modules with two Unos. The debug sketch shows communication with the nRF, but the ping tests fail (time out).

    Arduino 1 debug: http://pastebin.com/AjrS3bHb
    Arduino 2 debug: http://pastebin.com/7LFxqq6Q

    I’m scratching my head. Any suggestions are greatly appreciated.

    Thanks,
    Seth

    1. See if turning off interrupts does anything – NRF905_INTERRUPTS 0 in nRF905_config.h, also see if setting all addresses (TX and RX) to the same values (like {0x00, 0x00, 0x00, 0x00}) works.

    • Gilles on September 3, 2015 at 4:59 pm
    • Reply

    Hi

    Is your library able to send from 1 master to 20 slaves that receive it all at the same time ?

    Thanks!

    1. As long as the addresses are all the same it can transmit to an unlimited number of receivers.

    • Leif on September 5, 2015 at 2:22 pm
    • Reply

    Hi,
    When i test my nrf905 module i got a range of about 50meters. Any idea why it is that short?
    thanks

    1. What kind of environment are you testing the range in? Line of sight, through a lot of walls etc?

    • Gilles on September 10, 2015 at 10:26 pm
    • Reply

    Hi

    I have 2 mega and 2 nrf905
    I’ve done this :

    Hey, the library should work for the Mega boards, but some pin numbers are different:
    SO -> 50
    SI -> 51
    SCK -> 52

    You鈥檒l also need to edit nRF905_config.h a little bit, near the bottom change the following:
    INT1 -> INT5
    INT1_vect -> INT5_vect
    EICRA -> EICRB
    ((1<<ISC11)|(1< ((1<<ISC51)|(1<<ISC50))

    but on the monitor it says ping timeout when using the example "ping client and server"

    1. Hey, you don’t need to do all of those changes to nRF905_config.h any more. Since I posted that info I’ve updated the library to do all of that automatically. If you change it all back to how it was, set INTERRUPT_NUM to 5 and see if that works.

        • Gilles on September 13, 2015 at 12:25 pm
        • Reply

        Great it works! Ping example is working
        Do you have a simple example like a Hello World from Server to Client without answer ? Thx

        1. Try this –
          Server: http://pastebin.com/PvfiiTJ9
          Client: http://pastebin.com/1p81AAPC

            • Gilles on September 13, 2015 at 9:35 pm

            Thanks a lot! Is it possible to use the data received to do like if(datareceived == “Hello world”) { do something; } ?

            • Zak Kemble on September 19, 2015 at 5:42 pm
              Author

            Yup, you can use strcmp() to compare the strings. if(strcmp("Hello world", datareceived) == 0){ blah(); }

            • Gilles on September 13, 2015 at 9:46 pm

            And also do you know why in the serial monitor i have only the Hello world one time and after it hangs on “waiting for data” ?

            Thanks

            • Zak Kemble on September 19, 2015 at 5:40 pm
              Author

            Oops, forgot to put it back into receive mode – http://pastebin.com/yFj8xtdZ

            • Gilles on September 20, 2015 at 8:04 pm

            Hi
            Tested, but still doing the same 馃檨 “waiting data”

            • Zak Kemble on September 22, 2015 at 6:20 pm
              Author

            Gah, also updated the client code – http://pastebin.com/rUFiFgPL

            • Gilles on September 23, 2015 at 4:07 pm

            I will try! thanks !

            If i send like “A1B1” can i do something like if(“A1”) { blabla();} and if (“B1”){ blabla()} ?

            Thanks for your help !

            • Zak Kemble on September 27, 2015 at 1:04 pm
              Author

            No, with C strings you usually have to call a special function to compare, find etc.

            strstr() will look for the occurrence of a string within another string.

            if(strstr(data, "A1")){blah1();}
            if(strstr(data, "B1")){blah2();}

            It would probably be better if you sent raw byte values, than you can just do if(data[0] == 5){blah1();}, that checks the first element of the array to see if it equals 5. A byte can store any value from 0 to 255.

    • Omemanti on September 12, 2015 at 8:05 pm
    • Reply

    Hey,

    Can anyone tell me if it is possible to get the HomeEasy/KAKU working with a nRF905?

    http://playground.arduino.cc/Code/HomeEasy

    btw, so far your description above gave me a good insight so far 馃檪
    keep up the good work.

    1. No, from what I can tell HomeEasy is supposed to use modules like these http://www.ebay.co.uk/itm/140928401303 Those modules use OOK modulation and a very low bit rate, while the nRF905 uses GFSK modulation and a bit rate of 100Kbps, making them incompatible with each other.

        • Omemanti on September 12, 2015 at 8:53 pm
        • Reply

        Hi,
        Thnx for the quick response.

        my question is based on the following, the guys from Homey, https://www.athom.com/, made it possible to use KAKU devices. and the geek backers (it is a kickstarter project) get a nRF905 send with their purchase.

        In about a month they send out the homey and after that they will publish a Arduino library.
        so maybe I have to wait just a little bit longer. 馃檪

        Mark

        1. Ah right, had I quick look at the athom stuff, seems it has multiple radios (those cheap modules, nRF905 and some other things like WiFi). In that case you could use this library to communicate with the nRF905 radio before the official stuff is released 馃槢

        • Omemanti on September 12, 2015 at 8:56 pm
        • Reply

        btw, those 433mhz receivers work like shit 馃檪

        I get them working for about a meter or 5, then it’s over.

    • Gisle on September 27, 2015 at 11:59 am
    • Reply

    Hey

    Is it possible to make this library work with arduino DUE? Compilation gives a huge amount of errors.

    1. There is an arduino-interrupt-test branch which should make things work a bit better with Arduinos that are not based on an AVR micro, see how you get on with that.

    • Cristian on October 1, 2015 at 3:56 pm
    • Reply

    Hola como va, necesito conectarme a una red wifi con este modulo y poder al estar conectado empezar a escuchar un archivo php en un servidor web que poseo, pero no encuentro como hacer estas cosas hasta ahora:

    1) Establecer una red a la cual conectarme por su nombre.
    2) Establecer la contrase帽a de la cual corresponderia esa red.

    3) Establecer la escucha con el archivo, ya que los pasos anteriores no me permiten conectarme a ningun lado.

    Tendr铆as un ejemplo basico de como me puedo conectar a una red wifi con este modulo?….

    **ADMIN EDIT**
    Google translate:

    Hello how it goes, I need to connect to a wireless network with this module and be connected to start listening a php file on a Web server that I own, but can not find how to do these things so far:

    1) Establish a network to which to connect by name.
    2) Set the password for the network which would correspond.

    3) Set listening to the file because the previous steps do not allow me to connect anywhere.

    You’d have a basic example of how I can connect to a wireless network with this module? ….

    1. This is not a WiFi module. You will need something like an ESP8266 instead.

    • aymeric on October 11, 2015 at 7:59 am
    • Reply

    Hi,

    I have used the same pin number on a Uno and a Mega.
    The debug is ok on the UNO, but on the Mega it says All registers read at 0xFF .
    Is this definately coming from my wiring ? Or do I need to change something in the config file?

    Thank you.
    —–
    Output on Mega :
    All registers read as 0xFF or 0x00! Is the nRF905 connected correctly?
    Raw: 0 0 0 0 0 0 0 0 0 0
    All registers read as 0xFF or 0x00! Is the nRF905 connected correctly?
    Raw: 127 255 255 255 255 255 255 255 255 255
    Channel: 383
    Freq: 921400KHz
    Auto retransmit: 1
    Low power RX: 1
    TX Power: 10dBm
    Band: 868/915MHz
    TX Address width: 15
    RX Address width: 7
    RX Payload size: 255
    TX Payload size: 255
    RX Address [0]: 255
    RX Address [1]: 255
    RX Address [2]: 255
    RX Address [3]: 255
    RX Address: 4294967295
    CRC Mode: 16bit
    Xtal freq: 0MHz
    Clock out freq: 500KHz

    —–
    Ouput on UNO :

    Started
    Raw: 108 12 68 32 32 229 166 76 254 216
    Channel: 108
    Freq: 433200KHz
    Auto retransmit: 0
    Low power RX: 0
    TX Power: 10dBm
    Band: 433MHz
    TX Address width: 4
    RX Address width: 4
    RX Payload size: 32
    TX Payload size: 32
    RX Address [0]: 229
    RX Address [1]: 166
    RX Address [2]: 76
    RX Address [3]: 254
    RX Address: 4266436325
    CRC Mode: 16bit
    Xtal freq: 16MHz
    Clock out freq: Disabled

    1. The Mega uses different pins for SPI (MISO, MOSI, SCK) –
      11 -> 51
      12 -> 50
      13 -> 52

        • aymeric on October 11, 2015 at 2:57 pm
        • Reply

        Thanks for taking the time to answer .. Working perfect now !

    • Aymeric on October 11, 2015 at 4:53 pm
    • Reply

    Hi,

    I do not get the expected results with your Hello World script mentionned in this thread..
    With the Interrupt at 5, nothing is sent, nothing is received
    At 0, it sends once with counter =1, and receives one and sometimes multiple occurences of hello world 0
    At 1, it sends perfectly in loop (1, 2,3, 4…), but nothing is received.

    Any idea ?
    Thanks a lot.

    • aymeric on October 12, 2015 at 3:06 pm
    • Reply

    Hello,
    Regarding my previous post, the line I was changing in the config file was :
    #define NRF905_INTERRUPTS 1
    I tried 1, 0, and 5 with no good results.
    Sorry to bother you with this, but I getting this to work is important to me. I have a great deal of code ready for my project, which is getting sensors in an Radio control sailing boat, and receiving this info on an lcd screen remotely.
    Please let me know how I can help you identifying the problem.

    1. Theres client and server code for the hello world code, which ones have you loaded onto the Uno and Mega boards? If you use pin 3 for DR as described in the main post then you should keep INTERRUPT_NUM at 1 for the Uno and 5 for the Mega. NRF905_INTERRUPTS should only be 0 (disabled) or 1 (enabled).

    • Eukor on October 13, 2015 at 4:40 pm
    • Reply

    Hi,
    I try to transfer data between the Arduino Yun, UNO and Arduino Pro 328 – 3.3V / 8MHz. Transmission between UNO and Pro works without a problem. Unfortunately it does not work transfer data between YUN and other Arduino. In YUN, like Leonardo, otherwise you have to connect ICSP communication. Despite this, something is not working. Sometimes it is possible to send and receive individual portions of data and then YUN dies.

    Serial Monitor shows only that:
    Server started
    Waiting for ping…
    Got ping
    Sending reply…
    Reply sent
    Data:

    NRF905 system plugged into YUN like this:
    3.3V VCC
    CE 7
    TXE 9
    PWR 8
    CD 2
    AM –
    NC –
    DR 3
    SO SPI MISO (socket ICSP)
    SI SPI MOSI (socket ICSP)
    SCK SCK Serial Clock (socket ICSP)
    CSN 10
    GND

    I use code such as in the example of the library.
    NRF905 system is connected to YUN through voltage dividers.

    What can I do to make it work properly? Change connection pins, or rather something in the code?

      • Eukor on October 17, 2015 at 5:08 pm
      • Reply

      Is it possible to connect NRF905 to the Arduino Yun using your library? I have tried in various ways, but do not want it to work. On the Arduino UNO and Arduino Pro works perfectly. With additional antenna up to 300m.

      1. It looks like the Yun has a slightly different interrupt pin set up. In nRF905_config.h try changing INTERRUPT_NUM to 0.

          • Eukor on October 18, 2015 at 10:42 pm
          • Reply

          I changed INTERRUPT_NUM to 0, but still does not work properly. Sometimes right after uploading the script Yun communicates with Client and Serial Monitor displays the most frequently something like this:

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

          Once display something like this:

          Server started
          Waiting for ping…
          Got ping
          Sending reply…
          Reply sent
          Data: test 101
          Waiting for ping…
          Got ping
          Sending reply…
          Reply sent
          Data: test 102
          Waiting for ping…
          Got ping
          Sending reply…
          Reply sent
          Data: test 103
          Waiting for ping…
          Got ping
          Sending reply…
          Reply sent
          Data:
          Waiting for ping…

          And then he dies.

            • Zak Kemble on October 25, 2015 at 11:52 am
              Author

            I don’t have a Yun to test with, but I do have a micro pro which contains the same microcontroller (ATmega32U4), when I have time I’ll see if I can get it working on it though I’m not sure when that will be.

    • halki on October 13, 2015 at 9:55 pm
    • Reply

    hi,
    陌 used mega and your master library with 11 -> 51, 12 -> 50 ,13 -> 52 pins and INTERRUPT_NUM 5.But server and client codes didnt working.can you help me please?

    1. Have you tried running the debug example?

    • Aymeric on October 14, 2015 at 9:57 pm
    • Reply

    Hi,
    Thanks i finally got it working by :
    On the mega (server) changed the the interrupt to 0 and num to 5.
    On the UNO, chhanged the interrupt to 1 and num to 1.

    Could you briefly explain what the interrupt on/off is for ? I m unclear with this.

    Thanks !

    1. NRF905_INTERRUPTS enables or disables the use of interrupts which mainly allows the radio to wakeup the microcontroller when a new packet is received. It also does some other stuff like read the received packet and put the radio into receive mode after transmission, but according the nRF905 datasheet the way it’s put back into RX mode isn’t really the way it’s meant to be done. If NRF905_INTERRUPTS is disabled then it does all the data reading when you call nRF905_getData(). At some point I’ll get a v3 of the library made which will make setting up interrupts a little easier to understand and use callbacks for when data is received etc.
      INTERRUPT_NUM sets which interrupt to use when NRF905_INTERRUPTS is enabled.

    • aymeric on October 15, 2015 at 11:54 am
    • Reply

    Hello,

    By any chance, can I insert both #define INTERRUPT_NUM and #define NRF905_INTERRUPTS
    directly in the server and client codes and remove them from the config file ?
    This would avoid having to adjust the config file everytime I need to update the arduino(s).

    Thanks.

    1. No that won’t work, the library code is compiled separately from the arduino sketch so it won’t see any of the #defines.
      What you could try is something like this in nRF905_config.h:


      #if defined __AVR_ATmega2560__ || defined __AVR_ATmega1280__
      #define INTERRUPT_NUM 5
      #else
      #define INTERRUPT_NUM 1
      #endif

    • aymeric on October 17, 2015 at 8:40 am
    • Reply

    Hello,
    I got working now … forget my last questions. Thanks.

    1. Ah good. I’ll answer them anyway, could be helpful to somebody else 馃槢

    • aymeric on October 17, 2015 at 12:04 pm
    • Reply

    Hello. again 馃檪

    Thanks for taking the time to answer all my questions.

    I need to output to a tft screen that also uses SPI pins using the UTFT library.

    I understand I need to place the nRF905_interrupt_off() /on at some stage, but where exactly in the code ? Is it just before / and after the get data command ?
    I am using your helloworld code from http://pastebin.com/yFj8xtdZ

    1. No, you turn off interrupts before calling any graphics functions then turn it back on after.
      nRF905_interrupts_off();
      drawStuff();
      nRF905_interrupts_on();

    • aymeric on October 18, 2015 at 1:07 am
    • Reply

    Hello,

    Sorry but again.. no luck..Please don’t get nervous !!

    Here is part of my code, the output of the buffer array are both 0, as if no values were transmitted. It works fine when I just use Serial ouput without the LCD code.
    ….

    void loop(){

    nRF905_interrupt_off();

    // HERE I HAVE MY CODE FOR DRAWING IN THE LCD SCREEN

    nRF905_interrupt_on();
    int buffer[NRF905_MAX_PAYLOAD];

    while(!nRF905_getData(buffer, sizeof(buffer)));

    nRF905_receive();

    nRF905_interrupt_off();

    myGLCD.setFont(SevenSegNumFont);
    myGLCD.printNumI(buffer[0],LEFT, 10);
    myGLCD.printNumI(buffer[1],LEFT,180);

    nRF905_receive();

    }

    1. The payload buffer should be of type byte, not int (unless you know what you’re doing). http://pastebin.com/QMuVUGKU

  1. Zak, first off, fabulous job on the library, and your dedication to helping the community is incredible!!!!

    Keep up the good work.

    I’ve been dabbling on and off with arduino for a few months, and I’ve got crazy plans for automating my house 馃檪 your library and my arsenal of cheap nRF905s will be key.

    Last night I finally had a breakthrough and got your library to work on my arduinos… so now I’m flying forward. My next challenge is figuring how to have 1 (arduino uno + nRF905) act as the server and receive and communicate back to 4 other setups.

    Wish me luck! and you might end up getting questions from me in the future 馃槈

  2. I know I just posted a comment saying I don’t have any questions… but then I thought of one… lol

    Have you put any thought into a mesh implementation, similar to what the Radiohard library has?

    The reason I ask is that the home project I’m working on will feature 5 arduino setups throughout the 3 levels (and backyard) of my house. And I was hoping to have a single master server arduino that manages collecting data from all the other 4 as well as sending commands. And I’m concerned that distance might be an issue, so with a mesh implementation I could have all the nodes relay the packets to the master server.

    1. Heya! This library is only meant as a low-level hardware driver, meaning it’s only supposed to have the code needed to get various features of the nRF905 radio hardware working. Things like mesh networking are higher up the stack (dealt with in software, not the nRF905 hardware). So for this library it’s up to the user to write their own code or use an existing mesh library to process the data that the radio sends and receives.
      Good luck on your project 馃槢

      1. Thanks for the response.

        I guess I’ll have to try and code a simplistic one myself.

        Wish me luck.

        If I’m successful I’ll definitely be back to share the results 馃檪

          • Willy on November 23, 2015 at 10:15 pm
          • Reply

          Hey,

          I’m currently also interested in setting up a mesh network with the NRF905s as I am already running into reception interference.
          I’m at a loss of how to set it up as the NRF905s only respond to their own address.

          Have you had any luck yet?

          Mark

            • Zak Kemble on November 25, 2015 at 1:21 pm
              Author

            Set the transmit and receive addresses to the same for all radios (not setting the addresses at all should do the trick), all radios will then receive all transmissions. Send the real address as part of the payload and process it in software.

    • aymeric on November 7, 2015 at 8:54 pm
    • Reply

    Hello there !
    I intend to convert my whole Mega board to 3.3v as I wiring is starting to be complex with CD4050 and my tft screen.

    Would it be ok to connect all wires like AM/CD/DR/MISO/CLK directly to the 3.3V board ?

    Thanks !

    1. Yup, if you’re running the board at 3.3V then you don’t need any extra level conversion stuff, just connect directly to it.

    • Lakshmeesha T on November 19, 2015 at 2:26 pm
    • Reply

    Hello,
    I have used this Arduino code with 2 uno, worked great. The code got bigger and i have changed 1 with Mega.
    I did changes in config file with interupt pin with 5, and connected SPI pins at 50 51 52.
    Now, the code is automatically getting dummy data of received frames even after removing the module.
    I have added one starting funtion, that function will be looped untill other nrf send acknowledgement at the Arduino startup. This funtion is getting ACK even after removing the module.

    Any solutions plz….

    1. Sounds like you don’t have the interrupt pin connected correctly. You should still use pin 3 for DR on the Mega board, but in the nRF905_config.h file you should change INTERRUPT_NUM to 5.

        • Lakshmeesha T on November 19, 2015 at 3:39 pm
        • Reply

        Thanks for quick replay.
        im using the same pin 3 for DR & yes, changed INTERRUPT_NUM to 5 in config file. This is happening just after changing from uno to mega with mentioned changes.

        1. Hard to guess what could be the issue, maybe try disabling interrupts – NRF905_INTERRUPTS to 0 in nRF905_config.h

            • Lakshmeesha T on December 18, 2015 at 9:05 pm

            I will try that later in time. Finally finished my project with 3 Arduinos, 2 uno & 1 mega. 1uno & mega communicating with i2c. Worked great
            Thanks for your blog, library and the support.

    • Roland on November 26, 2015 at 9:17 pm
    • Reply

    Hi Zak,

    is translate with google…
    I can do what I want , but it can be in the Arduino
    IDE does not compile as the ping_server or the ping client . Again and again comming . He does not seem to recognize the nRF905 .
    ping_server:32: error: ‘nRF905_init’ was not declared in this scope
    ping_server:36: error: ‘nRF905_setRXAddress’ was not declared in this scope
    ping_server:39: error: ‘nRF905_receive’ was not declared in this scope
    ping_server.ino: In function ‘void loop()’:
    ping_server:51: error: ‘NRF905_MAX_PAYLOAD’ was not declared in this scope
    ping_server:54: error: ‘buffer’ was not declared in this scope
    ping_server:54: error: ‘nRF905_getData’ was not declared in this scope
    ping_server:60: error: ‘nRF905_setTXAddress’ was not declared in this scope
    ping_server:63: error: ‘buffer’ was not declared in this scope
    ping_server:63: error: ‘nRF905_setData’ was not declared in this scope
    ping_server:68: error: ‘nRF905_send’ was not declared in this
    Any idea? Thanks

    best Regards from Germany

    1. Hey, it looks like you have not installed the library correctly. You need to put the arduino/nRF905 folder from the GitHub repo into your Arduino library folder. If you’re using Arduino 1.5 or newer then you might have make a new folder called src in the nRF905 folder and move the .cpp and .h files into that folder.

    • Roland on December 3, 2015 at 12:39 pm
    • Reply

    Hi Zak,

    Many thanks for the quick response. After much trial and error , it has succeeded .
    Now have the Arduino IDE 1.6.5 and with the folder ” src ” , the problem has solved .
    I use 2x Arduino Mega . Do I need to change something in the library ?

    Regards
    Roland

    1. Yea, INTERRUPT_NUM should be changed to 5 in nRF905_config.h.
      Some come pins also need to be changed:
      12 to 50
      11 to 51
      13 to 52

    • Mart on December 7, 2015 at 10:41 am
    • Reply

    Hello,

    I’ve been testing with the nrf905 for a while now and works great. Thanks for the library.
    But I now want to change the band but i can’t get this working.
    In the nRF905_config.h there are some defines

    // Frequency band
    // NRF905_BAND_433
    // NRF905_BAND_868
    // NRF905_BAND_915
    #define NRF905_BAND NRF905_BAND_433

    when i change the nrf905_band to nrf905_band_915 it stops working how can i change this?

    1. You also need to change NRF905_FREQ to match the band, like 915000000UL
      The module you’re using also needs to have the correct component values tuned for 915MHz, most modules are only tuned for 433MHz. If the module is not tuned correctly then the range will be very short.

    • Marcos on December 8, 2015 at 1:41 pm
    • Reply

    Hi Zak, thanks for your great contribution.
    I’m using the debug example that you made, and i realised that the power output changes its values. I wish to know the way to keep it fixed to the value set in the config.h file.
    Also i need to know the way of setting the channel, by default it is configured in 108. I’ve seen two functions in the nRF905.cpp:
    void nRF905_setFrequency(nRF905_band_t band, uint32_t freq)
    and
    void nRF905_setChannel(nRF905_band_t band, uint16_t channel)
    could you tell me how those functions works?

    Thanks

    1. Output power and frequency shouldn’t change, from the data you emailed me it seems that just a single bit occasionally changes so could just be a bad connection.
      About those 2 functions – The paragraph under the wiring diagram and the documentation here should help with those. nRF905_setFrequency() just converts the supplied frequency to a channel number then calls nRF905_setChannel() since the nRF905 doesn’t support directly setting the frequency (only band and channel). It’s best to only use nRF905_setChannel() as that skips all the conversions.

        • Marcos on January 8, 2016 at 10:26 pm
        • Reply

        We have achieved that modules communicate, the problem was in the wiring, so we have discarded the protoboard and used a board designed by us.
        The problem now is the range… we couldn’t obtain distances above 100 mts, even with the Output power set in 10 dBm and in visual link. Any idea how to improve that?

        1. You could try using a different frequency/channel and maybe a different antenna.

    • hmortensen on December 15, 2015 at 8:57 pm
    • Reply

    Hi Zak

    I’ve got some readings from a consumer device with your debug app:


    Raw: 127 255 255 255 254 254 198 0 0 0
    Channel: 383
    Freq: 921400KHz
    Auto retransmit: 1
    Low power RX: 1
    TX Power: 10dBm
    Band: 868/915MHz
    TX Address width: 15
    RX Address width: 7
    RX Payload size: 255
    TX Payload size: 254
    RX Address [0]: 254
    RX Address [1]: 198
    RX Address [2]: 0
    RX Address [3]: 0
    RX Address: 50942
    CRC Mode: Disabled
    Xtal freq: 4MHz
    Clock out freq: Disabled

    Raw: 127 255 255 255 255 128 0 0 127 255
    Channel: 383
    Freq: 921400KHz
    Auto retransmit: 1
    Low power RX: 1
    TX Power: 10dBm
    Band: 868/915MHz
    TX Address width: 15
    RX Address width: 7
    RX Payload size: 255
    TX Payload size: 255
    RX Address [0]: 128
    RX Address [1]: 0
    RX Address [2]: 0
    RX Address [3]: 127
    RX Address: 2130706560
    CRC Mode: 16bit
    Xtal freq: 0MHz
    Clock out freq: 500KHz

    Is that enough to read data?
    I tried setting channel and read data, but didn’t receive anything.

    Can you supply me with a simple example for reading from this channel?

    //HM

    1. The debug output doesn’t look right. TX/RX Address width should only be either 1 or 4, not 7 or 15. TX/RX payload size should be a maximum of 32 and 0MHz xtal freq is also incorrect. So there seems to be an issue with reading the nRF905 settings which should be corrected first.

        • hmortensen on December 17, 2015 at 9:11 am
        • Reply

        Could it be due to incorrect wiring or incompatible sender device?

        1. Probably bad wiring. How are you connecting the Arduino to the nRF905 radio, soldering wires straight to the chip while it’s still in the original device?

    • Marcel Keller on January 8, 2016 at 10:21 pm
    • Reply

    Hi, i would like to build a stop watch with a Start Sender (arduino UNO with nrf905) which send a Start Signal to another Arduino with nrf905. It is possible to call an own programed interrupt function when the nrf905 receive Data? I will save the exactly receive Time (Starttime=millis()).
    Thanks for your Support, Marcel

    1. Hi, you could edit the library’s interrupt to call your own function, like this –

      In your sketch add this:
      void dataReceived()
      {
      byte buffer[NRF905_MAX_PAYLOAD];
      if(nRF905_getData(buffer, sizeof(buffer))
      {
      // your code here
      }
      }

      And just above the nRF905 interrupt (at the bottom of nRF905.cpp) add extern void dataReceived(); and at the bottom of the NRF905_RADIO_STATE_RX case (just above the break) add dataReceived();.

        • Marcel Keller on January 11, 2016 at 10:16 pm
        • Reply

        Thanks, it works perfect!

    • Dex on January 18, 2016 at 5:36 am
    • Reply

    Hi Zak, I just wanted to thank you for posting all of this. I’m in the US, so I need to be around the 915 Mhz range before I can transmit continuously. I replaced the nRF905 inductors to tune it for 915Mhz (per the datasheet), but couldn’t get RadioHead to switch frequencies. I was easily able to test it with your library, using the ping example, so that was a big help. Reading all the comments also gave me more insight than I was able to get from just the RadioHead pages, so now I’ll probably be able to figure out the RadioHead library, too. Thanks for sharing this information!

    • Richie on January 20, 2016 at 1:54 am
    • Reply

    Hello,

    thanks for you great work ! I have two remarks:

    A)
    There is a problem with the ISR variant of it. I use a Arduino UNO with the wiring as given in the examples.

    In the ISR, when radio.state == NRF905_RADIO_STATE_RX and the payload is readed out, DR goes from high to low. At least in my configuration, an additional interrupt will be created from this and the ISR is entered again – and overwrites happily the payload with zeroes.
    There should be a check for rxData.ready or a check of the status bit (is DR on ?) or the ISR configured for DR rising or some other means.

    B) Reversing the address bytes is ok, but it should noted a little bit bolder as it is done now – it costs me some hours to find the problem while connecting your library on Arduino with a python Raspberry hack 馃檨

    Greetings

    1. A) The library should be configuring the interrupt to only fire on the rising edge, so I’ve no idea what’s happening with your setup.

      B) Ha, even I forgot that the address bytes are reversed! That’s probably why people have been having trouble getting the radio working with systems that only use my library on one side >.< I’ll move that bit of info somewhere more noticeable, sorry about that!

        • Richie on January 20, 2016 at 3:01 pm
        • Reply

        Ad A)

        Ahem, I use a stock arduino uno with your unmodified ping_server example and it does not work, e.g. I got zeroes as payload. The only difference to your setup is that I use a other level converter (this one: http://www.hobbytronics.co.uk/mosfet-voltage-level-converter), but not for DR: Where do you configure the interrupt ?

        I fixed it this way and it works like a charm:

        ISR(INT_VECTOR)
        {
        switch(radio.state)
        {
        case NRF905_RADIO_STATE_TX:
        // Finished transmitting payload
        stateTx();
        break;
        case NRF905_RADIO_STATE_RX:
        // New payload received
        CHIPSELECT()
        {
        uint8_t status = spi_transfer(NRF905_CMD_R_RX_PAYLOAD);
        if (status & _BV(NRF905_STATUS_DR)) {
        // Get the received payload
        uint8_t len = config.payloadSize;
        for(uint8_t i=0;i<len;i++)
        rxData.buffer[i] = spi_transfer(NRF905_CMD_NOP);
        rxData.ready = true;
        }
        }
        // We're still in receive mode
        break;
        default:
        break;
        }
        }

        1. The interrupt is configured a the bottom of nRF905_init(), REG_EXTERNAL_INT_CTL |= BIT_EXTERNAL_INT_CTL;. BIT_EXTERNAL_INT_CTL is defined in nRF905_defs.h.

            • Richie on January 26, 2016 at 9:35 pm

            At the end, it seems that I must confess that my problem seems to be a hardware issue. I ported the whole thing to a Atmega8, 16MHz on a breadboard, using a AVRISP mkII programmer.

            If it runs (with your unmodified code) without the programmer attached it works more or less reliable. If I attach the programmer (additional load on the SPI Lines), I get zeroes, If I apply my “fix” it works again, regardless of the programmer……

            However for the record: After reading out the received payload, another read attempt delivers zeroes, at least with the modules I have here.

    • Bram on January 23, 2016 at 3:36 pm
    • Reply

    I would like to use a Arduino with NRF905 module to send commands to my airsystem. I have a (Zehnder) CO2 remote controller transmitting at 868mhz (the precise channel/frequency is not listed). Is it possible to receive the data the controller is transmitting, so I can send the same signal to the airsystem with a Arduino?

    1. A few similar questions to yours has been asked before about interfacing the nRF905 with other systems. See this comment. It’s unlikely that the nRF905 will be compatible with other devices, unless they also use an nRF905 radio.

    • matthias on January 28, 2016 at 9:33 pm
    • Reply

    Hi Zak,
    after few sleepness nights, i need your help:
    When i use your server/client example booth nrf905 communicates together (CRC And Adresses correct), but the Payload Data isn麓t correct.
    I modyfied the programms to send and see in bytes,
    Send: 254 254 254 1 1 1 0…0 Recived: 255 255 255 0 50 0 0 0…0
    Send: 254 254 254 1 1 2 0…0 Recived: 255 255 255 0 50 0 1 0…0
    Send: 254 254 254 1 1 3 0…0 Recived: 255 255 255 0 50 0 1 0…0
    Send: 254 254 254 1 1 4 0…0 Recived: 255 255 255 0 50 0 2 0…0
    I use a Pro mini 3,3V and Uno with level shifter
    Nrf Modules from fasttech and wired with dupont wires.
    the debug sketch looks good
    distance of Moduls only two hands

      • matthias on January 29, 2016 at 10:03 am
      • Reply

      update: When display the payload in BIN it looks like a bitshift. maybee its a wire or timing problem with levelshifter.

      Wenn I Send: 00110011 00000100 11001010
      i recived: 00011001 00000010 11100101

      • matthias on January 29, 2016 at 10:24 pm
      • Reply

      now i changed SPI Speed in nRF905.cpp and it woks!
      SPI.setClockDivider(SPI_CLOCK_DIV2); to SPI.setClockDivider(SPI_CLOCK_DIV4);
      thanks for your good commented libary

      1. Hah, glad you got it in the end 馃槢 If slowing the SPI clock works then it’s likely the level shifter that is too slow.

  3. Hi Zak
    Great tutorial!

    I am just getting up to speed with the usage, I see the default freq is 433.2Mhz, I want to change to 868.2Mhz, and I tried the following

    void setup()
    {
    // Start up
    nRF905_init();
    nRF905_setFrequency(NRF905_BAND_868, 868000000UL);
    //nRF905_setFrequency(NRF905_BAND_433, 433800000UL);

    I am using an RTL-SDR to monitor the output, and when I call the 868 Freq, nothing appears, but I know I can call this API routine here, because I have managed to tune to 433.8Mhz (altered from the default)

    Am I missing something ?

    Thx
    Lee

    1. Hey Lee, nRF905 modules are tuned for a single band, usually 433MHz. Using it on another band will result in low transmission power and poor receive sensitivity. I’m able to see a weak signal with my RTL-SDR with a 433MHz module transmitting at 868MHz, you pretty much have to have the radio module and SDR touching each other.

  4. Hi Zak
    Thanks for library.

    I am facing issues in reception. I am using ATMEGA168 XMINI board and nRF905 PTR8000+.
    Transmission is OK but I always receive 0xFF (corrupt data).

    I am working on 868MHz. At start I perform write-read-verify on RF Config register. The RF Config registers are written proper.

    What may be the issue? Where am I going wrong?

    1. Hey Kushal, most nRF905 modules are tuned for 433MHz. Using a different band will result is low transmit power and poor receive sensitivity. Does it still only receive 0xFF if you run it on the 433MHz band?

      1. Thanks for your quick response.

        I tried once again. Transmission/Reception work perfect at 433MHz. The issue is with 868MHz. At 868Mhz, when nRF905 modules are placed very close (< 5cm), the data transfer works perfect. But communication stops with increase in distance more than 5-10 cm.

        What may be the issue at 868Mhz? Why its working fine at 433MHz and not at 868MHz?

        And yes, Thanks for the helpful library…

        1. Most nRF905 modules are tuned for 433MHz. That means they have slightly different component values and placements. The datasheet has example schematics for both bands where you can compare the differences.

    • Rajarahim on March 3, 2016 at 4:17 pm
    • Reply

    Hai zack
    I want to make wireless intrrupted with 1 server and 2 or more client using arduino and nrf905
    How to make it?
    Please
    I need it to trigger another arduino from 1 server arduino wirelessly

    1. Hey Rejarahim, set the 2 clients to the same receive address and they’ll both receive the same thing at the same time.

  5. Help please 馃檪

    I’m a teacher from Sydney making my first steps in Arduino. I’ve got a group of kids and we are working on a wearable project where we plan to have a hat that will transmit GPS locations over the RF Antenna, another device (parent) receives the GPS location data and calculate the distance. If too far, alarm will go off.

    I’ve set the RF Antennas to work on Arudino Uno based on your instructions and it works well. But my wearable project uses Flora Arduino which is a different board: https://www.adafruit.com/products/659

    I’ve spent a fair amount of time trying to map all the pins from the UNO to Flora (using their support forum) and even soldered a few extra pins for their SPI Interface to make the connections.

    After connecting everything I find that the ping client / server code doesn’t work (I was trying to make the Flora as the server).

    I’ve asked Flora for support and they referred me to you as they claim they don’t know the product. The following post includes a photo, my mapping of the Uno to Flora and the code I was trying to use:
    https://forums.adafruit.com/viewtopic.php?f=51&t=97274&p=487648#p487567

    Can you please help me out? I’m guessing that the mapping wasn’t correct but I really have no one else to ask and I’ve got a group of young kids looking up for me to find a solution.

    Help me Zack, you are my only hope… 馃檪

    1. Hi Amnon,
      Looks like a good attempt so far, could you provide the changes you’ve made to nRF905_config.h?

      1. Thanks Zak! I didn’t make any changes to the Config.h. In fact I didn’t even know that such changes are possible (as mentioned I’m a beginner in Arduino). But now that you mention it, it makes sense. I’ve heard about config.h files, just never actually changed one before.

        The only mapping I’ve done so far was in terms of the physical connection – what pin goes where. I’ve done it using this table: https://forums.adafruit.com/download/file.php?id=36756

        Happy to make suitable changes in the config.h file, but I’d be happy for your guidance on this as I’m concerned I’ll change something wrong.

        While on this, I have 11 resistors connected to the project and since the aim of all this is to go on the inside of a hat, is there any way to reduce the amount of the resistors? There are way to many components and cables as it is as you can see in this image: https://forums.adafruit.com/download/file.php?id=36755

        Thank you so very much for your prompt and positive help 馃檪

        1. Ok, in nRF905_config.h change the following #define things, these are also which pins you should wire the nRF905 to:

          TRX_EN = 12
          PWR_MODE = 6
          TX_EN = 9
          CD = 3
          CSN = 10
          DR = 2

          MOSI, MISO and SCK need to connect to that little 6 pin connector.

          As for the resistors, you could use a dedicated level converter module like [this]. Though the FLORA already runs at 3.3V anyway, so you don’t need any level conversion to begin with! Just connect the nRF905 straight to the FLORA.

            • Amnon on June 2, 2016 at 2:40 pm

            Thanks so much for your help! You Rock!
            But unfortunately I need to ask for a bit of further clarification:

            I’ve modified the config.h file and connected the pins directly without the resistors (thank for the tip!). Uploaded the server code, then the client code to the Uno (I swapped to the original config.h file prior to upload. However it still doesn’t work.

            I suspect that I need to change the actual wiring to different pins on the Flora. I’m using this mapping table that I’ve made between Uno and the Flora including connecting the MISO, MOSI and SCK to the SPI pins (I’ve soldered pins in those holes).
            https://forums.adafruit.com/download/file.php?id=36756

            For example you suggest that the Power Up should be connected to pin 6. Flora doesn’t have a pin 6,only D6 (I suspect that’s the same) but that pin is already taken by the Standby (see table). There are also no pins 2 and 3 on Flora. I mapped the DR to pin SCL and the CD to pin SDA. It could very well be the case that those mappings are wrong, I based it on some answers I got from the Flora forum plus some guesswork, so it won’t be very surprising…

            Can you please advise how the revised mapping should be on the Flora compared to the table?

            Thanks so so much for your wonderful support. It really means the world to me and the kids I work with 馃檪

            Amnon

          1. Ah yea, by pin 6 and 12 I mean pin D6 and D12.
            It might be best to update your table with my pin assignments, rather than try to combine the two. Standby (TRX_EN/CE) should go to 12.
            I was going by this [diagram] where SCL is D3 and SDA is D2.
            Mapping DR to SCL (D3) won’t work unless you also update INTERRUPT_NUM to 0 (that pin is AVR INT0, unlike on the Uno where it is INT1).

            • Amnon on June 3, 2016 at 12:14 pm

            Yay! It works(ish)!

            I swapped the cables to suit your suggested pins and now on the client I get response in this format:

            Ping time: 15ms
            Data from server: 每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每
            Ping time: 14ms
            Data from server: 每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每每
            etc.

            When I had Uno to Uno the data from the server was ‘Data from server: test (n)’.
            What could be causing these weird characters to appear?

            Thanks heaps mate 馃檪

            Amnon

          2. Hah, almost there 馃槢 Those weird characters means it wasn’t able to read the data from the SPI bus correctly (it just reads the hex value 0xFF all the time). Make sure you’ve got the pins on that 6 pin header wired up correctly. Does the same thing happen on the other Arduino if you swap the client and server code around?

    • David on May 30, 2016 at 8:34 pm
    • Reply

    Hello Zak,

    First of all thanks for your library.

    I am an beginner in the arduino world and i just bought two NRF905 transceivers and I’m struggling to make them work.
    I have an arduino Uno and an Arduino Mega.
    Which example should upload in each one to have the most basic communication.

    Thanks in advance!

    1. Hi David, the ping examples are the most basic. Upload ping_server to one Arduino and ping_client to the other, then you should see some output when viewing the serial console.

    • Michael on June 11, 2016 at 3:34 am
    • Reply

    hey this may seem like a stupid comment but I’m a beginner to the NRF905 and would like some help
    i just want to create simple program on one arduino with the NRF905 transceiver to send a message something like hello to a program on another arduino with an NRF905 which will display this message on the serial. basically i need the base structure/commands for sending and receiving messages

    1. Have a look at the wirelessSerialLink example.

    • Vedran on June 14, 2016 at 4:20 pm
    • Reply

    Hello Zak, thank you for your library,
    iam using 2 nRF’s, and i have a problem with reading numbers from serial port. Whenever i send something to serial port it returns some strange numbers.

    if (Serial.available() > 0) {

    // read the incoming byte:
    incomingByte = Serial.read();

    // say what you got:
    Serial.print(“I received: “);
    Serial.println(incomingByte, DEC);
    }

    thank you for your help.

    1. That doesn’t seem to be an issue with the nRF905 radio or this library. What are you inputting and what values are you expecting on the output, and what values are you actually getting instead?

    • Davier on August 11, 2016 at 5:37 pm
    • Reply

    Hola Zak…tengo una pregunta, estoy usando dos arduinos nano y dos modulos nfr905; deseo transmitir y resibir datos de un sensor. quiero saber como conecto el nrf905 al arduino nano, ademas que biblioteca debo usar y por ultimo como hago para que trabaje a su maxima potencia ya que requiero 200 metros o mas de distancia.
    muchas gracias!

    Google translate:
    Zak Hi … I have a question, I’m using two Arduinos nfr905 nano and two modules; I wish to convey and resibir data from a sensor. I want to know how to connect the NRF905 to arduino nano, in addition to a library and finally I use as I do to work at full power and I require 200 meters or more away.
    thank you very much!

    1. Hi Davier, connecting the nRF905 to the Nano is the same as the Uno. The digital pins just have a D in front of the pin number, so pin 13 = D13.

    • Jas on September 8, 2016 at 3:57 am
    • Reply

    Hello, i’m having a problem compiling the examples.
    This warning comes up every time I compile
    WARNING: Category ” in library nRF905 is not valid. Setting to ‘Uncategorized’
    What can I do to solve this? And also, I am using an Arduino Mega which also outputs a 3.3V. Can I just use that as the VCC instead of using a voltage divider? Thank you for the library ^_^

    1. Hi Jas, that message only a warning, it will still successfully compile if there are no other problems. Though, if you want to get rid of the warning then go to the nRF905 library folder, open library.properties in notepad and set the Category option to Communication. Yes, you can use the 3.3V output for powering the radio (you should not use voltage dividers for the main power rails).

        • Jasmin on September 8, 2016 at 6:15 pm
        • Reply

        Thank you for replying. ^___^ It is now working properly. I would like to ask if you have any sample program which could demonstrate two-way communication between the two Arduinos?

        1. Checkout the wirelessSerialLink example.

    • maciel on September 14, 2016 at 12:06 am
    • Reply

    hello, how do I get transmission 1000 mts with NRF905 module? changing frequency or band is?
    thanks for listening!

    1. You will need to find a module that contains an RF power amplifier if you want longer range.

    • Muhammad Ali on September 16, 2016 at 6:03 pm
    • Reply

    Hi Zak

    I am trying to capture the signal from a remote control and I am not too sure is it possible to directly capture it with this module.. Any help would be appericiated

    1. Hey Muhammad, the RF modulation, data rate and packet format of the remote control must be the same as described in the post. If the remote doesn’t use an nRF905 chip then it’s unlikely that you’ll be able to use an nRF905 module to capture the data.

        • Muhammad Ali on September 18, 2016 at 5:04 am
        • Reply

        Hi Zak, thanks for your help, how would I know what kind of chip remote control is using. I opened the remote control and couldn’t find any information about the chip 馃檨

        1. What markings and numbers does the chip have written on it?

    • Jasmin on October 5, 2016 at 11:36 am
    • Reply

    Hello! I would like to ask regarding the program you gave to aymerik who asked you last October 18, 2015. Is the function while (!nRF905_getData(buffer, sizeof(buffer))); means that it will wait until a data was received and will stop when it already satisfies the condition? How about when we want to continue reading the data from the transmitter continuously? In other words, after satisfying the condition in the while loop, we want to go back to the initial part of the program which was receiving . Can you suggest any way in modifying this statement in the program? Thanks in advance!

    1. Hey Jasmin, yeah the program will wait at the while() loop until a packet has been received and then carry on. The code I posted is for Arduino, when the end of the loop() function is reached the function is called again where is starts back at the top of loop(). So I would think it already does what you want it to do.

        • Jasmin on October 8, 2016 at 10:41 am
        • Reply

        Hi again. We are trying to transmit and receive continuous data reading from a sensor. We are facing difficulties in terms of reception as it only displays the data received first. The next data reading sent were not displayed by the receiving monitor. However, looking at the transmitting monitor, it displays different sensor readings being sent. In which part is the problem? What can be the solution to this?

        1. Could you post the code you have at the moment to Pastebin?

            • Jasmin on October 8, 2016 at 11:18 am

            http://pastebin.com/Xb6rRBEF – for transmitter
            http://pastebin.com/6s2fc5hK – for receiver

            These are the codes. Thank you.

          1. On the receiver you need to put it back into receive mode after it has received a packet. On the transmitter the send function needs to be in a while() loop if you want to make sure it successfully transmits.

Leave a Reply

Your email address will not be published.

Are you human? *