Arduino Forum

Using Arduino => Networking, Protocols, and Devices => Topic started by: maniacbug on May 26, 2011, 06:15 am

Title: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on May 26, 2011, 06:15 am
Moderator (dec 2015): The library mentioned here is updated on another location.
see http://forum.arduino.cc/index.php?topic=62222.msg2520932#msg2520932



Hi, I thought I should actually formally announce this driver library one of these days...  I have been working toward building a complete driver implementation for the Nordic nRF24L01/nRF24L01+ chips.  This is the lowest layer of a mesh network stack I'm working on, though it should be independently useful for any usage of these chips.

Complete documentation is here: http://maniacbug.github.com/RF24/index.html

Examples range from a simple two-node ping/pong (http://maniacbug.github.com/RF24/pingpair_8pde-example.html) to a complex multi-hop mesh network (http://maniacbug.github.com/RF24/starping_relay_8pde-example.html) which should work with unlimited nodes (I've tried 6).

Suggestions are welcome.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Jul 27, 2011, 11:08 pm
Hey ManiacBug,

How's it going? Any updates.

Sorry got way off track here but picking it up I hope...

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: novice on Jul 28, 2011, 04:29 am
Hi maniacbug,

I've been quietly watching this thread too.

Which radio modules you are using?. and where did you buy them?.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Jul 28, 2011, 07:16 am
Since he hasn't responded yet, its likely because he's been rather busy.

We've been having a fun exchange for some time now as I too am interested in enhanced RF24 support. I don't want to  take the wind out of his sails, but it looks like he's added support for interrupt based I/O. I don't know if he considers it stable or not but its certainly something to which we can look forward.

Additionally, I hope he'll be merging in a number of new features and bug fixes from my tree. My tree has largely concentrated on P-variant features, which includes support for 250kbs bandwidth mode, data rate query, enhanced CRC configuration (/query) and defaults, faster SPI bus interface, per pipeline auto ACK configuration, and PA power query/configuration. I'm likely forgetting some minor others.

I expect at least one additional bug fix will follow shortly with the possibility of a second shortly after that. I have yet to fully confirm the second.

Additional debugging information has been added printDetails() and IIRC, he's also added some additional debugging details throughout.

Quote from: printDetail()
STATUS=0e: RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0 = 0xdeadbeefed
RX_ADDR_P1 = 0xc2c2c2c2c2
RX_ADDR_P2 = 0xc3
RX_ADDR_P3 = 0xc4
RX_ADDR_P4 = 0xc5
RX_ADDR_P5 = 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0 = 0x20
RX_PW_P1 = 0x00
EN_AA = 0x00
EN_RXADDR = 0x03
RF_CH = 0x00
RF_SETUP = 0x0f (data rate: 1)
Hardware; isPVariant: 1
CONFIG = 0x0f (CRC enable: 1; CRC16: 1)


And just for giggles, here's the output from a modified, single bit (testCarrier() or testRPD()) scanner. The scanner also dumps received messages which is good for address/CRC quality testing, as well as a very primitive promiscuous operating mode. My version of the scanner has not been committed.
Quote from: scanner output

055 (2455Mhz): 05 - *****
056 (2456Mhz): 05 - *****
057 (2457Mhz): 04 - ****
058 (2458Mhz): 05 - *****
059 (2459Mhz): 06 - ******
060 (2460Mhz): 08 - ********
061 (2461Mhz): 08 - ********
062 (2462Mhz): 07 - *******
063 (2463Mhz): 05 - *****
064 (2464Mhz): 03 - ***
065 (2465Mhz): 01 - *
066 (2466Mhz): 03 - ***
067 (2467Mhz): 04 - ****
068 (2468Mhz): 05 - *****
069 (2469Mhz): 03 - ***
070 (2470Mhz): 03 - ***


There has also been some discussion of channel spacing to better support the chips wide and narrow band modes of operation.

And if you're also interested in the Mirf library, expect a minor update in the near future.

Lastly, if you have P-variant hardware, I would very much love to hear about range testing when operating in 2Mbs, 1Mbs, and 250kbs bandwidth modes. I really hope more people take interest in the very affordable and seemingly very capable nRF24 modules.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: graynomad on Jul 28, 2011, 09:04 am
This does sound nice, I love the size of those modules, you could put them into just about anything.

I to have been keeping an eye on this, not ready to do anything yet though.

______
Rob
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Jul 31, 2011, 09:51 pm
Hi Gerg and Everyone...

I am very interested in this. I have put up a beginning How-To for these modules here:
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo (http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo)

Comments, corrections, additions appreciated...

Gerg, you said:
Quote
And if you're also interested in the Mirf library, expect a minor update in the near future.

Lastly, if you have P-variant hardware, I would very much love to hear about range testing when operating in 2Mbs, 1Mbs, and 250kbs bandwidth modes.


What do you mean by "P-Variant hardware" ?? I have some of the boards that have a nRF24L01's plus a power Amp for 100mW and receiver preamp. Here:
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=190 (http://arduino-direct.com/sunshop/index.php?l=product_detail&p=190)
are these what you mean?? 

I'm just starting to fire these up... Any suggestions on best first-up software sketch / testing appreciated..

I do have an RF background.. most was higher power (Broadcast)...

Where is the best place to download your fork??  And where's best Mirf??

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: novice on Aug 01, 2011, 05:55 am
Terry,

There's a page with related information at http://arduino-info.wikispaces.com/nRF24L01-Mirf-Examples.

There's also a 'general' page at http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo.

At the base of the page it mentions that the "24F Library is much more full-featured and does error checking", and the 24F Library is described at http://arduino-info.wikispaces.com/nRF24L01-RF24-Examples.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 01, 2011, 03:18 pm
I've been using modules from mdfly.com.

Mostly these units as the workhorse of the system:

2.4Ghz Wireless nRF24L01 Transceiver Module $6.95
http://www.mdfly.com/index.php?main_page=product_info&cPath=8_52&products_id=82

And then also experimenting with these for greater range

nRF24L01 2.4GHz Transceiver Module w/ Power Amplifier $12.95
http://www.mdfly.com/index.php?main_page=product_info&cPath=8_52&products_id=394

2.4GHz Transceiver Module w/ Power Amplifier $19.95
http://www.mdfly.com/index.php?main_page=product_info&cPath=8_52&products_id=583

However, I also noticed that iTeadStudio has nRF24L01+ units for $4!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 01, 2011, 03:19 pm

Terry,

There's a page with related information at http://arduino-info.wikispaces.com/nRF24L01-Mirf-Examples.


Heh, aren't those Terry's pages?! :)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Aug 01, 2011, 04:24 pm
Hi Everyone, Sorry for the Maniacal confusion!

First, I just want to get these nRF24L01 units working well for Arduino applications and get some good examples online.  I DO have a shop that sells these modules, also so that's a Disclaimer.  

I am also researching Antennas. I have a RF / Amateur Radio background and have built antennas and RF hardware.  There are also lots of good antennas and power amplifiers available for WiFi in this same frequency band that should work for these modules.  I want to prototype longer-range solutions for Base to Mobile (say, Home to SemiAutonomous Robot or other autonomous vehicle.)
Like this Antenna: http://goo.gl/61daA   or this Amplifier:  http://goo.gl/Y8Tcu


I think there is great promise to these and with the serious software work by Maniacbug and others this should be workable.

I just connected two nRF24L01+ units with the pingpair example and I'm getting Timeouts so I need to check everything over.. Any debug suggestions appreciated.. I'd like to be able to write up a newbie Get Started page...

How can we organize this effort??

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Aug 01, 2011, 04:34 pm

I've been using modules from mdfly.com.
...
2.4GHz Transceiver Module w/ Power Amplifier $19.95
http://www.mdfly.com/index.php?main_page=product_info&cPath=8_52&products_id=583


Hey ManiacBug, have you seen these, which have both a Power Amplifier AND a Low Noise Receiver Preamplifier??
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=190  (http://arduino-direct.com/sunshop/index.php?l=product_detail&p=190)

Where in the World are you?  I'll send you a couple of these if you'll experiment with them and let us know how they work out...

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Aug 01, 2011, 05:23 pm

Hi Gerg and Everyone...

I am very interested in this. I have put up a beginning How-To for these modules here:
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo (http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo)

Comments, corrections, additions appreciated...


First let me say I very much appreciate the quality of your wiki docs. Your pages were one of the reasons I decided to further explore my sprinkler project; whereby the relay board is central.


Gerg, you said:
Quote
And if you're also interested in the Mirf library, expect a minor update in the near future.

Lastly, if you have P-variant hardware, I would very much love to hear about range testing when operating in 2Mbs, 1Mbs, and 250kbs bandwidth modes.


What do you mean by "P-Variant hardware" ?? I have some of the boards that have a nRF24L01's plus a power Amp for 100mW and receiver preamp. Here:
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=190 (http://arduino-direct.com/sunshop/index.php?l=product_detail&p=190)
are these what you mean??  


There exists the NRF24L01 and NRF24L01P (aka NRF24L01+, and even NRF24L01P+) chips. The P-variant is the next generation. It provides for a 250Kbs data rate, better receiver sensitivity, and a couple of other features. The p-variant is fully backward compatible. IMOHO, given the extremely modest price difference (typically a $1.50 or less), the P deprecates its predecessor (non-p variant). Ive read many an account whereby simply migrating from the non-p to the p-variant provides for superior range. Add in the fact the p-variant alone allows for the 250-Kbps mode which also enables much improve sensitivity, its claimed the range improvement is profound. As I've not confirmed any of this and I'm second/third hand parroting, take it for what it is.

Maniacbug has some really nice scripts and his latest stuff even has some testing/validation stuff drive via python scripts. So do check out his source repository.

I forget where I found the mirf tree. IIRC, it was google code, github, or gitorious. The bug fix is the use of 16-bit CRC rather than 8-bit CRC. Its a literal 1-byte change in a file. Keep in mind though Maniacbug's library is much higher level and feature rich. Unless your at a space premium, I do recommend his library over that of Mirf.


I'm just starting to fire these up... Any suggestions on best first-up software sketch / testing appreciated..

I do have an RF background.. most was higher power (Broadcast)...


Wouldn't happen to include a background in antenna design would it? We've had some discussion on proper pcb trace antenna orientation for best reception/transmission. My own results have proved to be borderline confusing to indeterminate. Some of which conflict with Maniacbug's observations, which makes it all the more futile. Some definitive insight would be wonderful; especially if it saves me from reading some long/dry white papers. :)


Where is the best place to download your fork??  And where's best Mirf??


My fork is available on github (https://github.com/gcopeland/RF24). But I did just get confirmation back from Maniacbug that he's merged it to a branch in his tree (https://github.com/maniacbug/RF24/tree/p_enable). So unless you like the bleeding edge, its probably best to clone his tree. From a testing perspective alone, in that his environment is must better suited than my own, I do recommend following his tree unless you're willing to stumble some from my own.

For something entirely different, I did manage some testing this weekend. I set up two modules. One as a dedicated transmitter and the other as a dedicated scanner (my version). My results were extremely surprising. In 2Mbs mode, I was able to scan 9-Mhz of bandwidth. In 1Mbs mode, I scanned 5-6-Mhz of bandwidth. And in 250Kbs mode, I scanned 2-3-Mhz of bandwidth. This is especially surprising given the datasheet basically claims 1+Mhz+some minor bleed, 1-Mhz+some minor bleed, and <1Mhz+some minor bleed. But then again, I've not really spent that much time reviewing documented the "bleed" from each operating mode. The short of it is, this test does wonders to suggest recommended channel spacing. Whereby, based on my testing, the channel spacing should be 9Mhz, 6Mhz, and 3Mhz, respectively. Whereas previous discussions centered on 2Mhz, 1Mhz, and 1Mhz.

EDIT: Added mirf library comment.
EDIT: Revised observed and document (that I read) RF performance.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Aug 01, 2011, 09:11 pm
Gerg, thanks for your good information.

I got out the big magnifier and checked the Nordic chips on the 3 products I have (Plain Nrf24L01+, with PA, and with PA+LNA) and all have a "+" character after the "24L01".  So I'm happy that these are all the latest version chip..

I have built some VHF and UHF antennas, but I'm not sure about the kind of printed circuit board antennas on the $4.75 units.  I think they are best suited to very short ranges where "just not worrying about antennas at all" is a good feature. Anything that needs more than 10 meters or so of range I'd be more comfortable with a "real" antenna. That means a connector and parts I have seen mean a Power Amplifier and maybe a Receiver Preamp are added. 

OH: There is a plain 24L01+ with RP-SMA connector that would sell for about $10. Hmm. Maybe good for very low power sensor nodes?? Any opinions?? I do not stock that but I could...

The next step in distance would be better antennas (some plug right into the same "RP-SMA" connectors.  Then there are external amplifiers, roof antennas and all that.  I hope we can establish some real-world guidelines for this stuff.  There are a lot of unsupported claims for distances and antenna gains and it's confusing and unrealistic.  I just saw a 433 Mhz Remote lights controller on TaoBao with a handheld control, that says range is 1000M ! 

OK, I'm getting these units running next!  Enough words, need signals....

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 01, 2011, 11:49 pm

In 2Mbs mode, I was able to scan 9-Mhz of bandwidth. In 1Mbs mode, I scanned 5-Mhz of bandwidth. And in 250Kbs mode, I scanned 2-3-Mhz of bandwidth. This is especially surprising given the datasheet basically claims 2+Mhz+some minor bleed, 1+Mhz+some minor bleed, and <1Mhz+some minor bleed.


Wow, this is really good information.  Spread those channels widely!


I forget where I found the mirf tree. IIRC, it was google code, github, or gitorious. The bug fix is the use of 16-bit CRC rather than 8-bit CRC. Its a literal 1-byte change in a file. Keep in mind though Maniacbug's library is much higher level and feature rich. Unless your at a space premium, I do recommend his library over that of Mirf.


Gerg inspired me to take a closer look :)  Indeed, the simple RF24 example uses 3k more program memory and 18 bytes more RAM than the comparable Mirf example.  So yes, if you're down to your last 10% of flash space, it's probably better to stick with the simpler library.

RF24/examples/pingpair:

Code: [Select]

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .data             PROGBITS        00800100 001fba 0000f2 00  WA  0   0  1
  [ 2] .text             PROGBITS        00000000 000094 001f06 00  AX  0   0  2
  [ 3] .bss              NOBITS          008001f2 0020ac 0000c6 00  WA  0   0  1


Mirf/examples/ping_client:

Code: [Select]

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .data             PROGBITS        00800100 00128a 000072 00  WA  0   0  1
  [ 2] .text             PROGBITS        00000000 000094 0011f6 00  AX  0   0  2
  [ 3] .bss              NOBITS          00800172 0012fc 0000b4 00  WA  0   0  1


Quote

I just connected two nRF24L01+ units with the pingpair example and I'm getting Timeouts so I need to check everything over.. Any debug suggestions appreciated.. I'd like to be able to write up a newbie Get Started page...


Are you getting ANY successful transmissions?  If not, any of the RF24 examples will spew out a bunch of information right at the start.  Capture that from both nodes and post it here.

Do you have the latest pull from git?  Within the last month, I fixed a bug someone reported which led to many false transmission failures.  Unless you have specific need for '+' feature, I recommend sticking with the 'master' branch until 'p_enable' gets more testing.  (Or unless you want to help test it :))

Quote

Hey ManiacBug, have you seen these, which have both a Power Amplifier AND a Low Noise Receiver Preamplifier??
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=190

Where in the World are you?  I'll send you a couple of these if you'll experiment with them and let us know how they work out...


That would be pretty handy.  I use the high-price units for my base station, so having LNA on there too would be handy.  That said, I also use PA units as relays to reach the base station, so in practice I haven't found a situation where a PA node could not reach the base within my house.

I'm in Seattle.  I'll PM you my address if you want to send a couple.  Happy to try them out.  I've been meaning to do some range tests.  It's next on my list after testing Gerg's changes more thoroughly and merging them into the mainline. 

Lately I've been doing a lot of work on atmega128rfa1, which is a different beast entirely.  It runs RPL over IPv6 which is COMPLETE hotness, but the hardware is too expensive.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Aug 02, 2011, 02:32 am
Quote
I'm in Seattle.  I'll PM you my address if you want to send a couple.  Happy to try them out.  I've been meaning to do some range tests.  It's next on my list after testing Gerg's changes more thoroughly and merging them into the mainline. 


Please do or send to my open email..  Would be good if you and gerg had the same hardware (and Me!)

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Aug 02, 2011, 03:57 am
Hi Everyone,

OK, I'm OnTheAir  (As the light-up signs used to say)...  I'm running gerg's latest library and after realizing he's running serial@9600, I have data going both ways with PingPair. Yahoo!  Running one UNO and one Seeeduino and plain nRF24L01 boards with built-in PCB antenna...

I get about one timeout in 10 transmissions... No difference between distances of 2cm and 3M  .  These are the smallest radios I've ever used.. In contrast I just unpacked a 204A from my Dad, which is an 18" high vacuum tube that was a display antique when I first saw it in 1950.  Sorry, but I love these contrasts  ( :smiley-roll: for old-guy stories)..

I'll do more tomorrow and fire up the boards with power amp and LNA and antennas that LOOK like antennas. 

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Aug 02, 2011, 03:22 pm

Hi Everyone,

OK, I'm OnTheAir  (As the light-up signs used to say)...  I'm running gerg's latest library and after realizing he's running serial@9600, I have data going both ways with PingPair. Yahoo!  Running one UNO and one Seeeduino and plain nRF24L01 boards with built-in PCB antenna...


Always exciting to see bits flying through the air.


I get about one timeout in 10 transmissions... No difference between distances of 2cm and 3M  .  These are the smallest radios I've ever used..


You're not alone in your awe. Its pretty awesome what they fit in that tiny little IC.

I'm assuming the error rate is actually a false positive. There have been a number of driver issues along these lines. I think Maniacbug even mentioned he recently fixed one. I'd have to look to see if that fix is part of the branch you're using.

I hope to play some more this week and see if I can nail down some of the potential issues I've identified.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Aug 02, 2011, 07:58 pm
Hi,
Quote
I'm assuming the error rate is actually a false positive. There have been a number of driver issues along these lines. I think Maniacbug even mentioned he recently fixed one. I'd have to look to see if that fix is part of the branch you're using.


Looking at the two Serial outputs, a missed transmission seems to always have the PONG not sending a response (Maybe not getting a message).. Seems like any time PONG sends a response, PING gets it..  

BTW it's SO nice to be able to run multiple copies of the IDE and Serial Monitor in the same desktop. Some other older IDE's could not do that and drove me crazy testing communications...

I need to sit down and read all this code!

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 03, 2011, 01:51 am

I'm assuming the error rate is actually a false positive. There have been a number of driver issues along these lines. I think Maniacbug even mentioned he recently fixed one. I'd have to look to see if that fix is part of the branch you're using.


Right.  You said you're running gerg's branch, which does not yet have the major fix that produced plenty false failures.

That said, failures are a fact of life.  This is documented by Nordic.  It's particularly acute at 8-bit CRC.  At 16-bit CRC, 1MBps data rate, channel 100, units 12 inches apart, I almost never get any failures.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Aug 03, 2011, 04:08 am

... You said you're running gerg's branch, which does not yet have the major fix that produced plenty false failures.

That said, failures are a fact of life.  This is documented by Nordic.  It's particularly acute at 8-bit CRC.  At 16-bit CRC, 1MBps data rate, channel 100, units 12 inches apart, I almost never get any failures.

Hey Maniac.. do you have a major 'Fix' that " produced plenty false failures."?  Sorry, a bit confused... Does your current release have the fix?

Yes, I understand there will be fails and hope that the automatic retries can be worked out. 

Maniac, send me a shipping address??

Regards, Terry King
...In The Woods In Vermont
terry@yourduino.com
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 03, 2011, 05:57 am
Ok, I could have worded that better.  I mean it doesn't have the FIX to a BUG which caused false failures.  Pull the latest from git@github.com:maniacbug/RF24.git (preferred) or download the latest from https://github.com/maniacbug/RF24/archives/master .  This branch has now 2 fixes to 2 bad bugs.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 04, 2011, 07:03 am
Did some controlled range tests tonight. Will post the detailed results this weekend.  Here's the highlights:

* Non-plus unit, 2MBps (worst case), 41+ ft line of sight indoors, immediate dropoff with any deviation from LOS.  (41 ft is as far as I can go in my house without turning a corner)
* Plus unit, 250kbps (best case), 46 ft around two corners indoors, 49 ft around one corner.  More importantly, at 250k, packet loss is almost negligible through almost all of that range.
* Both units at 1MBps, plus unit gets about 10% range improvement over non-plus in almost all situations.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: copet_pitik on Aug 04, 2011, 11:12 am
Hi All,
I am noob on this programming,
I wanna test my nRF24L01+ that I bought from sparkfun : here (http://www.sparkfun.com/products/691).
I use this tutorial : here (http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo), to connect the radio and arduino.
I use RF24's sketch example : pingpair_test.pde

Problem :
the sender unit output is "+OK FAIL" when I send "K" from serial monitor..what this is mean?
does the receiver unit is not working?or something I missed

this is the serial monitor details:
(http://i53.tinypic.com/35kqyj6.jpg)


Quote
Sorry for my english(http://www.indowebster.web.id/images/smilies/-um.gif)

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 04, 2011, 03:26 pm

I use RF24's sketch example : pingpair_test.pde


Don't use the sketches in the test directory.  Use the examples in 'examples'.  Start with examples/pingpair.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Aug 04, 2011, 03:47 pm

Did some controlled range tests tonight. Will post the detailed results this weekend.  Here's the highlights:

* Non-plus unit, 2MBps (worst case), 41+ ft line of sight indoors, immediate dropoff with any deviation from LOS.  (41 ft is as far as I can go in my house without turning a corner)
* Plus unit, 250kbps (best case), 46 ft around two corners indoors, 49 ft around one corner.  More importantly, at 250k, packet loss is almost negligible through almost all of that range.
* Both units at 1MBps, plus unit gets about 10% range improvement over non-plus in almost all situations.


Excellent. Thanks so much for sharing those results! I guess its safe to say 250Kbps data rate provides considerably improved range.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 04, 2011, 06:45 pm

Excellent. Thanks so much for sharing those results! I guess its safe to say 250Kbps data rate provides considerably improved range.


Absolutely.  46ft around two corners is impressive.  This covered the majority of possible position pairs in the upstairs of my house, though not all.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Aug 04, 2011, 06:57 pm


Excellent. Thanks so much for sharing those results! I guess its safe to say 250Kbps data rate provides considerably improved range.


Absolutely.  46ft around two corners is impressive.  This covered the majority of possible position pairs in the upstairs of my house, though not all.


As some are creating networks in their yard or outdoors, do you have any plans to test longer LOS ranges; such as outside?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 04, 2011, 08:11 pm

As some are creating networks in their yard or outdoors, do you have any plans to test longer LOS ranges; such as outside?


Wasn't planning to.  Range testing is very situation-dependant, so therefore best done by people who have actual scenarios they can test against.  That is, all my indoor tests were in situations where I'd really use it.  As I have no use for outside RF, I'd be the wrong person for that.  Anyone can do a range test, no special equipment is required.  I'll also include the sketch and methods used when I publish the details for the above tests.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Aug 04, 2011, 10:21 pm
All other things being equal doubling the data rate should drop the range to 70% since the receiver sees twice the noise power...  So 250k ought to give about 3 times the range of 2M (I think...)

I've used these NRF modules with a different microcontroller (Propeller) and they are pretty well-behaved - I've tried the one's with 20dBm PA on as well.  I can get 24bit mono audio at 48000 kSPS through them in 2M mode if packet ACKs are turned off BTW(!)

There are somewhat cheaper Chinese clones of the modules available on eBay - look for the Chinese markings near the PCB aerial.  Since they use the same actual chip and crystal and circuit they basically perform the same AFAICT.

There are also modules called RFM70 available (Hope RF I think), which are different silicon but the same interface.  However they are not exactly the same (no 250kHz mode, +5dBm output, couple of bugs), BUT most notably they have a second register bank that needs setting up in a particular way to get it to work at all (a configuration ROM implemented as RAM) - only needs setting at init time.

I wonder if there's interest in extending support to the RFM70? -  I'm tempted to play with this since I've got the hardware setup in front of me now!
http://www.hoperf.com/rf_fsk/24g/rfm70.htm (http://www.hoperf.com/rf_fsk/24g/rfm70.htm)

[ more background info follows ]

I found some discussion (with links to some details of the bugs) here: http://www.forbot.pl/forum/topics40/c-rfm70-24ghz-vt4261.htm (http://www.forbot.pl/forum/topics40/c-rfm70-24ghz-vt4261.htm) (yes its in Polish but look for the link near "some usefull info from application note")

RFM70 is even cheaper (£2.95 from Farnell here in UK, as opposed to about £6 for the NRF24L01+ or £4 for the NRF clones.)

RFM70 have very poor RF performance (the receive side is basically pants).  Very susceptible to overload and interference compared to NRF.  They do have a switchable LNA however. For low-bandwidth use this may not matter too much since the retransmission protocol can mask a multitude of ills - if you wanted to scatter loads of low-bandwidth cheap wireless nodes about the house, the cheapness would be an important factor.

RFM70 is only available with a 0.05 inch pin spacing note.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Aug 04, 2011, 10:30 pm
BTW I've just noticed the library allows channels less than 2 and above 80 to be specified - in other words to transmit outside the 2.4GHz band...
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 04, 2011, 10:46 pm
Cost is definitely important.  iTeadStudio sells nRF24L01+ modules for $4.  Hard to beat that!

The Hope RF units don't allow multiple transmissions at the same time, right?  And don't do ACK's or auto-retry's, right?  That's the original reason I went with these.  Less complicated link-layer protocols to write.

Anyway, regarding the 70% drop in range...  That's why it's important to measure :)  Otherwise it's all theory and speculation.

And yes, the library lets users set the channel to anything the chip allows.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Aug 04, 2011, 10:50 pm

BTW I've just noticed the library allows channels less than 2 and above 80 to be specified - in other words to transmit outside the 2.4GHz band...


There has been some discussion on things like channels and channel spacing enforcement within the driver. I personally would like to see a standardized number of channels* and channel spacing enforcement (basically channel abstraction) unless an option is given to disable. At this point I'm not sure it will be permitted in the defacto driver.

Also, my understanding is that some countries do allow use above channel 80 - but the US is not one of them. And thanks for the heads up on the lower end. I honestly never looked on the low end. I just assumed it started at the legal (US) limit. Good to know. Thanks.

* I saw this because you don't normally see WIFI APs deployed on channels 1, 2, 3, 4, 5, 6... Rather, you typically see channels 1, 6, 11 used because of their channel spacing.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Aug 04, 2011, 11:01 pm

Cost is definitely important.  iTeadStudio sells nRF24L01+ modules for $4.  Hard to beat that!

The Hope RF units don't allow multiple transmissions at the same time, right?  And don't do ACK's or auto-retry's, right?  That's the original reason I went with these.  Less complicated link-layer protocols to write.

No, its the same interface, same FIFOs, same registers, same 'shockburst' style retries, I've had it interworking with the NRF.

I don't think you mean 'multiple transmissions at the same time' do you ;)
Quote

Anyway, regarding the 70% drop in range...  That's why it's important to measure :)  Otherwise it's all theory and speculation.

And yes, the library lets users set the channel to anything the chip allows.

I don't think its a good idea to release a library that permits out-of-band transmission out of the box...  And defaulting to channel 1 is just wrong - that spills out of band.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Aug 04, 2011, 11:07 pm


BTW I've just noticed the library allows channels less than 2 and above 80 to be specified - in other words to transmit outside the 2.4GHz band...


There has been some discussion on things like channels and channel spacing enforcement within the driver. I personally would like to see a standardized number of channels* and channel spacing enforcement (basically channel abstraction) unless an option is given to disable. At this point I'm not sure it will be permitted in the defacto driver.

Also, my understanding is that some countries do allow use above channel 80 - but the US is not one of them. And thanks for the heads up on the lower end. I honestly never looked on the low end. I just assumed it started at the legal (US) limit. Good to know. Thanks.

The ISM band ends at 2.485.  _Spread-spectrum_ (such as WiFi) is allowed at low power in some parts of the US above 2.485 AFAICT but I don't believe from what I've found that licence-free GFSK is legal outside the ISM band.  Unless you have a more authoratative reference.
Quote


* I saw this because you don't normally see WIFI APs deployed on channels 1, 2, 3, 4, 5, 6... Rather, you typically see channels 1, 6, 11 used because of their channel spacing.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Aug 04, 2011, 11:51 pm
Ah, I've finally found something more authoratative (FCC online frequency table - which amusingly is a word document and not online in the sense I'd assume - it also lacks a TOC!).  US does allow ISM between 2.400 and 2.500 GHz.

Note that microwave ovens are centred at 2.5GHz so channels 80-98 are not necessarily a useful part of the band !!

Might be useful to have a setRegion() call to say what the current legal channels are (assuming they don't change very often!).
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 05, 2011, 12:27 am

Ah, I've finally found something more authoratative (FCC online frequency table - which amusingly is a word document and not online in the sense I'd assume - it also lacks a TOC!).  US does allow ISM between 2.400 and 2.500 GHz.


Fascinating.  Can you share the link?

Yeah, I was going to change the default channel anyway, up to 100 or higher, which always seems to be free from interference.  But gauging from your earlier comment, I'll guess you don't find that satisfactory :)

Quote

I don't think its a good idea to release a library that permits out-of-band transmission out of the box


My view here is that the lowest-level library exists to drive the hardware.  Whatever the hardware  allows, so too should the driver.  Regulatory issues belong up at a higher layer.  Having this available for users in the documentation would be super-useful, though.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Aug 05, 2011, 12:36 am

Ah, I've finally found something more authoratative (FCC online frequency table - which amusingly is a word document and not online in the sense I'd assume - it also lacks a TOC!).  US does allow ISM between 2.400 and 2.500 GHz.

Note that microwave ovens are centred at 2.5GHz so channels 80-98 are not necessarily a useful part of the band !!

Might be useful to have a setRegion() call to say what the current legal channels are (assuming they don't change very often!).



That's the general concept I desire. From what I can tell, a large portion of the world shares the US as a subset. So, based on your comment, 2-80 as basically a gimme. And unless additional spectrum is unlocked through such mechanisms, IMOHO, they should be excluded.

Quote
I don't think its a good idea to release a library that permits out-of-band transmission out of the box


I completely agree so long as "out of the box" means, by default. In my opinion, so long as the developer must explicitly take action to violate common limits, its good enough. Not to mention, it also ensures reasonable FCC liability protection for the driver developers.

Quote
Yeah, I was going to change the default channel anyway, up to 100 or higher, which always seems to be free from interference.  But gauging from your earlier comment, I'll guess you don't find that satisfactory


Ya,  that was on my list of things to discuss with you. In some variations of code I had the default channel set to 1. And that was based on assumptions of bleed so as to not interfere with devices below.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 05, 2011, 01:02 am

No, its the same interface, same FIFOs, same registers, same 'shockburst' style retries, I've had it interworking with the NRF.


Wow, indeed it is.  The datasheet is shockingly similiar to the nRF.  Any idea where to get them in the US?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Aug 05, 2011, 02:35 am
No I don't...


BTW I've tried using the library from Arduino now, found that it doesn't support setting address lengths - so I've hacked round that to allow it to talk to my test rig (3 byte addresses).  Something's still not quite right as the receive side is happy but the transmit side (Arduino) is getting max retries...

Suggest adding RF24::setAddressLengths() and changing the address types from uint64_t to byte*.

Are you planning to add proper asynchronous support?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 05, 2011, 05:38 am

Suggest adding RF24::setAddressLengths() and changing the address types from uint64_t to byte*.


Ah, yeah 3 byte address lengths is something that should be supported, that's true.  I quite like uint64_t's for simplicity.


Are you planning to add proper asynchronous support?


What is 'proper asynchronous support'?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: copet_pitik on Aug 05, 2011, 07:08 pm


I use RF24's sketch example : pingpair_test.pde


Don't use the sketches in the test directory.  Use the examples in 'examples'.  Start with examples/pingpair.


thanks a lot..the code works..
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Aug 07, 2011, 11:09 pm


Suggest adding RF24::setAddressLengths() and changing the address types from uint64_t to byte*.


Ah, yeah 3 byte address lengths is something that should be supported, that's true.  I quite like uint64_t's for simplicity.


Are you planning to add proper asynchronous support?


What is 'proper asynchronous support'?

The ability to run code while transmitting a packet or waiting/receiving a packet, with both interrupt and polling methods to re-synchronize.  For instance on a different microController I needed to transmit packets every 208us and the time it took to populate a packet buffer was about  100us.  The transmit time for 32byte packet at 2Mb is 152us, which done synchronously would only leave 208-152 = 56us to populate the fifo (faster than SPI could do it).

It was possible to do this without interrupts by filling the FIFO, waiting for previous TX to finish, then starting a new one asynchronously. The same considerations applied at the receive side.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Aug 08, 2011, 06:54 am

The ability to run code while transmitting a packet or waiting/receiving a packet, with both interrupt and polling methods to re-synchronize.  For instance on a different microController I needed to transmit packets every 208us and the time it took to populate a packet buffer was about  100us.  The transmit time for 32byte packet at 2Mb is 152us, which done synchronously would only leave 208-152 = 56us to populate the fifo (faster than SPI could do it).

It was possible to do this without interrupts by filling the FIFO, waiting for previous TX to finish, then starting a new one asynchronously. The same considerations applied at the receive side.


Interesting...  Wouldn't interrupts be the classic way to handle this problem?  But still, it makes sense how this could be useful.  To answer your question, though, I do not have plans myself to make such a change.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Aug 08, 2011, 03:17 pm
Interrupts might be, but not on the Propeller which was the uController I've been using for this.  The whole reason the chip has a FIFO on it is to allow pipelining the data transfer with transmit/receive for these high data rates (well high for SPI).   

And I'll admit the Arduino isn't really the host to take advantage of high sustained data rates ;)   (actually it would be an issue at lower on-air datarates as a packet at 250kbps takes 1.3ms to send (including TX power up) which is a long time...)

Further research has shown the the RFM70 doesn't interwork with the nRF24L01+ for auto-acknowledge - when a RFM70 sends to a nRF24L01+ the receiver sees a valid packet and is happy but the transmit keeps retrying until max retries is reached.  I suspect the time window for acknowledge packets is different (well at 2M at least).   Haven't tried the other direction yet.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: sbright33 on Oct 20, 2011, 03:00 pm
Is there a library I can use with RFM70?
Code?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ellen on Nov 11, 2011, 02:23 am
great work the library maniacbug  :P

ps. i am wondering what could be the reason why it takes 5 milliseconds to send 32 bytes (each packet) at 2mbps with your library  :smiley-eek:
(i did set radio.setRetries(0,0); else it was even more if the receiver is off or out of range, 45ms)

unsigned long time = millis();
radio.write(send_payload,32); //5 ms.
Serial.println(millis()-time,DEC);

while it takes 0-1ms with the mirf library

unsigned long time = millis();
Mirf.send((byte *)&time); //0ms.
Serial.println(millis()-time,DEC);

ps. is it also possible to read out the pipe address so that a reveiver can set up an receiving pipe with that address? (needed for unknown/unique adresses) just like how tcpip works for example
because now it seems i can only use upto 6 devices/addresses :~

and/or is it possible to send/read raw packets?
seems it can only receive when the (pipe)address is known, i try to disable shockburst but then i have no clue how to receive the data
there is no clear example in the nrf24l01+ product specification pdf.

hope someone can give me an answer, thanks!

Ellen.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Nov 12, 2011, 05:07 am

great work the library maniacbug  :P


Thanks!


ps. i am wondering what could be the reason why it takes 5 milliseconds to send 32 bytes (each packet) at 2mbps with your library  :smiley-eek:
(i did set radio.setRetries(0,0); else it was even more if the receiver is off or out of range, 45ms)

while it takes 0-1ms with the mirf library


No idea.  Worth running some tests to find out.


ps. is it also possible to read out the pipe address so that a reveiver can set up an receiving pipe with that address? (needed for unknown/unique adresses) just like how tcpip works for example


What you would want to do is disable Auto-Acknowledge (http://maniacbug.github.com/RF24/classRF24.html#aec71746d59da978bcbb975167886a2cc), and have all your transmitters use the same pipe.  Of course you'd have to implement a carrier-detect system where a transmitted made sure the line was clear before transmitting.  Like Ethernet does.


because now it seems i can only use upto 6 devices/addresses :~


Yup.  That's the simplest case.  It would be interesting to extend it for multiple units on the same pipe.  I just haven't needed that.  For multiple nodes, I use a multi-hop system, my RF24Network (http://maniacbug.github.com/RF24Network/) network layer.  In my use, rarely are >6 nodes within speaking distance from each other.


and/or is it possible to send/read raw packets?
seems it can only receive when the (pipe)address is known


No, I don't think the chip is  set up to do that.


, i try to disable shockburst but then i have no clue how to receive the data
there is no clear example in the nrf24l01+ product specification pdf.


You can turn off shockburst, and you'll still receive data.  You just won't get or send any ACK's.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ellen on Nov 17, 2011, 02:30 am
Thx! i had already set radio.setAutoAck(false) :)

also i found out what caused the delay in RF24.cpp

whatHappened(tx_ok,tx_fail,ack_payload_available); //causes 2ms delay in TX

write_register(CONFIG, ( read_register(CONFIG) | _BV(PWR_UP) ) & ~_BV(PRIM_RX) );
delay(2); //another 2ms delay in TX

ce(HIGH);
delayMicroseconds(15); //another 15us delay in TX
delay(2); //another 2ms delay in TX

for sending multiple packets with radio.write 5-6ms delay is way to much to get a decent speed
to send send data at full speed (250kbit/1mbit/2mbit) succesfully with only 0-1ms delay i had to change it into this:

Code: [Select]

void RF24::write( const void* buf, uint8_t len )
{
  //bool result = false; <-- excluded because i had to exclude whatHappened

  // Begin the write
  startWrite(buf,len);

  // ------------
  // At this point we could return from a non-blocking write, and then call
  // the rest after an interrupt

  // Instead, we are going to block here until we get TX_DS (transmission completed and ack'd)
  // or MAX_RT (maximum retries, transmission failed).  Also, we'll timeout in case the radio
  // is flaky and we get neither.

  // IN the end, the send should be blocking.  It comes back in 60ms worst case, or much faster
  // if I tighted up the retry logic.  (Default settings will be 1500us.
  // Monitor the send
  uint8_t observe_tx;
  uint8_t status;
  uint32_t sent_at = millis();
  const uint32_t timeout = 500; //ms to wait for timeout
  do
  {
    status = read_register(OBSERVE_TX,&observe_tx,1);
    IF_SERIAL_DEBUG(Serial.print(observe_tx,HEX));
  }
  while( ! ( status & ( _BV(TX_DS) | _BV(MAX_RT) ) ) && ( millis() - sent_at < timeout ) );

  // The part above is what you could recreate with your own interrupt handler,
  // and then call this when you got an interrupt
  // ------------

  // Call this when you get an interrupt
  // The status tells us three things
  // * The send was successful (TX_DS)
  // * The send failed, too many retries (MAX_RT)
  // * There is an ack packet waiting (RX_DR)
  //bool tx_ok, tx_fail; <-- excluded because i had to exclude whatHappened
  //whatHappened(tx_ok,tx_fail,ack_payload_available); //causes 2ms delay in TX :(
 
  //printf("%u%u%u\n\r",tx_ok,tx_fail,ack_payload_available);

  //result = tx_ok; <-- excluded because i had to exclude whatHappened
  IF_SERIAL_DEBUG(Serial.print(result?"...OK.":"...Failed"));

  // Handle the ack packet
  if ( ack_payload_available )
  {
    ack_payload_length = getDynamicPayloadSize();
    IF_SERIAL_DEBUG(Serial.print("[AckPacket]/"));
    IF_SERIAL_DEBUG(Serial.println(ack_payload_length,DEC));
  }

  // Yay, we are done.

  // Power down
  powerDown();

  // Flush buffers (Is this a relic of past experimentation, and not needed anymore??)
  //flush_tx(); <-- gave (timing?) problems sending packets

  //return result; <-- excluded because i had to exclude whatHappened
}


Code: [Select]

void RF24::startWrite( const void* buf, uint8_t len )
{
  ce(LOW); //<--added
 
  // Transmitter power-up
  write_register(CONFIG, ( read_register(CONFIG) | _BV(PWR_UP) ) & ~_BV(PRIM_RX) );
  //delay(2); <--excluded

  // Send the payload
  write_payload( buf, len );

  // Allons!
  ce(HIGH);
  //delayMicroseconds(15);  <--excluded
  //delay(2);  <--excluded
  //ce(LOW); <--excluded
}

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Nov 17, 2011, 09:59 pm
Ok, I see the overall problem.  This library is tuned to send packets occasionally with high reliability and low power consumption, not to send a non-stop stream of high-speed data.  Your modifications root out some of those optimizations, in favor of higher throughput.  

You also should skip the  power down/power up cycle.  Where you are just jamming data as fast as you can, you want the transmitter powered up the entire time.

The delay(2)'s are too high, although 280us delay is needed after power-up.  The CE(high)/15us delay/CE(low) is useful to conserve power in the case where transmissions are infrequent.  Obviously in your case, that's not needed because you're always jamming packets through.

Are you sure 'whatHappened' causes a 2ms delay?  Anyway if you don't call it, you won't know whether your packet went through.  Ah but then again, you don't care, because you have ACK's off.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ellen on Nov 18, 2011, 02:15 am
well i am realizing it is maybe better to write my own library since yours is optimized for sending/reading packets occasionally like you say, anyway your library is still very useful to me together with the product specification how to use the chip :) ;)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: fca on Nov 23, 2011, 11:49 am
Hi and thanks for this great library..
i'm starting a project  that wil be something like this http://arduino.cc/forum/index.php/topic,79855.0.html (http://arduino.cc/forum/index.php/topic,79855.0.html)
(http://fc.smugmug.com/Other/gs1/i-hZvWXdR/0/S/fcwirelesstemphummonitorv0011-S.jpg)

i will have a base station and 5 remote units...
maniacbug, can you help me out... (maybe some newbie questions)

do i need to go with the "complex"  mesh network or can i make it a simple client to base  from each remote sensor to the base...

if i understand correct the mesh network example if i setup all the sensors as "relays" i can increase the distance from the base to the last sensor because the packet is rerouted between each sensor i.e

if sensor5 is not in range with base but sensor5 is in range with sensor4 and sensor 4 with base the packet will go s5->s4->base , is this correct ?
(maybe one advantage in the mesh network)..

reading you mesh code example, i don't understand how to set the role, is the role hard encoded on the table

Quote
const node_info topology[] =
{
  { 0x0000000000LL, 0x0000000000LL,-1 }, // Base
  { 0xF0F0F0F0E1LL, 0x3A3A3A3AE1LL, 0 }, // Relay
  { 0xF0F0F0F0D2LL, 0x3A3A3A3AD2LL, 1 }, // Leaf
  { 0xF0F0F0F0C3LL, 0x3A3A3A3AC3LL, 1 }, // Leaf
  { 0xF0F0F0F0B4LL, 0x3A3A3A3AB4LL, 1 }, // Leaf
  { 0xF0F0F0F0A5LL, 0x3A3A3A3AA5LL, 0 }, // Leaf, direct to Base

and then the role will be defined  taking the the address i set  by serial console?
i mean if i choose address 0 then this will be the base if i choose address 3 will be leaf ?


I don't understand where on the payload is the data to send...



i just ordered nrf24l01 modules, can i do a mesh network (just for testing) with 2 ?

I will transmit few bytes every 5 minutes, if i reduce the speed to 1mbit will the range, increase ?

But i still waiting for the modules maybe later in real testing i will understand it better..

Regards and thanks for your great work...




Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Nov 23, 2011, 08:53 pm

Hi and thanks for this great library..


Hi.  Thanks for writing, and good luck with your project!

The first thing to understand is that RF24 is only a driver for the wireless module.  It does not include any networking of any sort.  It's just a way to send messages between radios.

In your case, you may not need anything fancy.  A radio using RF24 can communicate easily with 6 other radios as long as they are all in range of the base.  The starping (http://maniacbug.github.com/RF24/starping_8pde-example.html) is the example to try out in this case.

If you really want something a bit more complex, you can check out RF24Network (https://github.com/maniacbug/RF24Network).  This includes a minimal networking feature set to provide static addressing and routing across the network.  It doesn't implement a true 'mesh' topology, but rather a 'tree' topology.

Quote

if sensor5 is not in range with base but sensor5 is in range with sensor4 and sensor 4 with base the packet will go s5->s4->base , is this correct ?


If you use RF24Network, yes you can set the network up to do as you say, but it's all STATIC.  So you set up node 5 to ALWAYS transmit to node 4, and node 4 to always transmit to the base.  In this case, 5 is a leaf and so it can sleep, but 4 should stay awake to catch traffic from 5.

Quote

reading you mesh code example, i don't understand how to set the role, is the role hard encoded on the table

Code: [Select]

const node_info topology[] =
{
  { 0x0000000000LL, 0x0000000000LL,-1 }, // Base
...



What example are you looking at?  And do you have the current code base?

Quote

if i reduce the speed to 1mbit will the range, increase ?


Yes.  In fact, if you have nRF24L01+ units, you can reduce further to 250kbps which will extend it further still.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: fca on Nov 23, 2011, 10:16 pm
Hi the code is from the rf24network..
But I believe that i will have all the modules in range of the base.
So the the starexample is a good start..
I will remove the code from the pong on ping units and ping code from the pong...
Will these have issues with sensors sending at the same time ?
I would prefer to have the base pulling from the sensors but then I couldnt put the sensors sleeping...

Thanks
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Nov 23, 2011, 11:13 pm
Quote

I will remove the code from the pong on ping units and ping code from the pong...


That's fine.  I prefer them together because it makes it much easier to maintain a single sketch rather than 2 and have to keep track of which sketch is on which board.  Totally personal preference of course.

Quote

Will these have issues with sensors sending at the same time ?


Shouldn't have problems because the radios have built-in retries.  You can also crank up the retries to 15 retries, which should totally overcome any collisions.

Quote

I would prefer to have the base pulling from the sensors but then I couldnt put the sensors sleeping...


Right.  The usual design is to have the sensors send for this very reason.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: direk on Dec 03, 2011, 08:14 pm
Hi guys!

I have some problems with RF24... Cannot make it work in any way... I took pingpair example (the newest one), burned it on two differend devices and got results on rs232:

Quote

RF24/examples/pingpair/
ROLE: Pong back
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0d2 0xf0f0f0f0e1
RX_ADDR_P2-5     = 0x69 0x96 0xa5 0xc3
TX_ADDR          = 0xf0f0f0f0d2
RX_PW_P0-6       = 0x08 0x08 0x20 0x20 0x20 0x20
EN_AA            = 0x3f
EN_RXADDR        = 0x3f
RF_CH            = 0x4c
RF_SETUP         = 0x07
CONFIG           = 0x0f
DYNPD/FEATURE    = 0x00 0x06
Data Rate        = 1MBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_HIGH


And the second one:
Quote

RF24/examples/pingpair/
ROLE: Ping out
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5     = 0x00 0x00 0xd8 0x2f
TX_ADDR          = 0xf0f0f0f0e1
RX_PW_P0-6       = 0x08 0x08 0x2c 0x34 0x00 0x06
EN_AA            = 0x23
EN_RXADDR        = 0x12
RF_CH            = 0x4c
RF_SETUP         = 0x06
CONFIG           = 0x0f
DYNPD/FEATURE    = 0x00 0x05
Data Rate        = 1MBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_HIGH
Now sending 431...failed.
Failed, response timed out.
Now sending 2155...failed.
Failed, response timed out.
Now sending 3861...failed.
Failed, response timed out.
...


As you see the second one is sending, but the first one is not replying and I have no idea why. What kind of tests can I make to find issue?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 03, 2011, 09:31 pm
Can you try removing power from both units and then plug them back in.  Config=0f on both units doesn't seem right.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: luxeomni on Dec 04, 2011, 03:12 am
just a quick question from a project of mine point of view:
In theory could the r24network library could work with something like 0 to 99 nodes ? ( the nodes won't necessary send data at the same time) ?

And a little other question : do you know if someone came up with a pcb design as small as possible with mcu + nrf24l01+ integrated ?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 04, 2011, 08:06 am

just a quick question from a project of mine point of view:
In theory could the r24network library could work with something like 0 to 99 nodes ? ( the nodes won't necessary send data at the same time) ?


RF24Network is pretty specialized and bare-bones.  Any given node will only listen to 6 other nodes at once, taking advantage of the chip's built in pipes.  If you weren't worried about collisions, you could have many nodes with the same node address.  So the parent node would listen to all of those nodes thinking it was a single node.


And a little other question : do you know if someone came up with a pcb design as small as possible with mcu + nrf24l01+ integrated ?


You could take a look at my sensor node (http://maniacbug.wordpress.com/2011/10/19/sensor-node/).  This is the small PCB I use, although it's still through-hole so it could be even smaller with SMD parts. 
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: direk on Dec 04, 2011, 10:38 am
I was trying to upload other samples, restart whole devices or only nRF module, etc... without success... I have no idea what is going wrong, If it will be SPI problem I belive that other config values will be zeros or FF's...

PS.
  radio.powerDown();
  radio.printDetails();  -> gives me config 0x0d
  radio.powerUp();
  radio.printDetails();  -> gives me config 0x0f
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: luxeomni on Dec 04, 2011, 03:20 pm



RF24Network is pretty specialized and bare-bones.  Any given node will only listen to 6 other nodes at once, taking advantage of the chip's built in pipes.  If you weren't worried about collisions, you could have many nodes with the same node address.  So the parent node would listen to all of those nodes thinking it was a single node.

You could take a look at my sensor node (http://maniacbug.wordpress.com/2011/10/19/sensor-node/).  This is the small PCB I use, although it's still through-hole so it could be even smaller with SMD parts. 


So basically i could have multiple nodes with same adress, but with different IDs? ( not bothering with collisions ).
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 04, 2011, 06:30 pm

So basically i could have multiple nodes with same adress, but with different IDs? ( not bothering with collisions ).


What do you mean 'IDs'?  RF24Network knows only addresses.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: luxeomni on Dec 04, 2011, 11:06 pm
i mean lets say that the nrf24l01+ of sensor 1 and sensor 2 have the same adress, but the "sensors" are sending "i m sensor A" for a and "i m sensor B". so even with the same adress i can identify them from being the same.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 05, 2011, 03:23 am
I see, right, they would each have their own application-specific ID that the network layer knew nothing about.  You'd put that ID in the payload.  Yes, that should work just fine.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: graynomad on Dec 05, 2011, 03:38 am
That sounds like my RS485 network idea, the low level is just interested in broadcasting packets, if you want a higher level protocol you sit it on top of that. All addressing and end to end acknowledging etc is handled by a higher level.

______
Rob
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: luxeomni on Dec 05, 2011, 02:06 pm
Great, i ll look into it. The awesome stuff should be that i can write ID's from the receiver to the transmitters...i look into that too. If you have any infos on how i can achieve that i ll listen ;)

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: direk on Dec 05, 2011, 09:14 pm
Problem solved :-)

It looks like short range connection with max power is not good idea. With setting:
  radio.setPALevel(RF24_PA_LOW);
  radio.setDataRate(RF24_250KBPS);
i've got stable link :-)

PS.
maniacbug - this driver is really nice piece of code! I owe you a Beer [~]o (if you will visit Poland ;-)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: fca on Dec 09, 2011, 11:31 am
Hi here, once again (thanks maniacbug) great driver....
I have been testing the nrf24l01+ only with 2 units one in main arduino has receiver and the other on one of my sensor prototype with Arduino mini Pro.

Results so fare are good, i'm  working with a 250kbits mode transferring a struct of 14byte

Now 2 questions
1 its possible to have some kind of subnet i mean i want to use 5 sensors+ 1 receiver for temp/hum
and another 5+1 for motion detection in another environment.
I wan to avoid collisions and isolated both "networks"

I was thinking on changing the rf Chanel to try this kind " sub net" its this possible ?
like  temp/hum subnet rf channel 2476
      motion subnet rf channel 2400
Will this work ?

2ª Beside the reducing to 250KBS what other parameters could be optimized for increasing the range ?



This is my scanner result how can i  interpret this :
i can't see what would be the best channels to use ..



RF24/examples/scanner/

00000000000000001111111111111111222222222222222233333333333333334444444444444444555555555555555566666666666666667777777777777777

0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

00000000000000000000000000000000011121342100000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000113122331200000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000112042121000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000213364131300000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000222122010200000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000133132120200000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000123022220100000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000122122220200000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000233343121100000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000333251110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000222142121300000000000000000000000000000000000000000000000000000000000000000000000000000000000000



my settings

STATUS       = 0x0e
RX_DR=0
TX_DS=0
MAX_RT=0
RX_P_NO=7
TX_FULL=0
RX_ADDR_P0-1= 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5= 0xc3 0xc4 0xc5 0xc6
TX_ADDR    = 0xf0f0f0f0e1
RX_PW_P0-6 = 0x10 0x10 0x00 0x00 0x00 0x00
EN_AA= 0x00
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP= 0x27
CONFIG= 0x0f
DYNPD/FEATURE  = 0x00 0x00
Data Rate= 250KBPS
Model= nRF24L01+
CRC Length    = 16 bits
PA Power    = PA_HIGH


chanel 4c, means 2400+4c = 2476MHZ?


PS: where do i change the defaults of radio channel , power, speed so i don't need to always do it on the setup part...



Regards.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: direk on Dec 09, 2011, 01:42 pm
You can use public functions like that:
radio.setChannel(xx);
radio.setPALevel(xx);
radio.setDataRate(xx);
etc...

everything is in docs -> http://maniacbug.github.com/RF24/classRF24.html
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: fca on Dec 10, 2011, 02:19 am
direk, thanks but what i was looking was the defaults i found it  in rf24.cpp  function void RF24::begin(void), i already changed for my defaults but thanks.

Let's see if maniacbug can help on my other questions (tune for range) and different subnets of 6 radios each at different rf channels..

Now another question, i'm not getting the range i would expect , my sensors distance are vertical between floors so big concrete walls between floors i can only reach one floor, i.e

Floor 0->1 but not floor 0 ->>2 ...
i have to have the reception module in floor 0 (where my server is)

So i have 2 options use a network solution and have the floor 1 module as relay for receiving sensors from floor2.... (a lot learning curve to understand the rf24 network<--- once again great work maniacbug)
OR (question)
if i buy a more powerful base radio like the "2.4GHz Transceiver w/ Power Amp +PreAmp nRF24L01+"  keeping the small ones for the sensors would help on improve the range  ? or all the radios would have to be like these ?

Regards

(http://arduino-direct.com/sunshop/images/products/large_190_nRF24L01-LN-PA-1.jpg)
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=190


Regars
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: fca on Dec 15, 2011, 11:44 pm
hi maniacbug, are you there ?

other question is there way somehow to print the received signal strength ? so we can find where the range start to finish  and debug ?

regards..

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 16, 2011, 01:27 am

This is my scanner result how can i  interpret this :
i can't see what would be the best channels to use ..


It's hard to tell because it's posted on the forum in regular text--it would be easier to interpret if you posted it inside 'code' blocks.  Anyway, it looks to me like you have a little noise in the 0x20-0x29 channel range, so the scanner is telling you to avoid that range, but anything else should be fine.


Beside the reducing to 250KBS what other parameters could be optimized for increasing the range ?


Using 16-bit crc and mid-range payload sizes (~8 bytes) seems to help cut down on the failures.  Make sure you have the LNA/PA power settings to max power.  Also, if range is a concern, get units with a '+' on the end, not the earlier non-plus models.


I was thinking on changing the rf Chanel to try this kind " sub net" its this possible ?
like  temp/hum subnet rf channel 2476
      motion subnet rf channel 2400
Will this work ?


Yup, this is exactly what channels are for.  If you have two separate groups of traffic, but them on different channels.  That should avoid collisions.  I haven't tried it myself, but that's the theory anyway.  You could try it out yourself and let us know how it goes.


PS: where do i change the defaults of radio channel , power, speed so i don't need to always do it on the setup part...


Just change it in the setup() of your sketch.  That will make it most clear to readers of the code what is happening.


chanel 4c, means 2400+4c = 2476MHZ?


Check the data sheet for an explanation of how the channels map to actual MHz frequencies.

Quote

i'm not getting the range i would expect , my sensors distance are vertical between floors so big concrete walls between floors i can only reach one floor, i.e

Floor 0->1 but not floor 0 ->>2 ...
i have to have the reception module in floor 0 (where my server is)


What range are you expecting?!  Through two floors of concrete??  No, I wouldn't expect that.  The way to set this up is to use all cheap units for the leaf nodes, and then have a relay node on each floor using the high-powered more expensive modules with PA.  And have a base unit with LNA.  The relays listen to the leaves, and relay the messages back to the base on a higher-powered link.

Quote

is there way somehow to print the received signal strength ? so we can find where the range start to finish  and debug ?


I don't believe so.  All of my sensor nodes have a range-finder software built in.  So you can put the unit into 'range test' mode, in which it constantly sends a test packet back to its parent.  If the send goes through, it turns on the green light, if not it turns on the red light.  I can then just walk around and explore the extents of the range.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: PaulS on Dec 16, 2011, 01:27 am
Quote
other question is there way somehow to print the received signal strength ?

For what purpose? Surely you don't expect to correlate signal strength to distance...
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: fca on Dec 20, 2011, 10:40 pm
Hi there, yes  the purpose was to do that, signal vs distance...
i have ordered 2 of that units with pa...
Meanwhile i did some tests and even on the same floor i was getting some "dark" spots.... some time ago i dismantled a wifi antenna and it was a bare cable with some spiral...
Today nothing to loose i did a spiral cable like the one one in my wifi antena , drilled a hole in the rf24l01 antena and solder that in ...
Guess what i get full range in the same floor and from all floor 2 to all floor 1....

This is not very scientific just  a test... one thing that i noticed is that i had better results with " my antena" in horizontal than in the vertical position...
Any clue why ?

Tomorrow i will solder on the hole a real wifi antenna and lets see... if it get better...

Here a photo prototype of my sensor with the "antena"...

(http://www.smugmug.com/photos/i-q9Qwd2P/0/L/i-q9Qwd2P-L.jpg)

Regards


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Dec 20, 2011, 10:57 pm
You don't want to solder an antenna to the end of an existing antenna, antennas are tuned to the wavelength of interest and will perform very differently when altered this way.  The standard 1/4 wave antenna for 2.4GHz is 3.1cm long.  That helical antenna is probably a loaded 3/4 wavelength design.

Basically an antenna works best at resonance as the voltages and currents are at a maximum allowing more power to radiate away.

The orientation of an antenna is crucial as the em waves have a direction or polarization - align the antenna with the electric field axis of the radiation and you get maximum result - however indoors there is so much distortion and reflection of the radio waves its not really predictable.

http://en.wikipedia.org/wiki/Antenna_%28radio%29 (http://en.wikipedia.org/wiki/Antenna_%28radio%29)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: kodde on Dec 20, 2011, 11:57 pm
First off. Thanks for this great library and all the good info in this thread.

Secondly. In the bundled examples with the library many of the comments state that you should use pin 8 & 9 on your arduino for radio communication, while the code directly beneath the comment declares pin 9 & 10 instead. Caused some headache for me and a buddy of mine who tried out the nRF24L01 modules today for the first time. We finally figured it out though :)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 21, 2011, 12:46 am

First off. Thanks for this great library and all the good info in this thread.


Thanks!

Quote

Secondly. In the bundled examples with the library many of the comments state that you should use pin 8 & 9 on your arduino for radio communication, while the code directly beneath the comment declares pin 9 & 10 instead. Caused some headache for me and a buddy of mine who tried out the nRF24L01 modules today for the first time. We finally figured it out though :)


Doh!  Thanks for pointing that out, I will fix the comments.  I recently moved to 9/10 to align with the Getting Started (http://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/) tutorial.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: fca on Dec 21, 2011, 01:32 am
i switched to pin 6 &7 because the Ethernet shield use pin 10, so pay attention if you plan to use Ethernet shield...


Maniacbug: why the  radio.printDetails()  won't work in the rf24nework examples ?

like this
Code: [Select]
SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
    radio.printDetails();    // Dump the configuration of the rf unit for debugging



Regards-

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 21, 2011, 04:36 am
radio.printDetails() uses printf.  Do you have printf setup?  Requires a call to fdevopen.  All the RF24 examples and many of the RF24Network examples do this.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: mirage00 on Dec 24, 2011, 06:00 am
Maniac... What a great job you have done with this library!!!  Donation will be coming your way.  I have a question.  I am working on a project that will require 100's of nodes with different ID's.  Whenever they are within 1 foot of eachother they need to start exchanging information.  How would you handle this since the roles are not defined.  They will need to figure that out at time of contact with each other.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 24, 2011, 07:05 am

Maniac... What a great job you have done with this library!!! 


Thanks!


I have a question.  I am working on a project that will require 100's of nodes with different ID's.  Whenever they are within 1 foot of each other they need to start exchanging information.  How would  you handle this since the roles are not defined.  They will need to figure that out at time of contact with each other.


Right...  This is not something explicitly covered by any of my code.  You are going to have to dig more into networking protocols.  You can start with CSMA/CD (http://en.wikipedia.org/wiki/Carrier_sense_multiple_access_with_collision_detection).  The "medium" in this case would be one shared pipe address that all nodes would use for node discovery.  Nodes could periodically send out an announcement frame, "I am node X", and always be listening for other such frames.  From this, they know who is around.  They could then initiate a private conversation on another pipe dedicated for that node when they wanted to talk to it.

You could also use some ideas from Zeroconf (http://en.wikipedia.org/wiki/Zeroconf).

RF24 is designed purely to interface with the radio.  It really just controls the physical layer, or perhaps you could think of it as a very rudimentary MAC layer.  Anything more complicated is up to the app.  Separately, there is also the RF24Network which implements a very simple network layer that takes some significant shortcuts by assuming a static network structure.  Your network doesn't have such a simple structure, so that library is out.  RF24 will still gladly handle the radio interface, but your app has a bunch of work to do from there.

As far as the "within 1 foot", I don't know if that can be done with these radios.  But why do you need to?  If they are 15 feet away, is that a problem to exchange data?  If so, maybe you need some kind of NFC or RFID solution.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: jettie on Dec 24, 2011, 02:59 pm
Thanks maniacbug a lot for your library.
You made learning process less disappointing ) I've tried your examples and they worked great.
I am now trying to figure out one thing but I don't think I'll be able to soon enough without help of gurus. 
So I have this pair of radio triggers (those that trigger a photo flash remotely) which actually use nRF24L01. All I know about them is only channel frequencies.
So my question is is it even possible to configure a receiver so that it would be somehow compatible with those triggers?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: mirage00 on Dec 24, 2011, 03:26 pm

As far as the "within 1 foot", I don't know if that can be done with these radios.  But why do you need to?  If they are 15 feet away, is that a problem to exchange data?  If so, maybe you need some kind of NFC or RFID solution.


Thanks for the quick response..  It's actually closer than 1 foot.  To be exact, the two devices will need to touch for 2 seconds to begin the negotiation sequence with eachother.  I decided on the nRF24L01 because of its extremly low power requirements and cost. This project requires very low power consumption.  

Quote
As far as the "within 1 foot", I don't know if that can be done with these radios

Why?

I need to research NFC.  Do you have any other suggestions for this type of setup?  
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 24, 2011, 05:12 pm

So I have this pair of radio triggers (those that trigger a photo flash remotely) which actually use nRF24L01. All I know about them is only channel frequencies.
So my question is is it even possible to configure a receiver so that it would be somehow compatible with those triggers?


You'll need detailed specifications for the trigger, preferably a copy of the firmware that runs on the unit.  Dark wizards of wireless can reverse engineer the settings by sniffing, but for your purposes I'd go with the "get more information" route.


Quote
As far as the "within 1 foot", I don't know if that can be done with these radios

Why?
I need to research NFC.  Do you have any other suggestions for this type of setup? 


This radio has no way of knowing the exact physical distance.  It's designed to communicate at medium-short distances.  If you want a tap, NFC is definitely the way to go.

http://www.seeedstudio.com/depot/nfc-shield-p-916.html
http://www.adafruit.com/products/364
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: mirage00 on Dec 24, 2011, 07:59 pm
I can handle the tap through a reed switch or contact switch.  I love the power requirements of the NRF24L01 and its cost.  My challenge now is to have them communicate.  What I have working is code that alternates the role of each device until it finds one another and exchanges payload and ack info.  It seems to work but, I sometimes have one unit power down without the other unit finding it.  Here is my code.  It's quick and dirty, so feel free to comment or improve!


Code: [Select]
void setup()
{
  //
  // Create role randomly every time
  //
  Serial.begin(57600);
  //randomSeed(analogRead(0));
  randomSeed(128937827);
  int num_random = int(random(1000));
  if (num_random % 2 == 0)
    role = role_sender;
  else
    role = role_receiver;

  //
  // Print preamble
  //
  printf_begin();
  printf("ROLE: %s\n\r",role_friendly_name[role]);
  printf("RANDOM NUMBER %d\n\r",num_random);

  //
  // Setup and configure rf radio
  //
  radio.begin();
 
  // Set levels for power
  radio.setPALevel(RF24_PA_MIN);
  radio.setDataRate(RF24_2MBPS);

  // We will be using the Ack Payload feature, so please enable it
  radio.enableAckPayload();

  if ( role == role_sender )
  {
    radio.openWritingPipe(pipe);
  }
  else
  {
    radio.openReadingPipe(1,pipe);
    radio.startListening();
  }

  //
  // Dump the configuration of the rf unit for debugging
  //
  radio.printDetails();
 
  pinMode(4, OUTPUT);


};


void loop(void)
{
 
  if (OtherDeviceID==0)
    OtherDeviceID=GetOtherDeviceID();
  else
  {
      digitalWrite(4, HIGH);   // set the LED on
      delay(1000);              // wait for a second
      digitalWrite(4, LOW);    // set the LED off
      delay(1000);              // wait for a second
     
  }
}

// connect to available device
// when connected exchange enough information and then turn off
uint32_t GetOtherDeviceID()
{

  static uint32_t message_count= 0; // use message count for now/ will change to unique ID
  static uint32_t tmpOtherDeviceID= 0;
 
  while (! foundAnother)
  {
    //
    // Sender role.  Repeatedly send the current time
    //
    if (role == role_sender && !foundAnother )
    {
   
      // Take the time, and send it.  This will block until complete
      unsigned long time = millis();
      printf("Sending this device ID: %lu\n\r",ThisDeviceID);
      radio.write( &ThisDeviceID, sizeof(ThisDeviceID) );
 
      if ( radio.isAckPayloadAvailable() )
      {
        radio.read(&tmpOtherDeviceID,sizeof(tmpOtherDeviceID));
        printf("Received other device ID: [%lu]\n\r",tmpOtherDeviceID);
        foundAnother=true;
      }
      //printf("OK\n\r");
     }
 
    //
    // Receiver role.  Receive each packet, dump it out, add ack payload for next time
    //
   
    if ( role == role_receiver  && ! foundAnother )
    {
      // if there is data ready
      if ( radio.available() )
      {
        // Dump the payloads until we've gotten everything
        bool done = false;
        while (!done)
        {
          // Fetch the payload, and see if this was the last one.
          done = radio.read( &tmpOtherDeviceID, sizeof(tmpOtherDeviceID) );
 
          // Spew it
          printf("Received other device ID: [%lu]\n\r",tmpOtherDeviceID);
         }
 
        // Add an ack packet for the next time around.  This is a simple
        // packet counter
        radio.writeAckPayload( 1, &ThisDeviceID, sizeof(ThisDeviceID) );
        ++message_count;
        foundAnother=true;
      }
    }
   
   
    if ( ! foundAnother)
    {
       if ( role == role_sender )
        {
          radio.openReadingPipe(1,pipe);
          radio.startListening();
          role=role_receiver;
        }
        else
        {
          radio.stopListening();
          radio.openWritingPipe(pipe);
          role=role_sender;
        }
       
        // randomly delay to give time for other device to connect
        randomSeed(millis());
        delay(int(random(1000,2000)));
        //printf("CHANGING ROLE TO: %s\n\r",role_friendly_name[role]);
    }
  }
 
  return tmpOtherDeviceID;
}
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: MarkT on Dec 25, 2011, 12:38 am
I note when you change from listening to sending mode you do a random(1000,2000) delay whilst not transmitting nor listening... The node is useless during this delay - if you always listen during delays to avoid missing a packet from the other end then you'll have a much better chance of success...
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: mirage00 on Dec 25, 2011, 07:43 pm
Thanks... I tried changing the code to remove the stop listening when i switch roles but it caused the devices to have a worse connection rate.  Right now, I can get the devices to exchange the information 8 out of 10 times.  When it doesnt connect, one device received the other devices ID but the other device just continues sending its ID without receiving a ACK confirmation.  It works well execpt for this issue.  I'm sure there is a more clever/graceful way of doing this but I havn't figured it out yet.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 25, 2011, 08:13 pm

What I have working is code that alternates the role of each device until it finds one another and exchanges payload and ack info.  It seems to work but, I sometimes have one unit power down without the other unit finding it.  Here is my code.  It's quick and dirty, so feel free to comment or improve!


Hey, for the sake of the forum readership it would be great if you could edit the post and surround the code there with a 'code' block.  Just select the text and press the '#' button on the web toolbar above the editing area.

Having some kind of delay is good, but implementing it as a 'delay' will get in the way.  Better to use a counter you compare against the current millis(), like the "BlinkWithoutDelay" sketch.    That said, the main thing here is to not delay while the radio not listening.  Only delay after a call to startListening().  That way anything which comes in while you're delaying will get received.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: kodde on Dec 26, 2011, 10:54 pm
I was doing some test with two nRF24L01+ and when using my Arduino Uno as transmitter I would get substantially better connection (less failed attempts) when powering the Arduino with the USB cable than when using a 12V barrel power connection.

How is this? Is this normal?

I'm planning on installing a nRF24L01+ through an Arduino Mini Pro 3.3V in my motorcycle. Would altering my input power source to a certain voltage have anything to do with the transmission success rate?

Thanks.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Grag38 on Dec 29, 2011, 07:00 pm
Hello everybody,

I'm posting on this thread because it seems more active comparing on the one I posted few days ago (http://arduino.cc/forum/index.php/topic,84526.0.html)

I've got one question. Can we use RF24 to broadcast datas...

I mean, 1 RF24 act as master and send datas through a pipe. I would like to know if I use several RF24 as slave, can they listen to these datas, without asking to get it.

So from, each RF24 slave module listen to the pipe, and if there is data, EVERY one can read it.

Will things can works like that or must I have to proceed in other way ?

Thanks for your lights.

Grag38
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: maniacbug on Dec 30, 2011, 04:12 am

I've got one question. Can we use RF24 to broadcast datas...

I mean, 1 RF24 act as master and send datas through a pipe. I would like to know if I use several RF24 as slave, can they listen to these datas, without asking to get it.

So from, each RF24 slave module listen to the pipe, and if there is data, EVERY one can read it.


Hi, so first a quick word on terminology.  nRF24L01(+) is the name of the radio, and RF24 is the library you can used to drive those radios.

You absolutely can, in theory, drive the radios with this driver to 'broadcast' a packet to multiple units who are all listening on the same pipe.  The key is to disable the AutoAck (see RF24::enableAutoAck()), so they don't all try to send an ack back, and so the sender doesn't expect one.  I say 'in theory' because I've not actually heard reports of anyone doing this.  But from the documentation, it would seem to be possible.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Grag38 on Dec 30, 2011, 11:06 am
Thanks a lot ManiacBug.

I use RF24 to talk about the hardware and your nice library because the both are linked together ;O)

I'll try when I will receive my other RF24 hardware, I just own 2 for the moment, and it works very well.

And 'BRAVO' for this very usefull library you made, it's clear and easy to use. thanks.

Grag38
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: DeB86 on Sep 19, 2012, 03:47 pm
Hi guys,
thank you for the libraries they are great and I have done a broadcast configuration and it works really good.
Now I should get the board addresses that had received the broadcast packet, so I can list them on the serial interface and then collect them in a PC software.

Is that possible?

Thank you really much.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Rustie0125 on Sep 25, 2012, 08:10 pm
Hi Guys.

I have two problems/questions
I have been playing with the nRF24L01 units for awhile now , and I have most of the examples working but I get a compile error when trying to verify the code . the code im trying tomake work is the sensornet pde. but i keep getting eeprom_update_block not declared. I have redone the file paths and and redownloaded the code but i get the same error over and over, and all the other examples work so that would tel me that the file path is fine.

im using 2x UNOs and IDE1.0.1
any ideas to fix this would be great.

the other problem i have is more on of advice needed. i want to use these units as maniacbug did for the sensor net but i want to send GPS data ,voltage and tempreture and date. which example would be best to start with and what would you suggest to use to send this data ?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Rustie0125 on Sep 26, 2012, 07:21 pm
Anyone ?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: scargill on Oct 01, 2012, 01:19 pm
I wonder if anyone can help. I am using RF24 and RF24NETWORK. I'm putting together a home control setup which I'm quite happy to share - but I have hit a bottleneck.

My only change to RF24NETWORK is to set the speed to 256k as tests have shown this can up the range by 25% or thereabouts - I'm sending packages of no more than a few bytes so that's fine.

I have 3 devices sitting in the same room right now - 0, 02 and 022.  I've set up a master slave arrangement.... 02 is doing nothing but sitting in a loop calling network.update() - and because of that, devices 0 and 022 can talk to each other.

The problem is - understanding that only one device can talk at once etc... I've set up a master-slave arrangement.

I've been having timeouts occuring and so I've simplified the coding...

Unit 0 sends to unit 022.
Only when unit 022 gets a response does it immediately send back a response to zero.
As soon a unit 0 gets a response from 022 it sends another package to 022  - and so on ad-infinitum.

In 022 I've set a led to come on when something is available and go off after receiving - so I can see packages coming in.

As you'd expect there is a constant stream of data keeping the LED on more or less constantly--- except - it keeps stopping for a fraction of a second - or even for a second.  Worse if you do any other minor jobs in the loop it gets worse to the point where processing a few input and outputs, reading the real time clock etc makes for large gaps... none of these external processes takes any time and the code I've written, really should just work - as I'm waiting for a reply from one device before talking to another - given that the NRF24L01 devices have a tiny amount of buffering I'm at a complete loss where these timeouts (or that's how it seems) are coming from.

Anyone have any ideas?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: tack on Oct 06, 2012, 11:57 pm
Hi everyone. I'm trying to get to grips with the nRF24L01 and the RF24 & RF24Network libraries.

I have made my own breakout boards for my RF units, which are 10 pin configuration. Vcc and Gnd are doubled up on pins 1/2 and 9/10 respectively.

So, I've wired them, checked all my soldering and continuity between the wire ends, my board connections and through to the units when plugged into a 2x5 female header on my breakout. Everything checks out fine and, when plugged in and Arduino powere up, I see a nice 3v3 at across Vcc and Gnd.

I've then connected to each Arduino as:-

CE - D9
CSN - D10
MOSI - D11
MISO - D12
SCK - D13
IRQ - Not Connected at the moment (I believe it's redundant unless use required)

Then I have my two Arduinos (an SMD and DIP version), with each nRF connected, and running the GettingStarted sketch with no changes.

Code: [Select]
Arduino 1 (SMD)

RF24/examples/GettingStarted/

ROLE: Pong back

*** PRESS 'T' to begin transmitting to the other node

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xe7e7e7e77f 0xf0f0f0f0d2
RX_ADDR_P2-5 = 0xc3 0xc4 0x7f 0xff
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x00 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x3f
RF_CH = 0x4c
RF_SETUP = 0x57
CONFIG = 0x7f
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_HIGH


Code: [Select]
Arduino 2 (DIP)


RF24/examples/GettingStarted/

ROLE: Pong back

*** PRESS 'T' to begin transmitting to the other node

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xf0f0f0f0d2 0xf0f0f0f0d2
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xf0f0f0f0d2
RX_PW_P0-6 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0f
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power                = PA_HIGH


You can see that mine differ at the addresses to the example posted on the maniacbug blog

Code: [Select]

RF24/examples/GettingStarted/
ROLE: Pong back
STATUS                  = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1       = 0xf0f0f0f0d2 0xf0f0f0f0e1
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR                = 0xf0f0f0f0d2
RX_PW_P0-6 = 0x08 0x08 0x00 0x00 0x00 0x00
EN_AA                = 0x3f
EN_RXADDR = 0x03
RF_CH                = 0x4c
RF_SETUP = 0x07
CONFIG                 = 0x0f
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model                = nRF24L01
CRC Length = 16 bits
PA Power                = PA_HIGH


I appear to have different address results i the debug code, despite the sketch settin these to

Code: [Select]
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

I'd appreciate any help here as I've spent hours on this and it's driving me nuts just not being able to get the default example to work, before I start trying to use these to transmit some small packets of data back to a root node with Ethernet and on into web based system.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: tack on Oct 07, 2012, 01:24 am
Right, some kind of progress, but even more puzzles:-

Occaisonally when resetting, one of my units will show the addresses (pipe) as E2 & D2, whilst the other shows both as D2.

If I try transmitting from the E2/D2 then I get nothing. If I try transmitting from the D2/D2 then the E2/D2 responds as you expect and works ping/pomg. If I then change the D2/D2 to 'R' and the E2/D2 to 'T; then it works again! Strange, it will only work that way round AFTER I've had it working the opposite way.

I suspect that if both units show E2/D2 correctly then I could reliably transmit from either first and it will work.

Anyone have any idea as to what is going on here?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Grag38 on Oct 08, 2012, 03:03 am
Not shure it can help you, but...

RF24 system works with pipes, 1 for TX and 6 for RX with one module.

between 2 RF24 if you want them to communicate you must set these pipe according for TX/RX of each device.

Lets say :

RF24 #1  :

TX pipe = 0xF0F0F0F0E1
RX pipe = 0xF0F0F0F0D2

so from RF24 #2 must be as :

TX pipe = 0xF0F0F0F0D2
RX pipe = 0xF0F0F0F0E1

when RF24#1 is transmitting on E1, then RF24#2 will listen on E1. When RF24#2 wants to transmit datas to RF24#1 it sends on D2 and RF24#1 listen on D2.

With your code it seems there is a trouble because the DIP module use the D2 as TX and RX... so it will 'ear' only what it sends himself in my guess.

I used the maniacbug code : GettingStarted without modification and it works well !

And at last, one RF24 must be in role_ping_out and the other in role_pong_back, it seems not be the case of your print from your arduino (dip and smd show pong_back !!!)

Hope it can help you.

Also there are a lot of comment on maniacbug website, concerning the RF24 class.

we can read on it :

void RF24::openReadingPipe    (   uint8_t    number,
      uint64_t    address
   )      


Open a pipe for reading.

Up to 6 pipes can be open for reading at once. Open all the reading pipes, and then call startListening().
See also:
openWritingPipe
Warning:
Pipes 1-5 should share the first 32 bits. Only the least significant byte should be unique, e.g.
  openReadingPipe(1,0xF0F0F0F0AA);
  openReadingPipe(2,0xF0F0F0F066);
Pipe 0 is also used by the writing pipe. So if you open pipe 0 for reading, and then startListening(), it will overwrite the writing pipe. Ergo, do an openWritingPipe() again before write().
Todo:
Enforce the restriction that pipes 1-5 must share the top 32 bits
Parameters:number   Which pipe# to open, 0-5.
address   The 40-bit address of the pipe to open.

void RF24::openWritingPipe    (   uint64_t    address   )   


Open a pipe for writing.

Only one pipe can be open at once, but you can change the pipe you'll listen to. Do not call this while actively listening. Remember to stopListening() first.

Addresses are 40-bit hex values, e.g.:
  openWritingPipe(0xF0F0F0F0F0);
Parameters:address   The 40-bit address of the pipe to open. This can be any value whatsoever, as long as you are the only one writing to it and only one other radio is listening to it. Coordinate these pipe addresses amongst nodes on the network.

Hope it can help you.

Best regards
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: danoduino on Oct 29, 2012, 08:09 pm
First let me say thanks to maniacbug for the GREAT library!

I've playing around with these modules for a few weeks and decided to base my sensor xmitters on the pingpair_sleepy example.  I wanted to reduce power consumption as much as possible.

I came across a problem in the pingpair_sleepy example provided with RF24.  The ping out would only work once.

    // Power down the radio.  Note that the radio will get powered back up
    // on the next write() call.
    radio.powerDown();

When the radio was powered down, it would never come back.  Commenting out radio.powerDown(); OR adding radio.powerUp() before the radio.write call in the example works.

Maybe there's a bug that assumes a write will always powerup first.

I hope this helps someone!

My sensor works well now and draws ~20ma idle (4secs) and ~35ma (1sec) when sending data.

Thanks.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ominously on Oct 31, 2012, 02:41 pm
Hey everyone!

I am having a bit of trouble running two of these little adapters with an Arduino Mega and a Arduino Nano... it seems to me that the Mega is having trouble reading anything, as I can't get any kind of reply, only a "Failed, response timed out"... However, the Nano receives the packet and sends the ACK. When I reverse the roles, absolutely nothing happens. It does not see any kind of traffic. Packets can go out and never be received. I've attached a screen shot showing what goes on... I'll attach more screen shots later when I get them.

Oh, I'm using the pingpair sketch... also, the GettingStarted sketch does the same thing. One way it works, the other way it doesn't.

Thanks!

This is on the Nano, btw.
(http://i46.tinypic.com/2s0ep1i.jpg)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ominously on Oct 31, 2012, 06:44 pm
This is the results from the pingpair_test.pde sketch...

This is using the Mega to transmit:
(http://i.imgur.com/JDrOT.jpg)

and this is the Nano as a receiver:
(http://i.imgur.com/JprcG.jpg)

I noticed that both images do not reflect the same "test", but the results are the same no matter what configuration I use..

It receives it, but the mega doesn't receive the ACK... I'm kind of thinking the Mega is faulty. I know the voltage regulator is bad, for sure. I can't even use the barrel plug to power it.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Grag38 on Nov 01, 2012, 12:40 am
the nano receive the packet transmited by the mega because adress TX from mega is RC adress of nano.

But the TX adress from nano is not the RX adress of mega. So from ACK isn't received for the mega.

Considering the pingpair code, you've got :

Code: [Select]

if ( role == role_ping_out )
  {
    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
  }
  else
  {
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe(1,pipes[0]);
  }


It shows that there is 2 pipes that allow 2 RF24 to communicate together. Each pipe works in ONE way. That's means that 1 pipe is sending datas in one way, and the other is doing the same in opposite way.

We could show it like considering this code :

The ping out RF24 writes datas on pipe1 and reads data on pipe0

The other RF24 writes on pipe0 and reads datas on pipe1 !!!

We could also show it in another way :

RF24#1 -----pipe0-----> RF24#2
RF24#1 <----pipe1------ RF24#2


In your sketch RX_ADDR_P0-1 are not 'crossed' between the two RF24.

Do you understand what I mean ?

Best regards.



Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ominously on Nov 01, 2012, 02:28 am

----


Thanks for the reply, and I totally understand what you mean... I am truly sorry that I may have confused you with different screen shots. I've re-assembled everything and repeated what I did, and got the same exact result, and created two more images.

(http://i.imgur.com/5f9o5.jpg)
(http://i.imgur.com/Oi3Zt.jpg)

I must add that I connected the Nano exactly as maniacbug shows on his blog... As for the Mega, I'm using pins 9/10 for CE/CSN, and then pins 50, 51, 52 for MOSI MISO and SCK. Power is coming from the 3.3v from the Mega, however, I may try to use an external regulator when I get home.

Still majorly confused, and thanks for any help, if any.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Grag38 on Nov 01, 2012, 10:52 am
May be there is an error on wiring mega.

As I read specs of SPI of nano and mega we can discover that :

MEGA :
SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.

NANO:

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.

So, use the PIN 53 instead of PIN10 with the Mega board.

May be it will works as SS means ship select !

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ominously on Nov 03, 2012, 08:06 am
Thanks for the input, Grag... I emailed the guy with the bajdi website, since I seen a thread posted by him somewhere in the forum from google results, and he said that his problem was resolved by adding a 22uF or higher capacitor across the Mega's 3.3v and ground. The problem instantly went away!

I'll post pics later :)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: mcnobby on Nov 15, 2012, 04:44 pm
Hello guys,

I have a very similar problem yesterday when using a NANO and a vero/UNO board (with seperate ucb/serial)
I seemed to have All the symptoms above, I nearly threw the whole lot in the bin...

In the end, I made a second vero/UNO board

My assumption was that 'maybe' the USBinterface on the NANO board was in someway conflicting with timings of the RF board when viewing serial data

All I want is a high speed on way data transfer with no acks, and I got it...
Perhaps I still have some tweaking to go but it seems to work for me :@)

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: domingosl on Nov 24, 2012, 11:32 am
Big thanks for this amazing libary, at the momment I already tried all the examples included, and even made some modifications.

I want to go further but there are some basic concepts I miss, tried on google, in the main site, taking closer look to the examples, but nothing, I just dont understand some things. I really want to go deeper but I feel a good tutorial is missing. Here are some of the things I dont get.

Whats a pipe? How it changes if I want 2 or 6 nodes to speak.

const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
What the numbers mean?

Maybe after the explanation, I will figure how to solve the next issue, but just in case; How do I need to set the pipes if my network is static 6 nodes, one base. The nodes some times send data to the base and then the base answers with some other data back to the emiting node…

Thanks for any help!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: finnduino on Dec 27, 2012, 08:46 pm
I wonder this, if I do this in code:

radio.begin();
radio.setRetries(15,15);
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS);
radio.setPayloadSize(10);
radio.setChannel(10);
radio.setAutoAck(true);
radio.printDetails();

It's still showing this when I look status of module:
Data Rate        = 1MBPS
Model            = nRF24L01
CRC Length       = 16 bits
PA Power         = PA_HIGH

Should radio.setDataRate(RF24_250KBPS); affect immediately?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: PaulS on Dec 27, 2012, 08:49 pm
Quote
Should radio.setDataRate(RF24_250KBPS); affect immediately?

I don't know, but I'd try moving the call to begin() to the end.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: pico on Dec 28, 2012, 02:43 am

It's still showing this when I look status of module:
Data Rate        = 1MBPS
Model            = nRF24L01
CRC Length       = 16 bits
PA Power         = PA_HIGH

Should radio.setDataRate(RF24_250KBPS); affect immediately?


This will never work, because the 250KBPS speed is only available on the newer nRF24L01+ chip, not the older nRF24L01. Get the data sheets from Nordic and read up on the chip differences.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: finnduino on Jan 04, 2013, 10:18 pm
Thanks much this thread, PaulS and Pico, I got this working at least some way. Now I've Mega which has W5100 ethernet to connect Cosm, and with 433Mhzh transmitter to control Nexa by using it's webserver, and now also nRF24L01+ to read temperatures from Nano with nRF24L01+ ds18b20. This works ok but code looks bad, I think I need to use interrupts, more studying  :smiley-roll:


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Jan 19, 2013, 06:17 pm
Hi Finnduino,

Can you please tell us more details of how you have the  nRF24L01 and Ethernet interfaces wired? What did you need to do to get them both working together?

Thanks!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Jan 25, 2013, 07:04 pm
I've tried several libraries and found this library the best and have the best range... thank you to maniacbug for such a wonderful libraries..

I'm using a compatible wireless module from inhaos.com ? http://www.inhaos.com/product_info.php?products_id=35 ) for my testing...

I've a question to ask, can this library or future enhancements ack similar like serial TX/RX on both sides ?




Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: tres on Jan 29, 2013, 01:28 am

Thanks much this thread, PaulS and Pico, I got this working at least some way. Now I've Mega which has W5100 ethernet to connect Cosm, and with 433Mhzh transmitter to control Nexa by using it's webserver, and now also nRF24L01+ to read temperatures from Nano with nRF24L01+ ds18b20. This works ok but code looks bad, I think I need to use interrupts, more studying  :smiley-roll:


hey finnduino,

just like terryking228, i think it would be interesting to know how you managed to get an ethernet shield working together with a NRF24l01+ module at the same time ;)

cheers,
stefan
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: finnduino on Feb 01, 2013, 10:09 pm
Having following Arduino (clone) 1280 <--> NRF24L01, hopefully I checked these ok:
51: MOSI
GND: GND
52: SCK
50: MISO
48: CE
49: CSN
3V: VCC
GND: GND
Pin6 is connected to 433Mhz transmitter
Pin5 is connected to 433Mhz receiver (not used but just connected)
Pin22 has thermometers (2pcs)
w5100 network board is normally attached to default pins of 1280, not yet any other problems than this is slow...

Some parts of my currently ugly code:
#include <ERxPachube.h>
#include <SPI.h>
#include <Client.h>
#include <Ethernet.h>
#include <Server.h>
#include <Udp.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <NexaTransmitter.h>
#include <RF24Network.h>
#include <RF24.h>

--- clip -- ... and so on
byte mac[] = { 0xE8, 0xB3, 0x3A, 0x30, 0x41, 0x65};
IPAddress ip(192,168,1,13);
IPAddress device(192, 168, 1, 13); // Only if useDhcp is false
IPAddress gateway(192, 168, 1, 1); // Only if useDhcp is false
IPAddress subnet(255, 255, 1, 0); // Only if useDhcp is false
IPAddress dnsIP(192, 168, 1, 1); // Only if useDhcp is false
int ONE_WIRE_BUS = 22 ;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress thermometer;

//radio:
RF24 radio(48,49);
RF24Network network(radio);
const uint16_t this_node = 0;
const uint16_t other_node = 1;

struct payload_t
{
 unsigned long ms;
 unsigned long counter;
};

void setup(){
     
Ethernet.begin(mac, ip,dnsIP,gateway,subnet);
 pinMode(ledPin, OUTPUT);  
   dataout.addData(0);
   dataout.addData(1);
   dataout.addData(2);
pinMode(txPin, OUTPUT);
// clip enabling Nexa 433Mhz  ---
NexaTransmitter remote(6,  12345678); // Create the nexa remote on pin6 with remote id
// radio up:
 SPI.begin();
 radio.begin();
 network.begin(/*channel*/ 90, /*node address*/ this_node);
// end setup
//After that there is void loop(), having things like:
 network.update();
 while ( network.available() )
 {
   // If so, grab it and print it out
   RF24NetworkHeader header;
   payload_t payload;
   network.read(header,&payload,sizeof(payload));
   Serial.print("Received packet #");
   Serial.print(payload.counter);
//and so on
}

Here screenshot how test version is currently working, I go to web page, then it at least somehow shows current temperature 25,12'C from sensor connected directy to Mega1280 but also 22'C received from 2.4Ghz sensor. It's sending those values to Cosm and 433Mhz switches are controlled by http GET commands

(http://img542.imageshack.us/img542/6091/screenshotwh.jpg)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Feb 19, 2013, 06:31 pm
Thanks to maniac bug libraries, I managed to get both Arduino UNO & Raspberry Pi connected using the nRF24L01+

http://arduino-for-beginners.blogspot.com/2013/02/setup-nordic-nrf24l01-rf-modules-to.html

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Nick_Pyner on Feb 20, 2013, 02:54 am
Hi Stanley

I see in your link the nrf24 lashup on a breadboard. Do you have any trouble with the power supply there. This is in light of discussion at.

http://arduino.cc/forum/index.php/topic,149551.0.html

I see a couple of electrolytics on the breadboard but they don't seem to be related to the nrf24.

I am expecting some nrf24s soon and am currently planning a new proto shield.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Feb 21, 2013, 05:13 am
Quote

I see in your link the nrf24 lashup on a breadboard. Do you have any trouble with the power supply there. This is in light of discussion at.


No issues at all for all Inhaos modules, the regular nRF24L01+ modules or even the ones with PA+LNA and Ext 2dBi antenna...

Are you expecting issues or facing such power issues ??
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Nick_Pyner on Feb 21, 2013, 08:03 am

Are you expecting issues or facing such power issues ??


In the light of your comment, no.  I believe these things should be addressed by the board manufacturer in accordance with the recommendations of the chip manufacturer and should not be something for the end user to get too paranoid about. 

However there have been some issues and bypass caps have been seen as solution. See the abovementioned link. As to it being the routine solution, who would know?

For all that, I have reserved space on my proto for a tantalum right next to the power pins, so I have no qualms about installing it. I have not yet received my transceivers and I'm just trying to have all the ducks lined up as I have to have everything up and running by the end of May.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: egghead on Feb 24, 2013, 11:08 pm
Maniacbug, great job on the library, really looks complete, only im having problems getting it to work with a pair of nrf24l01+ modules. I am pretty sure they are wired correctly. Can't seem to get any of the rf24 examples to work. Here is the radio.printDetails from both modules with the getting started code in it.

*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK
ROLE: Ping out
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0xf0f0f0f0e1
RX_PW_P0-6       = 0x08 0x08 0x00 0x00 0x00 0x00
EN_AA            = 0x3f
EN_RXADDR        = 0x03
RF_CH            = 0x4c
RF_SETUP         = 0x27
CONFIG           = 0x0f
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 250KBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_HIGH


*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK
ROLE: Pong back
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0d2 0xf0f0f0f0e1
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0xf0f0f0f0d2
RX_PW_P0-6       = 0x08 0x08 0x00 0x00 0x00 0x00
EN_AA            = 0x3f
EN_RXADDR        = 0x03
RF_CH            = 0x4c
RF_SETUP         = 0x27
CONFIG           = 0x0f
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 250KBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_HIGH

on the ping out module is get:
Now sending 26533...failed.
Failed, response timed out.

in the serial terminal, and nothing in the pong back. I am using the Leonardo arduino modules and Arduino ver 1.52 software. All the signals look ok on a scope. the only signal that looks a bit strange is the 3.3vdc, which has a .2vpp ripple on it, really don't think this is the problem though. any feedback is greatly appreciated.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ematson5897 on Feb 25, 2013, 02:22 am
I would add a large capacitor across 3.3v and gnd. I have had issues with the power supplies on arduinos (chinese clones :p), and that solved it every time. And I am going to attempt to make a wireless DMX transmitter with these transceivers, which will require sending a 512 byte packet at least every 50 ms. Any suggestions on optimizing settings and code to be able to pass data at this speed? I read earlier in this thread about removing the delays in the write function, should I do that?

Any help would be great,
ematson5897
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: egghead on Feb 25, 2013, 04:30 am
ematson5897, much thanks that did it.

wow i really cant believe it, the 24l01 pulls next to no current too!  wow cheap Chinese crap!!!! they probably dont even test to see if the power supply can handle any they of load!  added two 100uF caps one one each module. I wonder if reducing the ripple even more will help in reception, ie increase the range, hmmmmm

again thanks :)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ematson5897 on Feb 25, 2013, 04:44 am
No problem! And yes it should receive less noise, so you might be able to get away with longer distances
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Nick_Pyner on Feb 25, 2013, 07:01 am
I was thinking of 10 mike tantalums I have to hand
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ematson5897 on Feb 25, 2013, 11:44 pm
Also I found a documentation error. The code and documentation do not line up for the setPALevel command
Quote
void RF24::setPALevel   (   rf24_pa_dbm_e    level   )   
Set Power Amplifier (PA) level to one of four levels.

Relative mnemonics have been used to allow for future PA level changes. According to 6.5 of the nRF24L01+ specification sheet, they translate to: RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12dBm, RF24_PA_MED=-6dBM, and RF24_PA_HIGH=0dBm.

Parameters:
level   Desired PA level.


Code: [Select]
/**
* Power Amplifier level.
*
* For use with setPALevel()
*/
typedef enum { RF24_PA_MIN = 0,RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX, RF24_PA_ERROR } rf24_pa_dbm_e ;


You use min,low,high,and max in code but docs say otherwise


And for those interested,  I am porting this library to energia (arduino for ti launchpad)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: axel12p on Mar 12, 2013, 01:04 pm
Great library and great job from maniacbug!

I am using 2 Arduino UNOs with 2 nRF24L01+ on top, bought from iTeadStudio.

When using the RF24 library I am facing the exact same problem as egghead did. I am receiving STATUS at the beggining, but only "Failed, response timeout" when trying to transmit. I will try to connect a capacitor between 3.3V and GND pins to see if this can fix the problem.

On the other hand, when trying the RF24Network library, the network seems to operate fine, with only minor problem some dublicates showing up on the serial monitor (Received packet #544 at 109000, Received packet #544 at 1090000).

So I can not figure out if the RF24 library is suitable for the nRF24L01+ modules or the simple ones. Do I have to use only the nRF24Network library, to make my modules work?
 
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Mar 12, 2013, 06:39 pm

When using the RF24 library I am facing the exact same problem as egghead did. I am receiving STATUS at the beggining, but only "Failed, response timeout" when trying to transmit. I will try to connect a capacitor between 3.3V and GND pins to see if this can fix the problem.

On the other hand, when trying the RF24Network library, the network seems to operate fine, with only minor problem some dublicates showing up on the serial monitor (Received packet #544 at 109000, Received packet #544 at 1090000).

So I can not figure out if the RF24 library is suitable for the nRF24L01+ modules or the simple ones. Do I have to use only the nRF24Network library, to make my modules work?


Which example sketch are u using ??

Can you paste the output here in ...

RF24Network are using the RF24 libs.. so if RF24Network is working, then RF24 libs "should" be working...

For debugging, I suggest putting some Serial.println() statements at various checkpoint to "see" what is going on with the radio/libs.. was the timeout caused by other reasons...

I even use radio.available( &pipe_num) to loop thru the 6 pipes one by one to "see" what's going on...

For yr case, it should be just using pipe0 and pipe1 ...

http://maniacbug.github.com/RF24/classRF24.html#ace7dd139fabc16b77cb8325faa07620f

You should use the "latest" fork RF24 libs from others....
https://github.com/maniacbug/RF24/network

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Docedison on Mar 12, 2013, 07:12 pm
To fix my Mega issues I used a 47uF cap and a .1 uf cap right at the connector and 0805 parts solder nicely between .1"/2.54 cm pins.. , Just stack them like bricks.

Bob
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: axel12p on Mar 13, 2013, 01:04 am
Firstly I would like to thank you both for your help!

My hardware configuration is the same as this mentioned in maniacbug's blog (http://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/ (http://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/)). I have double checked the wiring and everything seems to be fine. I have also tried to connect the RF modules to Arduino boards through female to male wires but nothing changed. I have bought five RF modules and tried several combinations with no luck. My Arduinos are UNO R2 and R3, but I don't think that this matters.

The libraries I have installed were those from maniacbug's github (https://github.com/maniacbug (https://github.com/maniacbug)). I have downloaded the zip file and extracted it to my libraries folder.

As you can imagine, the first example that I have tried, was the "GettingStarted" example. The first Arduino is powered throught the USB cable and the other through a 5V wall adapter.
When I open the Serial Monitor I am getting the result shown below:

(http://i48.tinypic.com/16ks55j.gif)

If I interchange the position of the two Arduinos I am receiving this:
(http://i49.tinypic.com/opsux.gif)

As you can see the wiring seems OK (I don't receive any zeros), but there is also no communication between the two modules.

The strange thing is that when I' ve uploaded the helloworld_tx and helloworld_rx examples included in the RF24Network library, a connection has been established between the two modules (messages like: "Received packet #544 at 109000" showed up at the Serial Monitor of the receiver).

I didn't knew that newer libraries have been released, so I tried earlier the RF24 library from gnulnulf with the exactly same results :-(

I will try to put some Serial.println() statements to the code for debugging and also add a capacitor between 3.3V and GND pins (I also have some 0805 SMD capacitors) hoping that any of these solutions may help...
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Mar 13, 2013, 05:33 am

When I open the Serial Monitor I am getting the result shown below:



Yr TX_ADDR is wrong... pls re-check yr codes.. it should be 0xf0f0f0f0e1 for BOTH the units from the example...

Yours is f0f0f0f0d2 and e7e7e7e7e so they r NOT communicating with each other... RF24 will ignore packets with TX/RX address not matching the list on the RX pipes...

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Mersing on Mar 13, 2013, 06:03 pm
Hello,

This is what I'm also getting.

From the code :
// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

However, on a random basis, Serial Monitor is displaying :
RX_ADDR_P0-1     = 0xf0f0f0f0e1 0xf0f0f0f0d2
OR
RX_ADDR_P0-1     = 0xe7e7e7e7e  0xf0f0f0f0d2

Seems the address is not setup, therefore the default one is used (0xe7e7e7e7e).

I tried to reset many time / upload, and time to time ADDR is setup properly.

Any clue.

Regards.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Mar 13, 2013, 06:53 pm


However, on a random basis, Serial Monitor is displaying :
RX_ADDR_P0-1     = 0xf0f0f0f0e1 0xf0f0f0f0d2
OR
RX_ADDR_P0-1     = 0xe7e7e7e7e  0xf0f0f0f0d2

Seems the address is not setup, therefore the default one is used (0xe7e7e7e7e).

I tried to reset many time / upload, and time to time ADDR is setup properly.

Any clue.


You could try this simple libs to ensure the SPI communication hv no errors/data corruption...

https://code.google.com/p/rfsync/

It was written (by someone else) using the minimum stuff... the Inhaos are h/w compatible with NRF transciver except for the 250Kbps speed..


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: axel12p on Mar 14, 2013, 06:48 pm
Stil nothing, I can't figure out what's wrong  :-(

I have connected the 2 Arduinos on the same PC (COM6 & COM7) and uploaded on them the GettingStarted example as is.

Below you can see what I am receiving on both Serial Monitors

(http://i50.tinypic.com/oaq80l.gif)

Arduino on the right says that it is getting the payload and sents responses, which 99% of the time the Arduino on the left doesn't receive...

The wierdest thing is that when I am using Arduino on the right as a transmitter the other Arduino doesn't show anything on its Serial Monitor.

Sometimes when I reopen the Serial Monitors, the TX_ADDR are not the same between the 2 Arduinos (propably they hold their last state) but the results remain the same as you can see:

(http://i47.tinypic.com/11mb7dy.gif)

I have also tried to solder a 10uF capacitor between 3.3V and Gnd pins but with the same results.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Mar 14, 2013, 10:06 pm

Stil nothing, I can't figure out what's wrong  :-(
I have connected the 2 Arduinos on the same PC (COM6 & COM7) and uploaded on them the GettingStarted example as is.
Below you can see what I am receiving on both Serial Monitors


If yr output is shown, the SPI comms to the radio is OK..

When I re-wrote my codes, I find the example might work for the ping/pong but not for actual codes without adjusting the other settings like delays/settings...

Try the following one by one...

0. Put debug serial.print statement inside the while loop :-     while ( ! radio.available() && ! timeout )
1. changing the RF_CH on both ( rule out any radio interference... )
2. lowering the PA_Power on both
3. Increase the timeout of 200 at line :       if (millis() - started_waiting_at > 200 )
4. reduce/increase the delay(1000)  but higher than timeout period
5. Try another Serial examples at http://arduino.cc/forum/index.php/topic,132496.msg1088005.html#msg1088005 (http://arduino.cc/forum/index.php/topic,132496.msg1088005.html#msg1088005)
6. swap the radios on the Arduinos
7. I usually do not mess with the h/w side of soldering/desoldering as it might spoil the RF module

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: axel12p on Mar 15, 2013, 08:57 pm
Thank you very much for your help. Hopefully I didn't have to go through all these steps because the problem has been partially fixed.

As I was looking at the outputs on the Serial Monitor of the two Arduinos, I figured out that there should be a problem with one of the two Arduinos, receiving data but not sending. As you can see in the screenshot of my previous post, the Arduino on the right sends responses but the Arduino on the left isn't receiving anything.

So, I disconnected the RF module from the protoboard and connected it to the Arduino through male-to-female wires. Below you can see the result after doing so:

(http://i45.tinypic.com/34dojer.gif)

The only problem I found, and is shown in the screenshot above, is that every module has to be at least one time in transmission mode before it can listen to the other. So, if I power an Arduino through external power the two modules will never start to communicate with each other. The same happens if for a reason there is a power-off to one of them.


Maybe I'll have to change the code so that the module enters the transmission mode for a while, when it powers up, and then return and remain to receive mode.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Mar 15, 2013, 11:19 pm

Thank you very much for your help. Hopefully I didn't have to go through all these steps because the problem has been partially fixed.

As I was looking at the outputs on the Serial Monitor of the two Arduinos, I figured out that there should be a problem with one of the two Arduinos, receiving data but not sending. As you can see in the screenshot of my previous post, the Arduino on the right sends responses but the Arduino on the left isn't receiving anything.

So, I disconnected the RF module from the protoboard and connected it to the Arduino through male-to-female wires. Below you can see the result after doing so:

The only problem I found, and is shown in the screenshot above, is that every module has to be at least one time in transmission mode before it can listen to the other. So, if I power an Arduino through external power the two modules will never start to communicate with each other. The same happens if for a reason there is a power-off to one of them.



Yes, did I mention that I usually put a few of my arduino + nRF on 16x2 LCD (pics on my blog) so I do not even connect them to PC/Serial Monitor... and I change the code to force one of them to RX mode and auto-reply back to sender...

Just put two lines, radio.stoplistening() and radio.startlistening() to enable TX mode then back to RX mode..

You are very near to solving yr radio issues..... haha...
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Nick_Pyner on Mar 15, 2013, 11:25 pm

You are very near to solving yr radio issues..... haha...


Jeez, Stanley, are you getting up early or going to bed late?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: BDinWa on Mar 16, 2013, 03:35 am
I have the network code working perfectly using DS18B20 temp sensors on a pair of Megas, and am now trying to get a Due working.
Lots of compile errors using 1.5.2
fixed all the errors related to printf_p and PSTR, but there seem to be lots of issues with SPI
Any thoughts on the move to the Due?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Mar 16, 2013, 10:31 am


You are very near to solving yr radio issues..... haha...

Jeez, Stanley, are you getting up early or going to bed late?

Nick...
I woke up early after falling asleep last night at 10pm!!!!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Mar 16, 2013, 10:35 am

I have the network code working perfectly using DS18B20 temp sensors on a pair of Megas, and am now trying to get a Due working.
Lots of compile errors using 1.5.2
fixed all the errors related to printf_p and PSTR, but there seem to be lots of issues with SPI
Any thoughts on the move to the Due?


Pls look at :-
https://github.com/gnulnulf/RF24/network

Pls fork the latest version and work on the lib for the Due.... once it is stable, we can merge it back to the main libs..

We had a GPIO working version for RPi (also ARM) and we are porting to a h/w version directly from the bcm2835 Soc...
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: BDinWa on Mar 17, 2013, 06:10 pm
I found the solution, and it can likely be fixed in RF24.h.

1) added the following to the start of RF24.cpp:
#define _BV(bit) (1 << (bit))
#define PSTR(x) (x)
#define PRIPSTR "%s"
#define PROGMEM
#define printf_P printf
#define strlen_P strlen

They are conditional in RF24.h, but I'm not sure the right way to fix it for the DUE

in RF24.cpp changed:
  SPI.setClockDivider(SPI_CLOCK_DIV4);
to:
  SPI.setClockDivider(21);

I also changed a couple of lines in  that used "%S" in a printf() to use "%s"

That, combined with a little payload structure alignment to account for 32-bit vs. 16-bit ints, and everything works for me.

I now have my Megas chatting with my Due.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Nick_Pyner on Mar 18, 2013, 12:33 am
This looks pretty heavy....

Has this been brought about in order to use the Due?

Actually, I don't even understand the function of the *.cpp file, or why there are several files in the library folder.. 
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Mar 18, 2013, 06:24 am

I found the solution, and it can likely be fixed in RF24.h.

1) added the following to the start of RF24.cpp:
#define _BV(bit) (1 << (bit))
#define PSTR(x) (x)
#define PRIPSTR "%s"
#define PROGMEM
#define printf_P printf
#define strlen_P strlen

They are conditional in RF24.h, but I'm not sure the right way to fix it for the DUE

in RF24.cpp changed:
  SPI.setClockDivider(SPI_CLOCK_DIV4);
to:
  SPI.setClockDivider(21);

I also changed a couple of lines in  that used "%S" in a printf() to use "%s"

I now have my Megas chatting with my Due.


Good stuff!!!

You can use the #ifdef DUE ( or whatever the keyword for DUE ) #endif
so the compiler will add those statement in become compiling it for the DUE...

If it is working for the DUE, could you take the latest github RF24 fork and add in these changes so that in the future, the RF24 will have support for the DUE... ( or If you send me the codes, I could git push it for you but I do not have a DUE to test if it is working or not...)

Just curious, why did you use the DUE or MEGA instead of the regular UNO.. I was aware the DUE is very fast/32-bit if you need to do some high speed processing on it..




Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: BDinWa on Mar 18, 2013, 09:41 pm
OK, I'll do the research, and set it up with the right ifdefs.

I chose the DUE, because I'm going to use a 7-inch tft touch display. I'm using it as a master to control and monitor other units that manage aquariums, brewing fermentation, and some other things. Those basic units are simple, with temp sensors and relay controls. I was running out of room on my Mega that has been doing the job, and just added RF24 communications to already existing XBee communications. I'm also adding some very simple temperature monitoring only units.

So far, I have xBee, RF24, ds18b20 temp sensors, Ethernet, relays, and a simple display working.

Waiting for the new tft display and w5200 based Ethernet to arrive.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Jimster on Mar 22, 2013, 03:46 pm

Hi Guys.

I have two problems/questions
I have been playing with the nRF24L01 units for awhile now , and I have most of the examples working but I get a compile error when trying to verify the code . the code im trying tomake work is the sensornet pde. but i keep getting eeprom_update_block not declared. I have redone the file paths and and redownloaded the code but i get the same error over and over, and all the other examples work so that would tel me that the file path is fine.

im using 2x UNOs and IDE1.0.1
any ideas to fix this would be great.

the other problem i have is more on of advice needed. i want to use these units as maniacbug did for the sensor net but i want to send GPS data ,voltage and tempreture and date. which example would be best to start with and what would you suggest to use to send this data ?


Did you ever get to the bottom of your issue with "eeprom_update_block" as I'm also getting the same error
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: renex on Mar 24, 2013, 08:03 pm
Hi there, quite new with Arduino-nrf24. I was trying scanner.pde of maniacbug libs example. When I run in serial, and the scipt is scanning the channel freqs, I got for instance:
zeros...12102101120101..zeros.
Can anyone give me a shot about the meaning of those outputs?
I found easier to understand Greg's output
055 (2455Mhz): 05 - *****
but I dont know how to implement it. Any help?
Cheers,
ReneX
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: jnugen on Apr 09, 2013, 10:32 am
Hello!

While trying the "GettingStarted" example, I found the following bug:
Code: [Select]

 //if ( role == role_ping_out )
 {
   //radio.openWritingPipe(pipes[0]);
   radio.openReadingPipe(1,pipes[1]);
 }
 //else
 {
   //radio.openWritingPipe(pipes[1]);
   //radio.openReadingPipe(1,pipes[0]);
 }


It should be like this (at a minimum):
Code: [Select]

 //if ( role == role_ping_out )
 {
   //radio.openWritingPipe(pipes[0]);
   //radio.openReadingPipe(1,pipes[1]);
 }
 //else
 {
   radio.openWritingPipe(pipes[1]);
   radio.openReadingPipe(1,pipes[0]);
 }


This change makes sure the program is initialized in receiver mode, which is the default.

Hope it helps someone!

-James Nugen
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Apr 10, 2013, 09:04 pm
I got the attiny85 with nRF24L01 running on mirf85/spi85 library compatible with RF24 library...  :) :)

Pls see the link below :-
http://arduino.cc/forum/index.php/topic,115822.msg1194156.html#msg1194156

I've also compile & uploaded all the mentioned files in github repo at :-
https://github.com/stanleyseow/attiny-nRF24L01

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Jimster on Apr 12, 2013, 03:11 pm
I've been trying to work this out for a while, but need help.

I'm using the sensornet example, but I'm trying to write the data from sensors into a variable.

I guess I'm correct in thinking this is the code that write the data via serial

Code: [Select]
RF24NetworkHeader header;
    S_message message;
    network.read(header,&message,sizeof(message));
    printf_P(PSTR("%lu: APP Received #%u %s from 0%o\n\r"),millis(),header.id,message.toString(),header.from_node);


Can someone breakdown whats going on above so I can work out whats going on??

What I'd like to do is import the data into two arrays, "temp_read" and "voltage"
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: jmauld on Apr 20, 2013, 04:59 am


The only problem I found, and is shown in the screenshot above, is that every module has to be at least one time in transmission mode before it can listen to the other. So, if I power an Arduino through external power the two modules will never start to communicate with each other. The same happens if for a reason there is a power-off to one of them.


Maybe I'll have to change the code so that the module enters the transmission mode for a while, when it powers up, and then return and remain to receive mode.


I had the same problem.  I fixed it by adding the following two lines right after the first instance of:
  //
  // Start listening
  //
    radio.startListening();  [font=Verdana]<----FIND THIS LINE, somewhere around line 109[/font]


      radio.openWritingPipe(pipes[1]);  <---ADD THESE TWO LINES AFTERWARDS
      radio.openReadingPipe(1,pipes[0]);
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: kemonine on May 01, 2013, 04:58 am

That, combined with a little payload structure alignment to account for 32-bit vs. 16-bit ints, and everything works for me.


What payload changes did you make?  I've not been able to find your code changes.


Following on from this: I managed to get the RF24 library working with the Arduino Due shortly before discovering this thread.  I've forked gnulnulf's repo and posted my changes for anyone that may be interested: https://github.com/mcrosson/RF24/commit/ac05a9d8f755dcc7ff12b7e08021f62c0b5f3543

The code was tested using the pingpair_dyn example using a Due and a Micro.  You'll need to comment out the fdevopen call on line 30 for the example to compile and run.  Near as I can tell the line is not necessary when working with the Due.

Some pics of my setup:
Arduino's
(https://cloud.nusku.net/public.php?service=files&t=22ee00c2a931a23046f2b01a810c982a&download)

Serial Monitor
(https://cloud.nusku.net/public.php?service=files&t=723be6cc95123b7aa24ef2be2692f70a&download)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: CarlosGR on May 10, 2013, 01:58 am
Hello everyone! Can you tell me how many nodes can have the arduino uno with mesh network topology?

thanks XD
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on May 26, 2013, 03:14 pm
Besides using the version with PA & LNA and external antenna, is there a method to cut the existing PIFA antenna and solder in a "better" DIY antenna to those cheap nRF2L01+ modules ??

Since they are running on 2.4Ghz, there are plenty of DIY antennas made for the wifi radios ..

(https://arduino-info.wikispaces.com/file/view/24L01Pinout-800.jpg/243330999/24L01Pinout-800.jpg)

I still do not understand about the 50 Ohm impedance matching portion for the antenna...
The schematics is here -> http://store.diyembedded.com/schematics/nrf24l01p_schematic.pdf (http://store.diyembedded.com/schematics/nrf24l01p_schematic.pdf)

The below links uses a DIY 2.4Ghz antenna with the nRf24L01+ SMA connector...

http://achuwilson.wordpress.com/2012/05/18/long-range-rf-link-using-nrf24l01-rf-transceiver/
(http://achuwilson.wordpress.com/2012/05/18/long-range-rf-link-using-nrf24l01-rf-transceiver/)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on May 26, 2013, 04:45 pm
Hi,

It seems there is a big gap between the $3 nRF24L01 modules with built-in antennas and the $20 versions with SMA connectors.

After some research I found that the version with both Power Amplifier and Low Noise Preamp was almost the same price as those with only the Preamp or None. Maybe the SMA connector costs more than the chip?? 


DISCLAIMER: Mentioning stuff from my own shop... but I like these ones (http://yourduino.com/sunshop2/index.php?l=product_detail&p=190), and don't bother with the $3 ones..

How-To on these radios here:  http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo (http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on May 27, 2013, 06:09 am
Dear Terry,

I have both the "cheap" version that I purchase from China for like 10 pieces for US$12 and the "expensive" version for around US$18...

Since I hv a few extra pieces of the cheap version, I just had this idea of putting a RP-SMA connector to them for the fun of it... but after receiving feedback that the loss from the cables and connectors would be pretty high... it might just defeat the whole purposes of doing it..

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Docedison on May 28, 2013, 02:09 am
that little squiggle is actually matched to the output of the nRF24XX IC, It's a part of the reference design and every board uses the same parts in pretty much the same configuration. it also is of a type that doesn't rely as much as other types of antenna's do on a good ground plane or counterpoise for effective radiation.
The rubber duck type of antenna (flexible or otherwise) is only matched to the transmitter when there is a minimum of 1/4 wavelength radius of metal perpendicular to the antenna and extending for 360 degree's around it. If the metallic area is larger that's better if it is irregular the radiation will favor a path along the long axis of the metal acting as a ground plane or counterpoise.
My answer is to use the cheap ones and delegate control of them to a bus controlled processor. The reasoning is that I can get the transmitter as high as necessary while not loosing performance to cabling, either control or RF. Long wires on the SPI bus are a no-no a most strict no-no and any type of usable coax ( not limited by size) is just as bad. The other issue is that other SPI devices will suffer too. So when I need to send a message it has an address too. Much easier that way and I can change between any of the protocols that way becausee the transmitter has some smarts too.

Doc
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: JohnHoward on May 29, 2013, 01:36 am
I would give the following a try:

http://www.freeantennas.com/projects/Ez-10/index.html

It's a corner-reflector design.  Now, I have not done this at 2.4gHz, but I have done it at 850mHz  and it worked extremely well (where the driven element was simply the rubber ducky antenna of a handheld scanner.

Orient the nRFL2401 circuit board vertically in the corner with proper spacing from the corner and you should see reasonably good gain even if badly aligned.

I'd just suggest fitting a vertical piece of plastic or cardboard so it bisects the corner of the reflector, and fasten the nRF2401 to that. Tape it down, move it around and look for best performance then mount it more permanently.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on May 29, 2013, 07:45 pm
Quote
I would give the following a try: http://www.freeantennas.com/projects/Ez-10/index.html


THERE's an idea! Thinking outside the Impedance Matching, Feedline and Smith Chart box.

Anyone who tries this let us know. I will when (ItStopsRaining)AND(IGetSomeFreeTime) 
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on May 29, 2013, 08:04 pm
Here (http://www.instructables.com/id/DIY-WIFI-Antenna-Reception-Booster) is a variation of the theme.

Of course there is the Pringles Cantenna (http://www.instructables.com/id/DIY-Wifi-Extender-Cantenna-build-with-a-stand) option, if you are highly directional. The instructions show cans but you can use a single Pringles can. Its near the perfect size and shape for the target frequency (2.4Ghz).
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Docedison on May 30, 2013, 03:28 am
Absolutely perfect for fixed communications point to fixed point... I do however take exception to DBI (isotropic) rather than the more realistic DBD (Dipole) because DBI involves a conceptual antenna that can't be built. The isotropic antenna is an ideal point source radiating equally in all directions.
In fact the built in  antenna is directional to a great degree, It favors the open end of the antenna. For a real measure of antenna "gain" measure the RSSI on the other device and have the other device send back the RSSI figures. Without the antenna reflector record the RSSI figure returned from the monitor transceiver and be certain that the measurement isn't maxed out. Reduce the transmitting power on the sending unit by 10 DB and place the reflector in place... If the reflector does as claimed it will bring the RSSI above your measured point... 11.4 DBI is about 9 DB of real gain and it isn't gain but focusing all the power in one direction. This allows a limited area for deploying your other nodes. The high F/B ratio just makes it hard for any not in the direct path of the antenna to successfully communicate with the transceiver.
The other issue of course is the connections to the chip from the SPI port, they should be as short as possible unless your controller has nothing else on the SPI bus and all units should be as high as possible above any possible obstructions including but not limited to stucco walls and most types of rolled insulation as most all have a reflective surface of aluminum foil as a heat barrier. There can be issues with any kind of wall material. It just depends on the water content.

Doc
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: scargill on Jun 07, 2013, 06:45 pm
I wonder if anyone can help. I just KNOW this is going to be a silly question but..

I'm using one Arduino with RF24 library to send to another - for now just the one direction.... no problem.. If I turn off the transmitting board and turn it back on - all is well... however if I turn off the receiving board and turn that back on - no further sending is possible..

Here's an abbreviated version of my programs missing out all but radio.. what on earth am I doing wrong..

SENDING BOARD relevant inits

#include <RF24.h>
RF24 radio(8,3);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };


SENDING board... the SETUP function..

    radio.begin();
    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
    radio.enableDynamicPayloads() ;
    radio.setAutoAck( true ) ;
    radio.powerUp() ;
    radio.startListening()

SENDING board - the LOOP.

       radio.stopListening();
          radio.write( &payload, sizeof(payload) );
          radio.startListening();


Ok, so now the RECEIVING BOARD


#include <RF24.h>

RF24 radio(9,10);

// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

RECEIVING BOARD SETUP

radio.openWritingPipe(pipes[1]);
  radio.openReadingPipe(1,pipes[0]);

  radio.enableDynamicPayloads() ;
  radio.setAutoAck( true ) ;
  radio.powerUp() ;
  radio.startListening();

RECEIVING BOARD -  LOOP...



    if ( radio.available() )
    {
      bool done = false;
      while (!done)
      {
        done = radio.read(&payload, sizeof (payload));
      }

      radio.stopListening();

// some very quick stuff in here
      radio.startListening();
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Jun 07, 2013, 06:50 pm


Code: [Select]
    radio.enableDynamicPayloads() ;



Code: [Select]
    if ( radio.available() )
    {
      bool done = false;
      while (!done)
      {
        done = radio.read(&payload, sizeof (payload));
      }




Note, you are using dynamic payloads. You must do something like:

Code: [Select]
done = radio.read( &payload, radio.getDynamicPayloadSize() ) ;


See pingpair_dyn.pde as an example.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: scargill on Jun 07, 2013, 07:00 pm
Payload is always the same size.. I could have used a number. It's the size of a UNION I use to hold the data. I've no problems with transmitting whatsover... the problem comes if I disconnect power to the receiver and reconnect.... The transmitter will no longer talk to it - I don't know whether to change code in the transmitter or the receiver board.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Jun 07, 2013, 07:26 pm
If the payloads are fixed size, then there is no reason to use dynamic payloads. Furthermore, the length provided to write and read determine how many bytes are transferred over the SPI bus with the radio. You should make these the proper size. If in fact they are fixed size, then I encourage you to not use dynamic payloads.   Instead, use setPayloadSize() with dynamic payloads disabled. On the other hand, if you are using dynamic payloads, you should use the API properly. If the API is not used properly, there really isn't any point in looking for other issues.

Also, you need to either quote your code, or use something like pastebin. It helps a lot. Furthermore, complete code dramatically improves things.

Do the examples work for you?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: scargill on Jun 07, 2013, 07:44 pm
Not entirely sure how - but that worked. I've no idea how that dynamic stuff or even the powerup crept in - I've replaced the lot with setting up the payload size, speed etc (256k) explicitly and now after a power-cycle it's absolutely fine.

Thank you for that!!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Jun 07, 2013, 10:29 pm
I found this interesting mini-robot
http://www.mowayduino.com/ that uses RF based on nRF24L01+
from atmel blog... http://atmelcorporation.wordpress.com/
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: aladdin on Jun 08, 2013, 04:11 pm
Hi! Unfortunately I can't get it to work on my UNO. Tried several nrf24L01+ so that isn't the problem.
This is my printDetail() : http://pastebin.com/kR86P8D6
and the output when transmitting is

Now sending 8391...failed.

Any ideas?

Thanks, Calle
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Jun 08, 2013, 05:51 pm
Quote

Hi! Unfortunately I can't get it to work on my UNO. Tried several nrf24L01+ so that isn't the problem.
This is my printDetail() : http://pastebin.com/kR86P8D6
and the output when transmitting is

Now sending 8391...failed.


Where is the output of the other UNO with nRF ?

Since you didn't mentioned in yr post (and we can't read yr mind), you will need to put the "other UNO/nRF" to Transmit mode to the Pong Back one you pasted the output...

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: aladdin on Jun 08, 2013, 06:23 pm

Quote

Hi! Unfortunately I can't get it to work on my UNO. Tried several nrf24L01+ so that isn't the problem.
This is my printDetail() : http://pastebin.com/kR86P8D6
and the output when transmitting is

Now sending 8391...failed.


Where is the output of the other UNO with nRF ?

Since you didn't mentioned in yr post (and we can't read yr mind), you will need to put the "other UNO/nRF" to Transmit mode to the Pong Back one you pasted the output...




There isn't. Only one is up and running but i fails on the send so it wouldn't change but setting up another
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Jun 08, 2013, 06:29 pm
If u enable auto ACK ( EN_AA ), the sent will failed without receiving an ACK back...

You need at least a pair to work...

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: aladdin on Jun 08, 2013, 08:57 pm

If u enable auto ACK ( EN_AA ), the sent will failed without receiving an ACK back...

You need at least a pair to work...




You are a genius and a hero! Thanks!

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: blondak on Jun 10, 2013, 01:03 pm
Hi,
i wrote PHP version of this library, avaible at https://github.com/blondak/RF24-php I hope, that one will help someone
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: rclymer on Jun 10, 2013, 06:02 pm
I can't seem to get my two nRF modules working. I am trying to run the GettingStarted example. Here are the two printDetails() outputs.

Code: [Select]

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xf0f0f0f0e1
RX_PW_P0-6 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0f
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_HIGH


Code: [Select]

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xe7e7e7e7e7 0xf0f0f0f0d2
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x00 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x07
CONFIG = 0x0f
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_HIGH


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Jun 10, 2013, 06:20 pm
Since none of these posts are directly related to the RF24 library, I would encourage you to create new posts when requesting help. This makes it easier to people to participate as well as it prevents past thread contributors from notifications on posts which are unrelated to the library proper.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: rclymer on Jun 10, 2013, 08:24 pm
In what way does my post not relate to the RF24 Library? I am using maniacbug's library from the github link in the very first post.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gerg on Jun 10, 2013, 08:39 pm
Because the library, and variants, are pretty well debugged at this point. Most of the thread contributions here, including yourself, are actually asking about how to get your local configuration (hardware and/or software) correct rather than issues with the library proper. You're not actually asking questions about the library, but rather local issues using the library. That's why I made the distinction between "library proper" and your use.

Doing so makes it more easily search-able for others which suffer the same issue. It also makes it less intimidating for those coming after; such that they are not staring at a thread with a rather large page count.

Better questions. Why wouldn't you post your specific issue in its own thread? Do you have any information which indicates this is a library specific issue? Beyond all that, creating a new thread on forums, is general considered proper forum etiquette.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: rclymer on Jun 10, 2013, 11:04 pm
I was unaware of a problem with my end and thought the problem may lie within the library, In the GettingStarted example, the pipe adresses did not match my modules, after modifying them, I still had no success.

Now, I have made some progress. One sketch has the new pipe addresses and the other uses the same adresses but inverted. (pipe[0] becomes pipe[1] and vice versa).

Forgive me if this was too off topic.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Jun 12, 2013, 05:36 pm

I've a question to ask, can this library or future enhancements ack similar like serial TX/RX on both sides ?


I just discovered that I've wrote the codes I asked for six month ago...

Serial over nRF24L01+
http://arduino-for-beginners.blogspot.com/2013/06/arduino-serial-over-nrf24l01.html

:) :) :)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Mark_Grass on Jul 26, 2013, 08:59 am
I have 5 of the nRF24L01+PA+LNA.  The scanner code works.  When I use the PingPair or GettingStarted sketches, they don't seem to work after I remove power and restart them.  I have to run "scanner" and then "pingpair" or "gettingStarted".   When they do communicate, I don't get much range at all.  Are all of these devices from China  crap?   I also have several of the nRF24s w/o PA/LNA and they only have a rnage of about 12".   Is this normal? 
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: oric_dan on Jul 26, 2013, 06:06 pm
I get about 10m (30 foot) range with the basic nRF2401+ modules, you should be getting much better distance with the amplified modules.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Mark_Grass on Jul 27, 2013, 07:55 pm
First of all>>>>>>Thank you soooo much maniacbug for the library!!!!!!

Finally!!!!  :smiley-mr-green:  I had three problems.
1. Bad connections on the 2x4 icd connector.  The module doesn't lend itself to easy hook up or plugging it into a std breadboard, not to mention the fact that they all are marked as pin 1 is pin 2 (2 is 1), because they have the pins going out the bottom of the board not the top. They all seem to be that way.   So a colored ribbon cable does not match the std color code 1bro, 2rd, 3ord, 4yel, etc.  Instead,  it's 1rd, 2bro, 3yel, 4org, 5blu, 6grn, 7gry, 8vio.     

2.  Reading the documentation I thought the CE and CSN pin could be any unused I/O pin.  For some reason the method  "RF24 radio(9,10);" can't be changed.  I had used different pins than 9 and 10,and it didn't work.   I understand that the SPI interface has to match that of the ucontroller hardware, but I thought the other two pins could be any unused digital I/O.
If some one can shed some light on this it would be appreciated.

3. This applies to the module with PA+LNA: Once I fixed the other two problems, the pong (repeater) would send out one reply and then stop.  The fix was to add a cap to the module.   I started with a .1uf, but didn't help.  Used a 220/15v cap and it worked. Did not check to see if a larger one was better or a smaller was the same.

Using the RF24 lib example "pingpair":
RANGE:  (line of sight:LOS)
    nRF24L01+    30' in doors  through two walls
                        (doors open, LOS was through 2 walls)
    nRF24L01+PA+LNA    approx 200' LOS
                        through 3 walls to outside and down the hill
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Jul 27, 2013, 08:53 pm
Quote

2.  Reading the documentation I thought the CE and CSN pin could be any unused I/O pin.  For some reason the method  "RF24 radio(9,10);" can't be changed.  I had used different pins than 9 and 10,and it didn't work.   I understand that the SPI interface has to match that of the ucontroller hardware, but I thought the other two pins could be any unused digital I/O.
If some one can shed some light on this it would be appreciated.


For all my programs and forks, I'm using CE = 8, CSN = 9, no issues at all... see my fork of the RF24 on the network ( https://github.com/maniacbug/RF24/network )

Quote

3. This applies to the module with PA+LNA: Once I fixed the other two problems, the pong (repeater) would send out one reply and then stop.  The fix was to add a cap to the module.   I started with a .1uf, but didn't help.  Used a 220/15v cap and it worked. Did not check to see if a larger one was better or a smaller was the same.


When using the Arduino UNO 3.3V, no issues at all for the PA+LNA+ext antenna version...

I made an UNO nRF24L01 adapter that plugs directly to D8-D13 + Gnd
with SPI = 11,12,13 CE=8/CSN=9
I'm using pin10 as my VCC, 5V to 3.3V using this Reg LDO, TO-92
LE33CZ 3.3V LDO ( http://my.element14.com/jsp/search/productdetail.jsp?sku=9755349&CMP=i-55c5-00001621 )

I need to put a 10uF between the VCC and GND to get the nRF working on Max power...
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: oric_dan on Jul 27, 2013, 10:16 pm

...
3. This applies to the module with PA+LNA: Once I fixed the other two problems, the pong (repeater) would send out one reply and then stop.  The fix was to add a cap to the module.   I started with a .1uf, but didn't help.  Used a 220/15v cap and it worked. Did not check to see if a larger one was better or a smaller was the same.

Using the RF24 lib example "pingpair":
RANGE:  (line of sight:LOS)
    nRF24L01+    30' in doors  through two walls
                        (doors open, LOS was through 2 walls)
    nRF24L01+PA+LNA    approx 200' LOS
                        through 3 walls to outside and down the hill

Yeah, I didn't see you mention which Arduino board you're using, but 3.3V current-output capability is deficient on pretty much all of them. As low as 50mA or so.

There have been MANY posts by people in the past on many threads saying how they needed to use a large cap on the RF module Vcc pin, but the problem in most cases has probably been that the 3.3V regulators used cannot supply enough current for the modules. The higher power RF modules especially require more current. With regards XBee shields, you'll notice the better shields have their own 3.3V regulator on board.

The very FIRST thing you need to do when hooking anything to an Arduino board is to know how much current the thing draws, and also how much current your Arduino board can supply.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Mark_Grass on Jul 28, 2013, 02:50 am
Well, I'm somewhat chagrined :D to say the least.  I went back and tested ;  yes the "Radio(x,y);"  does in fact work.   Must have been some of my other gremlins messing with me  or could have been that I had the boards on max power while only separated by a couple feet, saturating the receiver. Could have been the summer cold that I have.

I missed the threads that had mentioned the power problem, except for the mega2650.

I'm really liking the modules now, just don't like the arrangement of the modules.   I had a similar idea to the adapter board. 
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: oric_dan on Jul 28, 2013, 03:02 am
200' is pretty good with the amplified modules. I bought a couple of those a few weeks ago, but haven't gotten to testing them as yet. I've been testing RFM12, RFM22, and BTs lately, plus xiveling and twittering from my ethernet shield, LOL. Plus ColorLCD shield today for data display.

I'm cooking up a home automation system, and planning to use the RFM22s at 433 Mhz to get the system off the 2.4G band, since I can pick up 30 routers here. OTOH, one of my links I want transmitting to the car on the other side of the building, so the amped-up nRF2401s might be good for that. Good to hear they're working now.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Mark_Grass on Jul 29, 2013, 03:14 am
Range test, line of sight, each set up was only bread boarded and powered by single Li-ion cells charged to 4.2v.

The basic nRF24L01+ with the pcb trace ant. had a reliable range to about 30m.  The rf modules were not held in any particular position.  They were just dangling from the end of a 3" piece of ribbon cable.  At about 34m there was no link at all.

The nRF24L01+LNA+PA had reliable link to about 625m/2100'.  The 2db ant. were set at 90 at the joint to allow it to point directly vertical.   

Don't think that powering them with the full 5v would make a difference because the rf modules run off of 3.3v.
A small parabolic reflector at the base unit might give it some extra distance.  I'll try that once I have the prototype packaged a little better. Send the signal out, then back and have it run a servo at same end of the link.

Loop delta was about 24msec and the data structure was 12 bytes plus all of the other addressing, preamble, etc.  The base unit delayed after each successful packet for 200 msec. May also get better range by using a different channel.  All in all, not bad for the price.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Jul 29, 2013, 05:28 am
I've a couple of these Nordic compatible radio modules from Inhaos, RF-2423, they have a high power mode that can output 7dBm .... they work out of the box without any modifications to my nRF codes...

http://www.inhaos.com/product_info.php?products_id=61

They are really small/SMD/1.27mm pitch and can be surface mounted directly on yr project board without the 4x2 female headers...
For testing, I solder them on one side of the SOIC-16 for breadboard compatible...

(http://farm8.staticflickr.com/7396/9390729058_143bf85658_m.jpg) (http://www.flickr.com/photos/stanleyseow/9390729058/)
RF-2423 on SOIC-16 (http://www.flickr.com/photos/stanleyseow/9390729058/)

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Mark_Grass on Jul 29, 2013, 04:45 pm
Sweet!   What kind of range do you get at max power and 1Mbps?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Mark_Grass on Jul 30, 2013, 09:13 am
I misunderstood.  I thought the module was on a .1" pitch, but I now see that you had to use an adapter.
Kind of negates the SIP layout.   They don't make it easy for anyone.  All breadboards are .1".
 
I'm still interested in the range that you get with it.  If it's not any more than the nrf24L01+, then there isn't much advantage to it.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: roboticboyer on Aug 11, 2013, 02:57 pm
Dear All

I modified the Maniacbug 2.4 GHz scanner.
https://github.com/roboticboyer/Arduino/blob/master/2.4GHz%20Scanner.ino (https://github.com/roboticboyer/Arduino/blob/master/2.4GHz%20Scanner.ino)

This version only shows channel in use.


Bye
Robotic Boyer
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: aaahaaap on Aug 15, 2013, 04:36 pm
What is the recommended version/fork of this library to use at the moment?

I noticed Maniacbug's RF24 github repo (https://github.com/maniacbug/RF24) was updated about a month ago, but there are several forks on github as well. Gnulfnulf is mentioned in several places, but it was last updated in April.

And then there's Maniacbug's RF24Network repo (https://github.com/maniacbug/RF24Network) as well...
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Aug 15, 2013, 08:41 pm
Goto any RF24 repo/forks, click on the Network on the right side..

Choose anyone you like or suit yr requirements.. some of the later forks might fix some issues and add extra features/examples to the lib...


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: aaahaaap on Aug 15, 2013, 10:21 pm

Goto any RF24 repo/forks, click on the Network on the right side..

Choose anyone you like or suit yr requirements.. some of the later forks might fix some issues and add extra features/examples to the lib...

Thanks for your reply! I've checked the forks (before posting obviously :)) and I was just wondering if anyone has any firsthand experience which one to use. There seems to be an uncoordinated proliferation of forks being created without any proper master everything is eventually pushed/pulled into.

For example, your repo (https://github.com/stanleyseow/RF24) seems pretty recent/good as does the one from gcopeland (https://github.com/gcopeland/RF24). You've merged some parts from him, but not everything. For example, I'd guess this commit (https://github.com/gcopeland/RF24/commit/950bbd7067d522bcad90493e333f1ffc946432aa) is useful too, but I don't know for sure.

+ All these forks make it quiet difficult for starters/newbies to know where to start, as mentioned for example in this blog post (http://mathertel.blogspot.nl/2013/04/hints-on-using-nfr24l01-with-arduino.html) (under Critics).
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Aug 17, 2013, 10:02 am
I asked a student to help me draw/design and make a DIY PCB for nRF24L01 UNO adapter with 3.3V LDO from pin 10

The 3.3V LDO power regulator is LE33CZ, the 10uF is needed for the stability of power during Tx mode..

Here are some pics..

(http://farm6.staticflickr.com/5489/9526849573_4a159cb464_m.jpg) (http://www.flickr.com/photos/stanleyseow/9526849573/)

(http://farm8.staticflickr.com/7438/9529636372_b54b8da925_m.jpg) (http://www.flickr.com/photos/stanleyseow/9529636372/)

(http://farm4.staticflickr.com/3728/9529638072_fbc37e85b4_m.jpg) (http://www.flickr.com/photos/stanleyseow/9529638072/)


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Aug 22, 2013, 07:40 pm


For example, your repo (https://github.com/stanleyseow/RF24) seems pretty recent/good as does the one from gcopeland (https://github.com/gcopeland/RF24). You've merged some parts from him, but not everything. For example, I'd guess this commit (https://github.com/gcopeland/RF24/commit/950bbd7067d522bcad90493e333f1ffc946432aa) is useful too, but I don't know for sure.

+ All these forks make it quiet difficult for starters/newbies to know where to start, as mentioned for example in this blog post (http://mathertel.blogspot.nl/2013/04/hints-on-using-nfr24l01-with-arduino.html) (under Critics).


I guess this is the good and bad part of github, you can fork a repo without asking the person that started the repo (or he no longer maintain it )  but from time to time, the repo are merged back to the upstream repo...

I guess you shd just use the latest repo or repo that are frequently updated ( as least you know the person is still actively updating the repo with bug fixes or new features/examples )...

Mine had 2 Raspberry Pi libs/drivers forks on them (bcm and GPIO), so if you planned to use with RPi too, this is a good choice ... I also added some extra examples that I mentioned in my blog too...

For the SPI timing commit, thanks, I hv added that in too..

For Arduino only, gcopeland's repo is pretty good as I seek a lot of advise from him all the time...
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: sej7278 on Oct 11, 2013, 11:56 am
I'm using Stanley's fork and I'm finding that the first 2-3 packets seem to be buffered or something. How can I explain that better?

I have my transmitter (ATmega328 on breadboard) sending out a counter once a second - 1..2..3..4.. and my receiver is printing it to the screen (on Pi) or serial monitor (on Mega2560). That works fine.

But say the TX goes out of range, or I kill the program on the RX at say count=16, when it comes back in range or I restart the program, instead of the counter being 50 (as TX has continued incrementing) it displays 17...18...19...51...52...53...54... so it seems to sync back up after 2-3 packets.

Any ideas? I get the same problem whichever way I mix up the TX/RX devices - e.g. TX=mega, RX=pi, so I don't think its hardware.

Its not a screen buffering problem, as I happens if I write to file instead of STDOUT/serial.

i tried disabling dynamic payloads and setting it to 3 bytes but it made no difference, it seems that something is not flushing when available() is not true or something odd.

Ah, it seems to happen if there's a big delay, e.g. if I kill the RX program on the Pi at count=100, wait 10secs or so, it produces:
104
105
112
113
114
115
116

But if I stop the program, then quickly start it again within say 2secs, its fine:

sudo ./pi_rf24ping_rx
253
254
255
256
^C
sudo ./pi_rf24ping_rx
258
259
260
261
262

If I reset the TX, it seems to cope - RX displays 0...1...2...3...4... just fine, its only if the RX program is quit or the TX goes out of range and comes back again.

Seems to be more reliable if I use "radio.setAutoAck(0);" and reduce the timeout/retries.

arduino+pi code (http://blog.the-jedi.co.uk/2013/10/07/nrf24l01-and-raspberry-pi/) and 2 arduino's code (http://blog.the-jedi.co.uk/2013/09/27/nrf24l01-and-3-3v-arduino-on-a-breadboard/)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Oct 12, 2013, 04:22 pm
If it is 3 packets, it is bcos the nRF24L01 radio have 3 input/output buffers..

You can flush them using the flush_rx() or flush_tx() functions to flush out the buffers..

Stanley
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: sej7278 on Oct 12, 2013, 07:43 pm

If it is 3 packets, it is bcos the nRF24L01 radio have 3 input/output buffers..

You can flush them using the flush_rx() or flush_tx() functions to flush out the buffers..


i saw lots of calls to those functions in the library, so assumed there were already enough lol. i'll have to refresh my c++ to recall how to call a protected method.

i've got a feeling it is ack packets and/or retries due to lost packets now though, as with a serial monitor on both ends it seems the RX is always 2-3 packets behind the TX.

radio.setAutoAck(0);
radio.setRetries(2,2);

seems to help a bit.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: cmanon on Oct 17, 2013, 01:50 am
I'm new to this modules and am using Stanley's fork trying to connect a RPI with an Arduino Ethernet, I've spent some time reading this forum and played with different configurations for the channels/data rate/pa levels with no much success.

On the RPI I'm running the rpi-hub program and there seems no issues with the RPI (unless the ack maybe is not sent back to the arduino) as the RPI receives all payloads from the arduino:

Code: [Select]

SPI device = /dev/spidev0.0
SPI speed = 8000000
CE GPIO = 25
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xabcdabcd71 0xf0f0f0f0e1
RX_ADDR_P2-5 = 0xe2 0xe3 0xe4 0xe5
TX_ADDR = 0xabcdabcd71
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x3f
RF_CH = 0x7d
RF_SETUP = 0x21
CONFIG = 0x0f
DYNPD/FEATURE = 0x3f 0x04
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MIN

Output below :
Recv: size=18 payload=E1,001,009,007,249 pipe=1 Send: size=18 payload=E1,001,009,007,249 pipe:1
Recv: size=18 payload=E1,000,127,075,039 pipe=1 Send: size=18 payload=E1,000,127,075,039 pipe:1
Recv: size=18 payload=E1,001,008,007,249 pipe=1 Send: size=18 payload=E1,001,008,007,249 pipe:1
Recv: size=18 payload=E1,002,232,231,073 pipe=1 Send: size=18 payload=E1,002,232,231,073 pipe:1
Recv: size=18 payload=E1,003,219,217,146 pipe=1 Send: size=18 payload=E1,003,219,217,146 pipe:1
Recv: size=18 payload=E1,004,214,211,162 pipe=1 Send: size=18 payload=E1,004,214,211,162 pipe:1
Recv: size=18 payload=E1,005,211,208,016 pipe=1 Send: size=18 payload=E1,005,211,208,016 pipe:1
Recv: size=18 payload=E1,006,210,206,032 pipe=1 Send: size=18 payload=E1,006,210,206,032 pipe:1
Recv: size=18 payload=E1,007,210,206,110 pipe=1 Send: size=18 payload=E1,007,210,206,110 pipe:1
Recv: size=18 payload=E1,008,210,206,155 pipe=1 Send: size=18 payload=E1,008,210,206,155 pipe:1
Recv: size=18 payload=E1,009,209,206,197 pipe=1 Send: size=18 payload=E1,009,209,206,197 pipe:1
Recv: size=18 payload=E1,010,209,206,184 pipe=1 Send: size=18 payload=E1,010,209,206,184 pipe:1


But the arduino sometimes it sent the payload and receive the ack correctly but most of the time it shows errors, I'm running the nRF24_sendto_hub just commented all the lcd code:

Code: [Select]

Sending nodeID & 4 sensor data

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xf0f0f0f0e1 0xf0f0f0f0e1
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xf0f0f0f0e1
RX_PW_P0-6 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x7d
RF_SETUP = 0x21
CONFIG = 0x0f
DYNPD/FEATURE = 0x3f 0x04
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MIN
outBuffer: E1,000,127,075,039 len: 18
Send successful
outBuffer: E1,001,008,007,249 len: 18
Send failed
outBuffer: E1,002,232,231,073 len: 18
Send failed
outBuffer: E1,003,219,217,146 len: 18
Send failed
outBuffer: E1,004,214,211,162 len: 18
Send failed
outBuffer: E1,005,211,208,016 len: 18
Send failed
outBuffer: E1,006,210,206,032 len: 18
Send failed
outBuffer: E1,007,210,206,110 len: 18
Send failed
outBuffer: E1,008,210,206,155 len: 18
Send successful
outBuffer: E1,009,209,206,197 len: 18
Send failed
outBuffer: E1,010,209,206,184 len: 18
Send failed
outBuffer: E1,011,209,206,165 len: 18
Send successful
outBuffer: E1,012,209,206,236 len: 18
Send failed
outBuffer: E1,013,209,206,042 len: 18
Send failed
inBuffer:  E1,013,209,206,042
inBuffer --> rtt: 23
outBuffer: E1,014,209,206,219 len: 18
Send successful


Any idea where I can continue looking to fix the issue? Anyone else with similar issues around here?

UPDATE: Well it happen that this was the problem, two 10 uF capacitors between 3.3v and GND, to filter the Ardiono 3V regulator http://forum.arduino.cc//index.php?PHPSESSID=9sru8nusnntmqipj2pgtqlaq17&topic=171611.0 (http://forum.arduino.cc//index.php?PHPSESSID=9sru8nusnntmqipj2pgtqlaq17&topic=171611.0)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: dapug on Nov 08, 2013, 02:19 am
Stanley, maniacbug, greg and others... fantastic work here.  Very impressive.

Questions


Please tell me there is good news here.

Total noob evaluation:
I'm a noob, not only to nRF, but Arduino, period!  Got the maniacbug RF24 GettingStarted example running on my Uno R3's only after several hours of reading through this entire post.  Sorely lacking a noob tutorial, so I will gladly volunteer to write one and post a link here later. :)  In short, I found 2 blockers and 1 annoyance for noobs not obvious from the examples or the doc files:  1) you need a 10uf cap on 3.3v to ground.  and 2) you must set BOTH the transmitter and receiver to TX mode at least once (setting one of them back to RX) before they will talk.  Weird. 

The annoyance? Many variations of the code out there, cant make heads nor tails of it.  For example, the fork from gcopeland is said to be more stable, but none of the examples work (i.e. wont even compile), and in fact, is missing the Getting Started example altogether.   hmfff.

Anyway, this stuff is AWESOME.  A die hard .NET Micro Framework guy quickly becoming converted.  :)   (I came to Arduino because I really want to use nRF24L01+, and C# support for it totally sucks)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: dapug on Nov 08, 2013, 07:46 am
One other question:  do I need to do anything special to get RF24 running on atmega328 8MHz as opposed to 16MHz? (pro mini)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Nov 26, 2013, 08:35 pm
@dapug,

PLEASE do write up your Noob Experience!  I would like to host it on the http://ArduinoInfo.Info WIKI.

nRF24L01 is VERY popular reading there. thousands of hits a month:
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo

And many people have trouble getting it off the ground, as you did.

I'd like to have a "Just Get Started" section, (And a "Don't Forget THIS at the very top, like the 3.3V Issue..)

AND there is the Raspberry Pi Connection everyone wants and people are working on!

terry@yourduino.com
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Nov 27, 2013, 06:11 am
Hi,
I have updated the ArduinoInfo.Info WIKI page on nRF24L01 HERE: (http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo) to include two example sketches that transmit the position of a  Joystick on one nRF24L01/Arduino to another that receives and displays the X,Y positions.  I have tried to make this as simple as possible.

Also I added a downloadable .PDF with the typical nRF24L01 module pinouts and Arduino connections. I'm always looking for that. 

Hope to add some more examples soon.

Thanks for the Great Library, ManiacBug!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Dec 15, 2013, 06:13 pm
Terry,

Nice writeups on the newbie stuff.. especially the 10uF on the Vcc (3.3) and Gnd, these radios don't requires lots of current but they works much better with a 10uF ... I needed the 10uF only when getting 5V from Pin 10 and a LDO for my nRF adapter...

I wrote this simple serial chat code for a training class using two UNO (and optional 16x2 LCD), 2 nRF24L01 and text input via Serial Monitor ... if you are bored, you can chat with yourself over nRF ...

https://github.com/stanleyseow/RF24/tree/master/examples/nRF24_Serial_Chat

Stanley


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Dec 15, 2013, 06:19 pm

Questions

  • -Is there a version of RF24Network that supoprts ATTiny 85/4?

  • -If not, is it possible?

  • -If possible, are there plans to? and when?

  • -If not possible, is there some way for ATTiny RF24 to participate at least at the leaf level?




The attiny84/85 are NOT using RF24 libs... they are using the smaller size Mirf libs (with less functions.. ) due to the limited flash size of the attinys..

I'll explore the RF24Network one day when I'm free, there seems to be improvements on the RF24Network...

My forks are still behind some of the recent improvements/bug fixes....
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: crofter on Dec 30, 2013, 11:39 pm
To add some extra information to Stanley's reply I can tell you that I have successfully implemented rf24 and rf24network on an attiny84 and was able to connect a DHT11 and a PIR sensor and send the states back to the base-station running on a raspberry pi. In my case the limiting factor was RAM space so I needed to be careful with variable storage. Adding too many serial write debug statements was also enough to make it fail to run. Selecting the right version of the libraries took me a while.

If there is interest I will document how I got it working.

Martin
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: sej7278 on Dec 31, 2013, 12:11 am
crofter - i'd be interested, i've got a similar setup with an atmega328p transmitting to a rpi, but i'd rather use an attiny85
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: RobDrizzle on Jan 01, 2014, 04:36 pm

One other question:  do I need to do anything special to get RF24 running on atmega328 8MHz as opposed to 16MHz? (pro mini)


Nothing special needed... I run NRF24 on 8MHz atmega 328 all the time.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: RobDrizzle on Jan 01, 2014, 04:46 pm
I have an issue where my NRF 2.4 radio has a conflict with another device on the SPI bus. The radio will not properly initialize if the other device is connected (does even have to be powered!) I have the cs, csn on the radio on pins 8,9 and the cs on the other device on 4. Each device was test individually and working.

When the code runs, I get a serial output of all zeros on the radio details and then get repeating:

******WARNING******** Address 177000 not valid    (or maybe is not found, I can't remember)

Has anyone else run into similar conflicts???

The other SPI device is Adafruit's tft screen driver RA8875.

I was using most recent RF24 and RF24network libraries from Maniacbug.

Any help would be greatly appreciated!!!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: tack on Jan 01, 2014, 05:02 pm
Do you have this set up on a breadboard or just sticking jumpers into Arduino headers?

I experieced similar symptom with ethernet shield initially, which cleared up when I mounted the nRF on a proto shield with better connections.

I then moved to custom PCB's with plug in ENC28J60 and everything works fine together.

You could also investigate what speed each library sets the SPI bus, to see if there is any issue there. If a device sets SPI speed and then it is left at a speed the next device doesn't expect then that could cause issues.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: RobDrizzle on Jan 01, 2014, 06:29 pm
great information.

I do have both devices patched through a breadboard and was wondering if the signal was being distorted because of it. My next diagnostic step was to solder connect everything to eliminate that, so it's nice to know that I won't waste my time.

The speed comment is also a really good idea. My only concern is that I know very little about SPI communication so it will have to take some digging to find out where to look and how to change it.

Thank you.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: crofter on Jan 02, 2014, 11:17 pm
@sej7278 .. The steps I went through to get RF24 and RF24Network working on an attiny84 were:

Install the libraries rf24, rf24network and spi  from https://github.com/jscrane
Write the sketch to use the libraries taking care to keep the number of variables small and use the minimum debugging statements possible. I found I was limited by ram rather than program space so I used avr-size and avr-objdump a lot to look at the compiled code to see where all the space was being used. My testing sketch is below, it includes a ram checking routine but calling it too often wastes space. It also includes commented debug statements but if you uncomment one you need to comment others to keep ram usage down. 
Code: [Select]

#include <dht11.h>
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>

#include <TinyDebugSerial.h>
TinyDebugSerial mySerial = TinyDebugSerial(); // PB0 on attiny84

dht11 DHT11;

#define DHT11PIN 9
#define PIRPIN 8

uint8_t pirstate = 0;
uint8_t val = 0;

RF24 radio(7,3);
// Network uses that radio
RF24Network network(radio);

RF24NetworkHeader * myheader;

// Address of our node
const uint16_t this_node = 2;

// Address of the other node
const uint16_t other_node = 0;

unsigned int counter = 0;

unsigned long temp_timeout;
unsigned long pir_timeout;

unsigned long temp_delay = 1000;
unsigned long pir_delay = 500;

// Structure of our temp payload
struct payload_th
{
  uint16_t counter;
  int8_t temp;
  int8_t humidity;
};
// Structure of our pir payload
struct payload_pir
{
  uint16_t counter;
  uint8_t pir_state;
};

bool PIR_state;

int freeRam () {
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}

void setup(void)
{
  uint8_t rf_ch;
 
  mySerial.begin(9600);
  mySerial.println("Start");
 
//  mySerial.print("start ram ");
//  mySerial.println(freeRam());
 
  pinMode(PIRPIN, INPUT);
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
/* 
  rf_ch = radio.getChannel();
  mySerial.print("RF_CH :0x");
  mySerial.println(rf_ch,HEX); 
*/

temp_timeout = millis();
pir_timeout = millis();

}

void loop(void)
{
// Pump the network regularly
  network.update();

// This method used to avoid millis() rollover issues

  if ((unsigned long) millis() - temp_timeout >= temp_delay) {
    checkTemp();
    temp_timeout = temp_timeout + temp_delay;
  }
  if ((unsigned long) millis() - pir_timeout >= pir_delay) {
    checkPIR();
    pir_timeout = pir_timeout + pir_delay;
  }
}

void sendPIR()
{

  counter++;

  payload_pir payload = { counter, pirstate };

  mySerial.print("Sending PIR...");

  RF24NetworkHeader header(/*to node*/ other_node,/*message type*/ '3');
       
  bool ok = network.write(header,&payload,sizeof(payload));
  if (ok)
     mySerial.println("ok.");
  else
     mySerial.println("failed.");

}

void sendTemp()
{

  counter++;

  payload_th payload = { counter, DHT11.temperature, DHT11.humidity };

  mySerial.print("Sending Temp ...");
 
  RF24NetworkHeader header(/*to node*/ other_node,/*message type*/ '2');
       
  bool ok = network.write(header,&payload,sizeof(payload));
  if (ok)
     mySerial.println("ok.");
  else
     mySerial.println("failed.");
 
}

void checkPIR()
{

val = digitalRead(PIRPIN);

  if (val == HIGH)
  {
    if (pirstate == 0)
    {
      mySerial.println("Mot");
      pirstate = 1;
      sendPIR();
    }
  } else {
    if (pirstate == 1)
    {
      mySerial.println("Mot s");
      pirstate = 0;
      sendPIR();
    }
  }

}

void checkTemp()
{

  int chk = DHT11.read(DHT11PIN);

  /*
  mySerial.print("ram ");
  mySerial.println(freeRam());
 
  mySerial.print("Humidity (%): ");
  mySerial.println(DHT11.humidity);
*/
 
  sendTemp();

}

I have created 2 message structures that are used to pass the dht11 data and the pir status. These are mirrored at the base station end where the message type is used to select the correct structure to decode the payload. It also includes a primitive scheduler so that I can vary the rate of sending each type of data.

Hope the above is helpful to you.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Jan 04, 2014, 10:15 am
crofter,

I copy yr code and compiled the attiny84 codes with RF24 and RF24Network and got the following compile error...

Code: [Select]

Arduino: 1.5.5 (Windows 7), Board: "ATtiny84 @ 8 MHz  (internal oscillator; BOD disabled)"

c:/arduino-1.5.5/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: C:\TEMP\build8578025508846758489.tmp/attiny84_RF24network.cpp.elf section .text will not fit in region text
c:/arduino-1.5.5/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: region text overflowed by 704 bytes


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: hengis on Jan 05, 2014, 04:52 am
Hi Guys.  I am having problems compiling Lord Maniacbug's sensornet sketch.  The problem seems to be in prinf.cpp  Where can I get an up to date copy.  It is very difficult for noobs  like me to figure out all the libraries when they are not listed on github.
On the positive side I have got 2 arduinos linked - one sending sensor data to the other.
Any help would be appreciated
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: crofter on Jan 05, 2014, 04:44 pm
Stanley,

Interesting that it won't fit when using your setup. That must mean that either the libraries you are using are producing larger code than mine or your compiler is producing larger code. I have added a routine to read an LDR using an analogue read and send the value in a new structure. The ide says the code is still only 7,284 bytes.
I notice that you are using Windows while I am using Linux .. I wonder if this makes a difference.
If you want to try some comparisons I have create a couple of sketches to test different libraries so that you can compare the size of the code produced.
The first  just uses the DHT11 library and prints out the temp and humidity.
Code: [Select]
//
//   FILE:  dht11_size_test
// PURPOSE: DHT11 library size test sketch
//

#include <TinyDebugSerial.h>
TinyDebugSerial mySerial = TinyDebugSerial(); // PB0 on attiny84

#include <dht11.h>

dht11 DHT11;

#define DHT11PIN 9

void setup()
{
  mySerial.begin(9600);
  mySerial.println("DHT11 TEST PROGRAM ");

}

void loop()
{

  int chk = DHT11.read(DHT11PIN);

  mySerial.println("Read sensor: ");
/*
  switch (chk)
  {
    case DHTLIB_OK:
Serial.println("OK");
break;
    case DHTLIB_ERROR_CHECKSUM:
Serial.println("Checksum error");
break;
    case DHTLIB_ERROR_TIMEOUT:
Serial.println("Time out error");
break;
    default:
Serial.println("Unknown error");
break;
  }
*/
  mySerial.print("Humidity (%): ");
  mySerial.println(DHT11.humidity);

  mySerial.print("Temperature (°C): ");
  mySerial.println(DHT11.temperature);

  delay(2000);
}

On my machine the IDE (1.0.5) says the sketch size is 2,588 bytes

The next sketch uses rf24 to test the rf24 and spi libraries. It is the ping_pong example modified to work on the attiny. I have left the commented code in that I used for debugging.
Code: [Select]
/*
Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
*/

/**
* Use pingpair as a simple sketch to test size of rf24 library
*
*/

#include <SPI.h>
#include <RF24.h>

#include <TinyDebugSerial.h>
TinyDebugSerial mySerial = TinyDebugSerial(); // PB0 on attiny84
//
// Hardware configuration
//

// Set up nRF24L01 radio on SPI bus plus pins 7 & 3

RF24 radio(7,3);

// sets the role of this unit in hardware.  Connect to GND to be the 'pong' receiver
// Leave open to be the 'ping' transmitter
const int role_pin = 9;

//
// Topology
//

// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

//
// Role management
//
// Set up role.  This sketch uses the same software for all the nodes
// in this system.  Doing so greatly simplifies testing.  The hardware itself specifies
// which node it is.
//
// This is done through the role_pin
//

// The various roles supported by this sketch
typedef enum { role_ping_out = 1, role_pong_back } role_e;

// The debug-friendly names of those roles
const char* role_friendly_name[] = { "invalid", "Ping out", "Pong back"};

// The role of the current running sketch
role_e role;

void setup(void)
{
  mySerial.begin( 9600 );    // for tiny_debug_serial
  mySerial.println("Start of setup");
  //
  // Role
  //

  // set up the role pin
  pinMode(role_pin, INPUT);
  digitalWrite(role_pin,HIGH);
  delay(20); // Just to get a solid reading on the role pin

  // read the address pin, establish our role
  if ( digitalRead(role_pin) )
    role = role_ping_out;
  else
    role = role_pong_back;

  //
  // Print preamble
  //


  mySerial.println("RF24 size test");
  mySerial.print("ROLE: ");
  mySerial.println(role_friendly_name[role]);
  //
  // Setup and configure rf radio
  //

  radio.begin();

  // optionally, increase the delay between retries & # of retries
  // radio.setRetries(15,15);

  // optionally, reduce the payload size.  seems to
  // improve reliability
  // radio.setPayloadSize(8);

  //
  // Open pipes to other nodes for communication
  //

  // This simple sketch opens two pipes for these two nodes to communicate
  // back and forth.
  // Open 'our' pipe for writing
  // Open the 'other' pipe for reading, in position #1 (we can have up to 5 pipes open for reading)

  if ( role == role_ping_out )
  {
    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
  }
  else
  {
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe(1,pipes[0]);
  }

  //
  // Start listening
  //
  // if( radio.setDataRate( RF24_250KBPS ) ) {
  //   mySerial.print( "Data rate 250KBPS set!\n\r" ) ;
  // } else {
  //   mySerial.print( "Data rate 250KBPS set FAILED!!\n\r" ) ;
  // }
  // radio.setDataRate( RF24_2MBPS ) ;
  // radio.setPALevel( RF24_PA_MAX ) ;
  radio.enableDynamicPayloads() ;
  radio.setAutoAck( true ) ;
  radio.powerUp() ;
  radio.startListening();

  //
  // Dump the configuration of the rf unit for debugging
  //

  // radio.printDetails();
  // Print out register readinds for important settings
  uint8_t rf_ch, rf_setup = 0;
  byte tx_addr[5];
  byte rx_addr[5];
 
  rf_ch = radio.getChannel();
  //radio.read_register(RF_SETUP, &rf_setup, sizeof(rf_setup));
  //radio.read_register(TX_ADDR, tx_addr, sizeof(tx_addr));
  //radio.read_register(RX_ADDR_P1, rx_addr, sizeof(rx_addr));
   
  mySerial.println();
  mySerial.println("My version 1");
  mySerial.print("RF_CH :0x");
  mySerial.println(rf_ch,HEX); 
 
//  mySerial.print("RF_SETUP :0x");
//  mySerial.println(rf_setup,HEX); 
 
//  mySerial.print("TX_ADDR :");
//  for ( int i=0;i<5;i++ ) {  // Loop 5 times, print in HEX
//  mySerial.print( tx_addr[i], HEX);
//  }
//  mySerial.println();
 
//  mySerial.print("RX_ADDR :");
//  for ( int i=0;i<5;i++ ) {  // Loop 5 times, print in HEX
//  mySerial.print( rx_addr[i], HEX);
//  }
//  mySerial.println();
 
  delay(1000);      // For serial debug to read the init config output
   
}

void loop(void)
{
  //
  // Ping out role.  Repeatedly send the current time
  //

  if (role == role_ping_out)
  {
    // First, stop listening so we can talk.
    radio.stopListening();

    // Take the time, and send it.  This will block until complete
    unsigned long time = millis();
    mySerial.print("Now sending ");
    mySerial.println(time);
    radio.write( &time, sizeof(unsigned long) );

    // Now, continue listening
    radio.startListening();

    // Wait here until we get a response, or timeout (250ms)
    unsigned long started_waiting_at = millis();
    bool timeout = false;
    while ( ! radio.available() && ! timeout )
      if (millis() - started_waiting_at > 1+(radio.getMaxTimeout()/1000) )
        timeout = true;

    // Describe the results
    if ( timeout )
    {
      mySerial.print("Failed, response timed out.");
      mySerial.print("Timeout duration: ") ;
      mySerial.println((1+radio.getMaxTimeout()/1000) ) ;
    }
    else
    {
      // Grab the response, compare, and send to debugging spew
      unsigned long got_time;
      radio.read( &got_time, sizeof(unsigned long) );

      // Spew it
      mySerial.print("Got response ");
      mySerial.print(got_time);
      mySerial.print("  round-trip delay: ");
      mySerial.println(millis()-got_time);
    }

    // Try again 1s later
    delay(1000);
  }

  //
  // Pong back role.  Receive each packet, dump it out, and send it back
  //

  if ( role == role_pong_back )
  {
    // if there is data ready
    if ( radio.available() )
    {
      // Dump the payloads until we've gotten everything
      unsigned long got_time;
      bool done = false;
      while (!done)
      {
        // Fetch the payload, and see if this was the last one.
        done = radio.read( &got_time, sizeof(unsigned long) );
      }

      // First, stop listening so we can talk
      radio.stopListening();

      // Send the final one back. This way, we don't delay
      // the reply while we wait on serial i/o.
      radio.write( &got_time, sizeof(unsigned long) );
      mySerial.print("Sent response ");
      mySerial.println(got_time);
      // Now, resume listening so we catch the next packets.
      radio.startListening();
    }
  }
}

The ide reports a size of 5,608.

I hope the above helps you determine why your code is larger.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Jan 07, 2014, 06:01 pm
Quote

Interesting that it won't fit when using your setup. That must mean that either the libraries you are using are producing larger code than mine or your compiler is producing larger code. I have added a routine to read an LDR using an analogue read and send the value in a new structure. The ide says the code is still only 7,284 bytes.
I notice that you are using Windows while I am using Linux .. I wonder if this makes a difference.
If you want to try some comparisons I have create a couple of sketches to test different libraries so that you can compare the size of the code produced.
The first  just uses the DHT11 library and prints out the temp and humidity.


Crofter,

Which RF24 library forks are you using ?

I knew there is one of the forks that removed all the debugging / PRINTF stuff to make the codes smaller...

Stanley

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: crofter on Jan 08, 2014, 10:07 pm
Quote
Which RF24 library forks are you using ?

I knew there is one of the forks that removed all the debugging / PRINTF stuff to make the codes smaller...


As I put in my original message I am using the fork from https://github.com/jscrane . I think the rf24 library is unmodified from the version at https://github.com/gcopeland/RF24 . The page http://maniacalbits.blogspot.co.uk/2013/04/new-rf24-driver-release-fork.html has a good description of the changes he has made.

In some tests today I found that rf24network was calling radio.printdetails() even though the print statements were not correct for attiny debugging. By commenting out this call I was able to save 232 bytes of code and some RAM as well. It may not sound much but that allowed me to add code to receive a ping and send a pong back with time stamps.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: mcnobby on Jan 09, 2014, 10:42 pm
I couldnt get RF24 to work with ATTINY85, tried the SPI85 & RF24-85 libraries, lots of messing around and still nothing

I worry that I have got too many variations of RF24 stuff in my libraries now

I just want something that works :@(
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: crofter on Jan 10, 2014, 02:48 pm

I worry that I have got too many variations of RF24 stuff in my libraries now


The reason I used the jscrane libraries was because he had rf24, rf24network and spi85 all in one place so I knew (hoped) they worked together. I removed all the other versions of he libraries I had tried and just left those 3. They work fine for both the attiny and the mega2560. I'm sure other versions of the libraries will work fine as long as the versions are compatible.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: tapsa on Jan 11, 2014, 03:27 pm
I have nano v3 and nano v4 arduinos and nRF24L01+ chips

I have now checked my connections abount ~8 times and tried different tricks over 10hour.
My problem is that I dont get even pong test to work.

Both say this in start:

Code: [Select]

RF24/examples/GettingStarted/
ROLE: Pong back
*** PRESS 'T' to begin transmitting to the other node
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0d2 0xf0f0f0f0d2
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0xf0f0f0f0d2
RX_PW_P0-6       = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA            = 0x3f
EN_RXADDR        = 0x03
RF_CH            = 0x4c
RF_SETUP         = 0x23
CONFIG           = 0x6f
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 250KBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_LOW


And when I change another to ping mode it says that:
Code: [Select]

*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK
Now sending 193821...failed.
Failed, response timed out.
Now sending 195111...failed.
Failed, response timed out.
Now sending 196402...failed.
Failed, response timed out.
Now sending 197692...failed.
Failed, response timed out.




Another device does not do anything when another device try send data.
Any ideas?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: crofter on Jan 11, 2014, 04:53 pm


Code: [Select]


RX_ADDR_P0-1     = 0xf0f0f0f0d2 0xf0f0f0f0d2
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0xf0f0f0f0d2



I find those addresses a bit odd. I am not sure exactly which example you are using but it looks like both ends of your link have the same address which is obviously wrong. In the pingpair example you have the line
Code: [Select]
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
which gives the 2 addresses .. the pingout transmits on xxxxE1 and receives on xxxxD2 and the other end does the opposite.
If I do the test on my system I get
Code: [Select]

ROLE: Ping out
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5     = 0xc3 0xc4 0x02 0x70
TX_ADDR          = 0xf0f0f0f0e1

Hope that helps
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: tapsa on Jan 12, 2014, 05:24 am
Looks that some times in boot it gives it wrong.
in code it is
const uint64_t pipes[2] = {  0xF0F0F0F0E1LL,0xF0F0F0F0D2LL };
I use gettingstarted sample from RF24 lib

Anyhow by code it looks that when I press T it will change it. So now I also add info print after each role change.
Code: [Select]

*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK
STATUS   = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0e1 0xf0f0f0f0d2
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR   = 0xf0f0f0f0e1
RX_PW_P0-6  = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA    = 0x3f
EN_RXADDR   = 0x03
RF_CH    = 0x4c
RF_SETUP  = 0x23
CONFIG   = 0x0f
DYNPD/FEATURE    = 0x00 0x00
Data Rate   = 250KBPS
Model    = nRF24L01+
CRC Length  = 16 bits
PA Power  = PA_LOW
Now sending 18038...failed.
Failed, response timed out.
Now sending 19332...failed.
Failed, response timed out.
Now sending 20622...failed.
Failed, response timed out.
Now sending 21911...failed.
Failed, response timed out.
Now sending 23200...failed.
Failed, response timed out.
Now sending 24489...failed.
Failed, response timed out.
*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK
STATUS   = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xf0f0f0f0d2 0xf0f0f0f0e1
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR   = 0xf0f0f0f0d2
RX_PW_P0-6  = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA    = 0x3f
EN_RXADDR   = 0x03
RF_CH    = 0x4c
RF_SETUP  = 0x23
CONFIG   = 0x0f
DYNPD/FEATURE    = 0x00 0x00
Data Rate   = 250KBPS
Model    = nRF24L01+
CRC Length  = 16 bits
PA Power  = PA_LOW



Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: tapsa on Jan 13, 2014, 11:04 pm
I finally solve that problem. After ~12h debugging I notice in http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo  "but the high-power versions must have a separate 3.3V supply"
So I connect 4.7uF capacitor to 3.3v pin and wohaa it works!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: sej7278 on Feb 11, 2014, 10:24 am
anyone tried controlling power to the nrf24l01+ off using a p-channel mosfet?

i'm doing that at the moment and it never seems to wake up again. i've tried copying the init code into the loop() from setup() but it makes no difference:

Code: [Select]

void loop(void)
{
    // power on sensors using mosfet
    digitalWrite(2,LOW);

    // init radio for writing
    radio.begin();
    radio.enableDynamicPayloads();
    radio.setAutoAck(1);
    radio.setRetries(15,15);
    radio.setDataRate(RF24_250KBPS);
    radio.setPALevel(RF24_PA_MAX);
    radio.setChannel(76);
    radio.openWritingPipe(0xF0F0F0F0E1LL);
    radio.powerUp();

    .....blah....

    // transmit
    radio.write(&txBuffer, strlen(txBuffer));
   
    // power off sensors
    radio.powerDown();
    digitalWrite(2,HIGH);

    // sleep mcu for 30secs
    Sleepy::loseSomeTime(30000);
}


i can see the power pins on the nrf24l01+ switching between 3.3v and about 0.7v (not sure why that's not exactly 0v when the fet switches off) so i assume either the rf24 doesn't like a sudden voltage drop, or there's some library calls i need to re-awaken it.

note that if i comment out the digitalWrite(2,HIGH); to turn off the fet, things work fine and my raspberry pi receives the data from the arduino.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Feb 15, 2014, 04:23 am
Not sure what r u trying to achieve but the radio.powerdown and radio.powerup shd put the radio is a very low power mode..

therefore no need to off the radio...


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Feb 22, 2014, 07:03 pm
With a help of a student to draw/design the PCB, we made an Tiny nRF V1.0 running on attiny84 with nRF24L01+ running on 2 x AA batteries..

The codes are located at my blog :-
http://arduino-for-beginners.blogspot.com/2013/08/getting-nrf24l01-to-work-with-attiny84.html
(http://arduino-for-beginners.blogspot.com/2013/08/getting-nrf24l01-to-work-with-attiny84.html)

Testing working on Mirf libs, will test the RF24Network with these board soon...

(http://farm4.staticflickr.com/3758/12700701585_491d93ff84.jpg) (http://www.flickr.com/photos/stanleyseow/12700701585/)

(http://farm3.staticflickr.com/2883/12701182334_3bf77f443b.jpg) (http://www.flickr.com/photos/stanleyseow/12701182334/)




Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: cortinas on Mar 28, 2014, 12:10 am
Hi

I have been using nRF24l01+ radios very successfully on various arduino based platform (uno, nano and yun).

Recently I built a custom board ---- but needed to change the SPI speed settings in the RF24 lib  to get reliable operation - i.e. not losing data.
Custom board has a 328p running at 16Mhz. It seems that the 328p SPI master was overloading the nrf radio side
I have also seen situations where the sender (TX side) does a radio.write which returns a TX_FAIL --- but the message has been received on the receiver side.

So:
Has anyone else seen such behaviour - where the SPI speed needs to be reduced to ensure reliable operation.

Also:
What is the implication of having more than 6 transmitters (with one receiver). I assume that once the TX radios are not simultaneously broadcasting on the same pipe then it will work. (note, I use the data payload to identify which radio is sending)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: juma394 on Apr 19, 2014, 04:06 pm
I want to ask something about the difference between MIRF & RF24-master library.
Are the difference of them just on CE & CSN pin? (9->8 & 10->7)? or there are another difference?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Apr 21, 2014, 05:38 pm
Quote

I want to ask something about the difference between MIRF & RF24-master library.
Are the difference of them just on CE & CSN pin? (9->8 & 10->7)? or there are another difference?

The CE & CSN pins are configurable/programmable ..

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: steveppp on Apr 26, 2014, 07:20 pm
Hello,
I use Arduino Mega2560 and nRF24L01+
and latest IDE Arduino 1.0.5-r2.

Everything worked fine until I decided to save SRAM
by moving all strings to PROGMEM using this macro I found here:
http://web.archiveorange.com/archive/v/9kgcbyrylQlWrNyNBOjW
class __FlashStringHelper;
#define F(str) reinterpret_cast<__FlashStringHelper *>(PSTR(str))

Then, I can use F(str) in my code like this:
Serial.println(F("Failed to read from DHT22"));
and move this string into PROGMEM from RAM.

Ok. Everything worked fine. I saved a lot of RAM.

Then I added RF24 library from here
https://github.com/maniacbug/RF24
and got this error:
" reinterpret_cast from type 'const char*'
to type '__FlashStringHelper*' casts away constness "

And compiling of my code stopped.
Please, help me.
Thank you.

P.S.
When I include Mirf library from here:
https://github.com/stanleyseow/arduino-nrf24l01
no errors appear. But I am not accustomed to Mirf library yet.
It's a very low level hardware library.

regards
Steve
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on May 08, 2014, 08:03 pm


The next sketch uses rf24 to test the rf24 and spi libraries. It is the ping_pong example modified to work on the attiny. I have left the commented code in that I used for debugging.



Dear crofter,

I finally got the pingpair working, 1 side is UNO and the other side is attiny84 running on RF24 ..

Stanley
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: dertester on Jun 11, 2014, 12:44 am
Hey, maybe you can help me here.

Installed the lib, wired up to Atmega328 and changed pin 9,10 (15,16) to 8,7(14,15).

I get the following Info but only timed out when going to Transmit mode

Code: [Select]

////////NODE1
RF24/examples/GettingStarted/
ROLE: Pong back
*** PRESS 'T' to begin transmitting to the other node
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0xe7e7e7e7e7
RX_PW_P0-6       = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA            = 0x3f
EN_RXADDR        = 0x03
RF_CH            = 0x02
RF_SETUP         = 0x0f
CONFIG           = 0x08
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 2MBPS
Model            = nRF24L01
CRC Length       = 8 bits
PA Power         = PA_HIGH


//////NODE2
RF24/examples/GettingStarted/
ROLE: Pong back
*** PRESS 'T' to begin transmitting to the other node
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR          = 0xe7e7e7e7e7
RX_PW_P0-6       = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA            = 0x3f
EN_RXADDR        = 0x03
RF_CH            = 0x02
RF_SETUP         = 0x0f
CONFIG           = 0x08
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 2MBPS
Model            = nRF24L01
CRC Length       = 8 bits
PA Power         = PA_HIGH

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haydent on Jun 11, 2014, 02:11 am
If you are having trouble and are running bare bones (ie just atmel chip, no arduino), maybe you need decoupling capacitors like me.

I didnt realise i needed them as everything worked normal until in part of my development i started to loose packets.

Such a simple yet profound difference. I put a .1uF cap accross the 328p Vcc & Gnd.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haydent on Jun 11, 2014, 02:14 am

Also:
What is the implication of having more than 6 transmitters (with one receiver). I assume that once the TX radios are not simultaneously broadcasting on the same pipe then it will work. (note, I use the data payload to identify which radio is sending)


i do this fine, just put a small delay between each transmitter.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haydent on Jun 11, 2014, 02:20 am

anyone tried controlling power to the nrf24l01+ off using a p-channel mosfet?

i'm doing that at the moment and it never seems to wake up again. i've tried copying the init code into the loop() from setup() but it makes no difference:

Code: [Select]
...


i can see the power pins on the nrf24l01+ switching between 3.3v and about 0.7v (not sure why that's not exactly 0v when the fet switches off) so i assume either the rf24 doesn't like a sudden voltage drop, or there's some library calls i need to re-awaken it.

note that if i comment out the digitalWrite(2,HIGH); to turn off the fet, things work fine and my raspberry pi receives the data from the arduino.


i do this fine with a PNP transistor and resistor, as the PA powered version chews alot of power in if in idle/sleep mode. too much for battery arduino using sleep.

the trick is to switch the radios vcc with it and use this code to reinit the radio once you power it back up:

Code: [Select]
void radioStart(void) {

  digitalWrite(5, LOW); 
  delay(100);

  radio.begin();
  network.begin(channel, this_node);
  radio.setPALevel(RF24_PA_LOW);//-12dbm
  radio.setDataRate(RF24_250KBPS); 

}
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haydent on Jun 11, 2014, 02:25 am

Not sure what r u trying to achieve but the radio.powerdown and radio.powerup shd put the radio is a very low power mode..

therefore no need to off the radio...


if you are using the PA version on battery it is critical
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haydent on Jun 11, 2014, 02:29 am


One other question:  do I need to do anything special to get RF24 running on atmega328 8MHz as opposed to 16MHz? (pro mini)


Nothing special needed... I run NRF24 on 8MHz atmega 328 all the time.


same, i run 8mz and 2 AA battery fine with the PA version
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haydent on Jun 11, 2014, 02:30 am

I have an issue where my NRF 2.4 radio has a conflict with another device on the SPI bus. The radio will not properly initialize if the other device is connected (does even have to be powered!) I have the cs, csn on the radio on pins 8,9 and the cs on the other device on 4. Each device was test individually and working.

When the code runs, I get a serial output of all zeros on the radio details and then get repeating:

******WARNING******** Address 177000 not valid    (or maybe is not found, I can't remember)

Has anyone else run into similar conflicts???

The other SPI device is Adafruit's tft screen driver RA8875.

I was using most recent RF24 and RF24network libraries from Maniacbug.

Any help would be greatly appreciated!!!


i had a conflict with 5110 LCD sharing pins. i ended up getting around it by specifying seperate pins to the radio in the lcd lbrary init function, rather than try to debug the librarys to find the clash.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haydent on Jun 11, 2014, 03:24 am
also i use and recommend this fork over base: https://github.com/gcopeland/RF24
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: robert_drescher on Jul 04, 2014, 03:50 pm
Hi there,
I'm having some troubles using the testCarrier and testRPD functions.

In the scanner example, the testCarrier function is used and the data rate is left at default (1 MBPS). It picks up more or less constant chatter on some frequencies as expected.
If I change the data rate to 250 KBPS, nothing is detected, even though I have another nRF24L01+ next to me sending at 250 KBPS constantly.

The getting started example works fine, both with 250 KBPS as with 1MBPS.

Any ideas?
I really need the low Data Rate for range and the RPD for adaptive frequency hopping.

Thanks,
Robert
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haydent on Jul 05, 2014, 01:58 am
not sure.

But im also wondering if anyone has the equipment to test the actual power output of the PA+LA models ?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: chucky4444 on Jul 08, 2014, 09:05 pm
Hello Stanley,

I am trying to compile that sketch to upload it to an attiny but it has 8.570 bytes. I have the jscrane libraries (SPI, RF24 and RF24Network from his website https://github.com/jscrane?tab=repositories) and there is no way to make the sketch smaller. Even leaving just the code for the PIR is more than 8k. I am using Arduino 1.0.5 and a Mac (not sure if that makes any difference).

How did you manage to fit it? thanks
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: chucky4444 on Jul 08, 2014, 09:11 pm
Nevermind, I finally made it. Just had to compile choosing the Attiny board, I thought that didn't make any difference.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: chucky4444 on Jul 10, 2014, 03:02 am
By the way, I still didn't managed to make it work on the Attiny85. I am using a simple sketch where at the moment just sends a 1 or a 0 to the base. Since I disconnected the PIR, I just want to see that it sends properly. This is the code, I can't see what I am doing wrong. I have the SPI, RF24 and RF24Network libraries of Jscrane.  Most of the code is commented as I just want to make it work for now. I don't have any compilation errors. On the Arduino Uno it works fine.

Code: [Select]
//#include <dht11.h>
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>

//#include <TinyDebugSerial.h>
//TinyDebugSerial mySerial = TinyDebugSerial(); // PB0 on attiny84

//dht11 DHT11;
//
//#define DHT11PIN 9
//#define PIRPIN 4

uint8_t pirstate = 0;
uint8_t val = 0;

RF24 radio(PB3,PB4);
//RF24 radio(9,10);
// Network uses that radio
RF24Network network(radio);

RF24NetworkHeader * myheader;

// Address of our node
const uint16_t this_node = 2;

// Address of the other node
const uint16_t other_node = 0;

unsigned int counter = 0;

unsigned long temp_timeout;
unsigned long pir_timeout;

unsigned long temp_delay = 1000;
unsigned long pir_delay = 500;

// Structure of our temp payload
//struct payload_th
//{
//  uint16_t counter;
//  int8_t temp;
//  int8_t humidity;
//};
// Structure of our pir payload
struct payload_pir
{
  uint16_t counter;
  uint8_t pir_state;
};

bool PIR_state;

int freeRam () {
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}

void setup(void)
{
  uint8_t rf_ch;
 
//  mySerial.begin(9600);
//  mySerial.println("Start");
// 
//  mySerial.print("start ram ");
//  mySerial.println(freeRam());
 
//  pinMode(PIRPIN, INPUT);
 
  SPI.begin();
  radio.begin();
  network.begin(/*channel*/ 90, /*node address*/ this_node);
/* 
  rf_ch = radio.getChannel();
  mySerial.print("RF_CH :0x");
  mySerial.println(rf_ch,HEX); 
*/

//temp_timeout = millis();
pir_timeout = millis();

}

void loop(void)
{
// Pump the network regularly
  network.update();

// This method used to avoid millis() rollover issues

//  if ((unsigned long) millis() - temp_timeout >= temp_delay) {
//    checkTemp();
//    temp_timeout = temp_timeout + temp_delay;
//  }
  if ((unsigned long) millis() - pir_timeout >= pir_delay) {
    checkPIR();
    pir_timeout = pir_timeout + pir_delay;
  }
}

void sendPIR()
{

  counter++;

  payload_pir payload = { counter, pirstate };

//  mySerial.print("Sending PIR...");

  RF24NetworkHeader header(/*to node*/ other_node,/*message type*/ 3);
       
  bool ok = network.write(header,&payload,sizeof(payload));
//  if (ok)
//     mySerial.println("ok.");
//  else
//     mySerial.println("failed.");
//
}

//void sendTemp()
//{
//
//  counter++;
//
//  payload_th payload = { counter, DHT11.temperature, DHT11.humidity };
//
//  mySerial.print("Sending Temp ...");
// 
//  RF24NetworkHeader header(/*to node*/ other_node,/*message type*/ '2');
//       
//  bool ok = network.write(header,&payload,sizeof(payload));
//  if (ok)
//     mySerial.println("ok.");
//  else
//     mySerial.println("failed.");
// 
//}

void checkPIR()
{

// val = digitalRead(PIRPIN);

  if (val == HIGH)
  {
//    if (pirstate == 0)
//    {
//      mySerial.println("Mot");
      pirstate = 1;
//      sendPIR();
    }else (pirstate=0);
      sendPIR();

//  } else {
//    if (pirstate == 1)
//    {
////      mySerial.println("Mot s");
//      pirstate = 0;
//      sendPIR();
//    }
//  }

}

//void checkTemp()
//{
//
//  int chk = DHT11.read(DHT11PIN);
//
//  /*
//  mySerial.print("ram ");
//  mySerial.println(freeRam());
// 
//  mySerial.print("Humidity (%): ");
//  mySerial.println(DHT11.humidity);
// */
// 
//  sendTemp();
//
//}
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: mcnobby on Aug 11, 2014, 09:53 pm
Hi All, here is a question :

I have a project where I set a receive channel the same as the transmit channel, and set the pipe addresses the same too, set all the doo's and the daah's, the datarate, payload size the same etc etc...

The transmitter is a 328 with a nrf24l01 using RF24
The receiver is a 85 with a nrf24l01 using a modified SPI85 and RF24

I know I am getting a carrier signal on that channel...       if ( radio.testCarrier() ) { thumbsUp; }
If I get a carrier should that also mean I would get the data if I have matched everything ?

The only thing I can think of is the 328-RF24 and the 85-RF24 deal with the pipe-address differently
Both TX and RX use 0xF0F0F0F0E1LL as the pipe address

Any ideas anyone, before I pull the last of my greying hair out ?? :)

Thanks in advance

EDIT : Incidentally, the ONLY library that I could get anything to work with on 85 is this https://github.com/WSUEECSEE5851213Team12/haf/tree/master/ATtiny/libraries (https://github.com/WSUEECSEE5851213Team12/haf/tree/master/ATtiny/libraries)
I also used a hardware mod/hack to free up pins  http://nerdralph.blogspot.co.uk/2014/01/nrf24l01-control-with-3-attiny85-pins.html (http://nerdralph.blogspot.co.uk/2014/01/nrf24l01-control-with-3-attiny85-pins.html)
I have modified both so that the 85 controls CE, and the CSN comes from the hack, this works for me and leaves me with one pin on the 85 (rather than use the reset/1) which is all I need
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: stan001 on Aug 14, 2014, 09:03 am
My journey into making a nRF24L01 adapter for UNO with lots of pictures...

http://arduino-for-beginners.blogspot.com/2014/08/arduino-uno-nrf-adapter.html



Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: xavbabe on Sep 18, 2014, 09:12 pm
Hi, nooby question here:
Which way round does the capacitor go across gnd and 3v3?
Thanks!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: NikWing on Nov 17, 2014, 05:38 pm
hey all!

I've googled a lot today but didn't find a solution yet
I'm testing a 2.2" tft from china and the nrf24l01+ connected to an arduino uno
both devices work without the other connected
but the moment I start the radio (radio.begin();) it's impossible to display anything on the tft

from what I can tell: it must be software-related and probably the rf24/nrf24 part, tried different ports for cs/csn/reset (non-SPI related ports)
disconnected devices, different power sources etc etc
as soon as the radio.begin is called, the tft won't accept anything
no matter if I use ucglib or adafruit's lib

anyone ever had that problem before and knows how to fix it?

in the meantime (tomorrow) I'll try a new rf24 lib I've found a min ago, updated in Nov 2014.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: doctor_t on Nov 17, 2014, 08:52 pm
Hi guys,

i undrestand that on this post you know much more than me about how to use the tranciever nRF24 and I would ask your help with my problem

thank you for your time

i wrote everything on this post

RF24 + Polar heartrate (http://forum.arduino.cc/index.php?topic=279448.new#new)
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: grahamed on Nov 21, 2014, 06:28 pm
Hi

I hope I am posting correctly here....

I am using the ManiacBug library many times between many Arduinos with no problem except ....if I try to use the "payload in ack method" it does not work unless I dis CE from 9 and take it to VCC, on the "sender"  then all works OK. If I do this with any board using the normal transmit/turnaround method it stops working (as I would expect).

Am I missing something?

Thanks.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: gregsie on Dec 29, 2014, 12:00 am
First let me say thanks to maniacbug for the GREAT library!

I've playing around with these modules for a few weeks and decided to base my sensor xmitters on the pingpair_sleepy example.  I wanted to reduce power consumption as much as possible.

I came across a problem in the pingpair_sleepy example provided with RF24.  The ping out would only work once.

    // Power down the radio.  Note that the radio will get powered back up
    // on the next write() call.
    radio.powerDown();

When the radio was powered down, it would never come back.  Commenting out radio.powerDown(); OR adding radio.powerUp() before the radio.write call in the example works.

Maybe there's a bug that assumes a write will always powerup first.

I hope this helps someone!

My sensor works well now and draws ~20ma idle (4secs) and ~35ma (1sec) when sending data.

Thanks.


I think you might be on to something with the radio.powerUp/Down call. I've battled with the examples in the library for a day or so with no success. I decided to try this post instead:
http://shanes.net/another-nrf24l01-sketch-string-sendreceive/ (http://shanes.net/another-nrf24l01-sketch-string-sendreceive/)
and it worked like a charm. The devices I have are all nrf24l01+ so this might have something to do with it. Now I use a 1mS delay and the powerUp() and powerDown() calls after each tx and the receiver never drops a packet.
Happy days :)
ta
GregW
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: plamba on Jan 04, 2015, 11:26 pm
Hi. I got the joystick example working the way it's described here (http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo). However, I'm having issues trying to integrate it with another project (2WD robot). When I come back to the joystick example, I notice that this example doesn't seem to work for me unless I wire the green (pin 13), gray (pin A2), blue (pin 11) and violet (pin 12) cables, even though they don't appear to play any role in this example. Any idea why? Are these pins reserved pins for the RF24 library? Do all of the wires in the example have to be connected even though my example isn't using them? In particular, what I am seeing is that when I integrate the NRF24L01+  to my existing circuit, it seems to be pulling pins 10 and 11 high, thereby causing the existing project (robot) to malfunction. Thanks for your help.

UPDATE #1
If I connect the nRF24L01+ exactly as described in the example (same pins on the Arduino), I no longer get issues with the existing project that I'm trying to add the wireless module to. Yet, the wireless transmission doesn't work. Worth noting: I was using Nanos to prototype the joystick example. And I noticed that the Nano's 3v3 pin provides 3.36v. The existing project that I'm trying to integrate with the nRF24L01+ is on an Arduino Uno, whose 3v3 pin provides 3.29v. I might try switching my existing project to Nano unless I can think of a reason not to.

UPDATE #2
I used a 10k trimpot to create a voltage divider off the 5v Arduino pin, so as to supply exactly 3.36v to the nRF24L01+, as the Nano was doing. But, that still did not get the wireless communication working. Again, please note that I've confirmed that the nRF24L01+ modules are both working - by connecting them to Nanos and using the simple joystick example.

UPDATE #3
I finally got this working. Didn't have to do anything special. I did use the library's "Getting Started" example against the Uno. I don't know if that example somehow reset something on the Uno, but after that the nRF24L01+ integrated well with my 2WD robot and sent signal reliably to my receiver nRF connected to a Nano.

Your ideas, comments, observations are most welcome and highly appreciated.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: elaerico on Jan 07, 2015, 10:00 am
Hi. I got the joystick example working the way it's described here (http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo). However, I'm having issues trying to integrate it with another project. When I come back to the joystick example, I notice that this example doesn't seem to work for me unless I wire the green (pin 13), gray (pin A2), blue (pin 11) and violet (pin 12) cables, even though they don't appear to play any role in this example. Any idea why? Are these pins reserved pins for the RF24 library? Do all of the wires in the example have to be connected even though my example isn't using them? In particular, what I am seeing is that when I integrate the NRF24L01+  to my existing circuit, it seems to be pulling pins 10 and 11 high, thereby causing the existing project (robot) to malfunction. Thanks for your help.

UPDATE #1
If I connect the nRF24L01+ exactly as described in the example (same pins on the Arduino), I no longer get issues with the existing project that I'm trying to add the wireless module to. Yet, the wireless transmission doesn't work. Worth noting: I was using Nanos to prototype the joystick example. And I noticed that the Nano's 3v3 pin provides 3.36v. The existing project that I'm trying to integrate with the nRF24L01+ is on an Arduino Uno, whose 3v3 pin provides 3.29v. I might try switching my existing project to Nano unless I can think of a reason not to.

UPDATE #2
I used a 10k trimpot to create a voltage divider off the 5v Arduino pin, so as to supply exactly 3.36v to the nRF24L01+, as the Nano was doing. But, that still did not get the wireless communication working. Again, please note that I've confirmed that the nRF24L01+ modules are both working - by connecting them to Nanos and using the simple joystick example.

Your ideas, comments, observations are most welcome and highly appreciated.

Hi plamba. As you can see in the example, the pin 10 and 11 are used for the SPI interface, the 10 for CSN and the 11 for MOSI. The pin 10 is configurable, you can use any free gpio pin of your arduino for CE and CSN, and is setted when you create an instance of RF24 object (RF24 radio(A0,A1); //CE,CSN)  in example.
Hope this works!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: elaerico on Jan 07, 2015, 10:03 am
Hi, I'm starting to use this modules for controlling a model helicopter.
I have a MEGA and a UNO. Put one module on each, and try the PINGPAIR example from the maniacbug library, and worked like a charm. Then I tried to work on my own code. One master(UNO), sending a number each cicle bigger, and in the slave(MEGA), receive the number, and if its odd, turn on a led, else, turn it off.
So I was trying it, but the communication gets incredible unreliable, and the led stops blinking for 2 seconds in random intervals, often each 2 or 3 seconds.
This is very rare becouse with the pingpair example works excellent, never miss a data, even when the delay sending the new data is far more fast than in my own code.
Can you give me a hand on this? I put the code, and thanks!!

Here is the master:

Code: [Select]

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

//
// Hardware configuration
//

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10

RF24 radio(8,10);  //CE, CSN


const uint64_t pipe = 0xF0F0F0F0E1LL;

unsigned long led_state;


void setup() {
  Serial.begin(115200);
  
  radio.begin();
  //radio.setPayloadSize(8);
  radio.openWritingPipe(pipe);
  led_state = 0;
  

}

void loop() {
    
  
  radio.write(&led_state,sizeof(unsigned long));
  led_state++;
  delay(100);

  Serial.println(led_state);

}


And the Slave:

Code: [Select]

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"


RF24 radio(A0,A1);  //CE, CSN


// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipe = 0xF0F0F0F0E1LL;

unsigned long led_state;


void setup() {
    Serial.begin(115200);
    
    pinMode(2,OUTPUT);
    digitalWrite(2,HIGH);
    radio.begin();

    //radio.setPayloadSize(8);
    radio.openReadingPipe(1,pipe);

    
    radio.startListening();
    


}



void loop() {
    if (radio.available()){
        bool done = false;
        while(!done) {
      
        done = radio.read(&led_state,sizeof(unsigned long));
        
        Serial.println(led_state);
        
         }
    
    }
    if (led_state%2) digitalWrite(2,LOW);
    
    else digitalWrite(2,HIGH);
    
    
      
}



Again, thanks a lot!!
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Juupke1981 on Jan 23, 2015, 09:52 pm
Hi All,

I'm trying to read out my Philips TV remote with a  nRF24L01(+). I found out that the channel is 25 but I can't find the pipe adress. I used the Nordic Fob code to scan for the pipeaddress:

Code: [Select]
/*
 Copyright (C) 2012 J. Coliz <maniacbug@ymail.com>

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 */

/**
 * Example Nordic FOB Receiver
 *
 * This is an example of how to use the RF24 class to receive signals from the
 * Sparkfun Nordic FOB.  Thanks to Kirk Mower for providing test hardware.
 *
 * See blog post at http://maniacbug.wordpress.com/2012/01/08/nordic-fob/
 */

#include <SPI.h>
#include <RF24.h>
#include "nRF24L01.h"
#include "printf.h"

//
// Hardware configuration
//

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10

RF24 radio(9,10);


struct payload_t
{
  uint8_t b1;
  uint8_t b2;
  uint8_t b3;
  uint8_t b4;
};

//
// Setup
//

void setup(void)
{
  //
  // Print preamble
  //

  Serial.begin(57600);
  printf_begin();
  printf("\r\nRF24/examples/nordic_fob/\r\n");

  //
  // Setup and configure rf radio according to the built-in parameters
  // of the FOB.
  //

  radio.begin();
  radio.setAutoAck(false);
  radio.setChannel(25);
  radio.setPayloadSize(8);

  radio.setCRCLength(RF24_CRC_16);
 // radio.openReadingPipe(6,0xF0F0F0F0AALL);
 // radio.openReadingPipe(5,0xF0F0F0F0BBLL);
 // radio.openReadingPipe(4,0xF0F0F0F0CCLL);
 // radio.openReadingPipe(3,0xF0F0F0F0DDLL);
 // radio.openReadingPipe(2,0xF0F0F0F0EELL);
 // radio.openReadingPipe(1,0xF0F0F0F0FFLL);
radio.openReadingPipe(0,0xF0F0F0F011LL);

  //
  // Start listening
  //
  radio.startListening();

  //
  // Dump the configuration of the rf unit for debugging
  //

  Serial.println("DETAILS");
  radio.printDetails();
}

//
// Loop
//
unsigned long tmp = 0;
bool found = false;


void loop(void)
{
  //
  // Receive each packet, dump it out
  //
radio.stopListening();
radio.openReadingPipe(0,tmp);
radio.startListening();

if ( radio.testCarrier() ){
  Serial.print(tmp);
  Serial.print(" : ");
  Serial.println("Carrier!");
  if (found == false) tmp++;
 

 
    // if there is data ready
    if ( radio.available() )
    {
      Serial.println("Payload Available");
      found = true;
      // Get the packet from the radio
      payload_t payload;
      radio.read( &payload, sizeof(payload) );

      // Print the ID of this message.  Note that the message
      // is sent 'big-endian', so we have to flip it.
      //printf("#%05u Buttons ",flip_endian(payload.id));

      Serial.println("payload len:");
      Serial.println(sizeof(payload));

      //printf("\r\n");
    }
}
}



// vim:cin:ai:sts=2 sw=2 ft=cpp





It is modified to increment the pipe address until it finds an address with a package available. So far i have scanned until 100000 but this takes a lot of time.
Code: [Select]
100050 : Carrier!
100051 : Carrier!
100052 : Carrier!
100053 : Carrier!
100054 : Carrier!
100055 : Carrier!
100056 : Carrier!
100057 : Carrier!
100058 : Carrier!
100059 : Carrier!
100060 : Carrier!
100061 : Carrier!
100062 : Carrier!
100063 : Carrier!
100064 : Carrier!
100065 : Carrier!
100066 : Carrier!
100067 : Carrier!
100068 : Carrier!
100069 : Carrier!
100070 : Carrier!
100071 : Carrier!
100072 : Carrier!
100073 : Carrier!


Is there an easier way to find the right address or am I doing something wrong?

Thanks,

Peter
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: KarmaProd on Jan 28, 2015, 08:48 pm
Right, some kind of progress, but even more puzzles:-

Occaisonally when resetting, one of my units will show the addresses (pipe) as E2 & D2, whilst the other shows both as D2.

If I try transmitting from the E2/D2 then I get nothing. If I try transmitting from the D2/D2 then the E2/D2 responds as you expect and works ping/pomg. If I then change the D2/D2 to 'R' and the E2/D2 to 'T; then it works again! Strange, it will only work that way round AFTER I've had it working the opposite way.

I suspect that if both units show E2/D2 correctly then I could reliably transmit from either first and it will work.

Anyone have any idea as to what is going on here?
tack, I had the same problems as you:

«I often see different address (0xe7e7e7e77f) from the programmed one (0xf0f0f0f0e1), i.e.,
RX_ADDR_P0-1    = 0xe7e7e7e77f 0xf0f0f0f0d2
or both 0xf0f0f0f0d2»

«Occaisonally when resetting, one of my units will show the addresses (pipe) as E2 & D2, whilst the other shows both as D2»

«If I try transmitting from the E2/D2 then I get nothing. If I try transmitting from the D2/D2 then the E2/D2 responds as you expect and works ping/pomg. If I then change the D2/D2 to 'R' and the E2/D2 to 'T; then it works again! Strange, it will only work that way round AFTER I've had it working the opposite way


Maybe you have no problems any more, but I believe this could help other people as well. I fixed these problems uncommenting lines from 89 to 98:
Code: [Select]
 if ( role == role_ping_out )
  {
    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
  }
  else
  {
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe(1,pipes[0]);
  }
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: paco1990 on Feb 03, 2015, 12:51 am
Hello, I am new to the forum,

I apologize I can help, I have a problem with arduino due and NRF24L01,
I can not establish connection with the arduino due that I have, I have tried with several libraries, and at the moment I'm working with rf24, I modified the libraries and miss connections due and I can not get the connection, and you remove the NRF24L01 and send me various data, and hope you can help me, thanks in advance
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: GazS on Feb 20, 2015, 10:34 pm
Hi,  this great little board has caused me so much frustration with poor / no connection and inconsistent range,  please see my YouTube clip for an unbelievable easy fix

https://youtu.be/JWN9SUhMHhI

I hope my suffering will help others ! , please let me know how you get on. 

Cheers,  Gaz
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ankushg989 on Feb 26, 2015, 10:18 am
Hello friends,

tell me what is use of each and every following function in RF_network library

Code: [Select]
bool send_T(uint16_t to);
bool send_N(uint16_t to);
void handle_T(RF24NetworkHeader& header);
void handle_N(RF24NetworkHeader& header);


what is mean by 'header' here?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: cjcj1949 on Mar 15, 2015, 07:58 pm
I'm using the optimized library at
http://tmrh20.github.io/RF24/index.html

The GettingStarted sketch works ok. I've added a comparison between the tx data and rx data as the output can be misleading if the radios are both switched to tx rather than both to rx.

The range is about 10 metres through three brick walls at the second to lowest setting. Both 1 Mb and 250k Mb work at this range and power.

The other power settings work as well, including the highest power. I was surprised that no decoupling/reservoir capacitor was needed.

I am using two Unos with pin to socket wiring.

Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: hosein on May 14, 2015, 11:02 pm
Hi
i'm working with NRF24l01 by avr.
but my library don't work correctly and reset micro suddenly…
i cant test my NRF to send and receive my data…
plz help me…
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haro on Jun 13, 2015, 09:48 pm
hi
I have some problem for compiling nrf24lo1. in 1.6.4 version my code freezes the compiler while in 1.6.3 causes many errors.
I will attach the code and errors.
thanks for help
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haro on Jun 14, 2015, 07:20 am
every library witch i added to software makes errors in compiling. why?????!!!
somebody!!
anybody????
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: haro on Jun 14, 2015, 09:04 am
i think find out something.
Im using nano board but for compiling i should change the board type.
is it correct?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Isaac96 on Jun 21, 2015, 12:01 am
@haro, did you download the RF24 library and place it in your libraries folder in your sketchbook?

@maniacbug, do you know what the power consumption of a NRF24L01+ is? Does anyone?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: vader7071 on Sep 13, 2015, 11:37 pm
I have been searching and have not come across this yet.  I was hoping you could help.

Using the libraries, how would I adjust the transmit power of the nRF24L01?  I read on the data sheet that there are 2 bits you change (either a 11, 10, 01, or 00) to adjust the output power of the unit.

Is there a way to do that using the libraries that I have overlooked?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Avamander on Dec 14, 2015, 05:36 pm
Please DO NOT use this discontinued library.

Update your copy to https://github.com/TMRh20/RF24. It is a fork of maniacbug's version but has gone a long way since.

(Also solder capacitors to your modules 100uF, they should fix most communication issues)

@haro, did you download the RF24 library and place it in your libraries folder in your sketchbook?

@maniacbug, do you know what the power consumption of a NRF24L01+ is? Does anyone?
Datasheet has the data. If I remember correctly, 14mA when transmitting and a few uA when powered off.


I have been searching and have not come across this yet.  I was hoping you could help.

Using the libraries, how would I adjust the transmit power of the nRF24L01?  I read on the data sheet that there are 2 bits you change (either a 11, 10, 01, or 00) to adjust the output power of the unit.

Is there a way to do that using the libraries that I have overlooked?
The continued library fork (github.com/TMRh20/RF24) has the functionality added and the documentation tells a bit more about how to use it.

hi
I have some problem for compiling nrf24lo1. in 1.6.4 version my code freezes the compiler while in 1.6.3 causes many errors.
I will attach the code and errors.
thanks for help
The library you are using is outdated. Use the new fork (github.com/TMRh20/RF24). The new version will not give you the errors.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: abdolhamednik on Jan 01, 2016, 09:05 pm
would u please help me on
what are pipes and their addresses and the relationship?

 I want my nRF network to send data to base station even if some defined links are lost, so that an nRF calls the other nRF to take his data and if does not find it, calls another nRF and so on. It means data from any node will finally reach the base station.
Am I right that Library 'RF24network' can not help me?
For example, assume a network of 3 nRF's. I want every nRF to transmit a data that recently received plus 2. what should pipes and addresses be?
for example is it right:
1st nRF: write @ addr A0, read @ pipe0 + addr A2
2nd nRF: write @ addr A1, read @ pipe0 + addr A0
3rd nRF: write @ addr A2, read @ pipe0 + addr A1
??
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Robin2 on Jan 01, 2016, 10:16 pm
"pipe" is a rather unfortunate choice of name for what is really the ID number for a device. Conceptually very like a phone number.

If you want to transmit data to another device you must know the "number" of the receiving device. And the receiving device also has to know its own number.

If you really need a network I don't have any experience from which to help you.

Perhaps it would be sufficient to have a master and several slaves. The master can send a message to each slave in turn and get a reply. Each slave has a different ID or PIPE. If you use writeAckPayload() the slave can send the data back as part of the automatic acknowledgement and your program does not have to bother with switching between sending and listening.

...R
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ArduStooge on Feb 01, 2016, 08:12 am
I am really new to arduino and recently bought pair of NRF24L01 to remotely control LEDs blinking. So far I managed to get the LEDs blinking but there are couple problems :

1) If I use library from ManiacBug there's always a lag between button pressed on TX and the actual result on RX.
The lag disappears if I use  library from G Copeland http://forum.arduino.cc/index.php?topic=230681.0 (http://forum.arduino.cc/index.php?topic=230681.0) but with this library the result is inaccurate. This means if button A is pressed sometimes LED A blinks but can sometimes blinks other LEDs as well. And always blinks the previous LED blinked regardless which button is pressed.
The best result that I got is when I use Copeland's library for TX and ManiacBug libary for RX. There is no lag and very accurate but ideally I would like to use same library so I don't lose track.

2) When one LED is blinking after a button pressed, the other LEDs cannot blink even if the buttons are pressed. I think this is because I use "delay" function. I tried to use digital blinking from 'Blink W/O Delay' example but so far can only write code for 1 LED.

The code is  below for TX :

Code: [Select]
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int Button1 = 6;
int Button2 = 7;
int Button3 = 8;


void setup(void){
 Serial.begin(9600);
 radio.begin();
 radio.openWritingPipe(pipe);}

void loop(void){
 if (digitalRead(Button1) == LOW){
 msg[0] = 111;
 radio.write(msg, 1);
 }
 
 if (digitalRead(Button2) == LOW){
 msg[0] = 222;
 radio.write(msg, 1);
 }
 
 if (digitalRead(Button3) == LOW){
 msg[0] = 77;
 radio.write(msg, 1);
 }
 
 digitalWrite(Button1, HIGH);
 digitalWrite(Button2, HIGH);
 digitalWrite(Button3, HIGH);
 }



The code is  below for RX :

Code: [Select]
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int LED1 = 3;
int LED2 = 4;
int LED3 = 5;

void setup(void){
 Serial.begin(9600);
 radio.begin();
 radio.openReadingPipe(1,pipe);
 radio.startListening();
 pinMode(LED1, OUTPUT);
 pinMode(LED2, OUTPUT);
 pinMode(LED3, OUTPUT);}

void loop(void)
  {
 digitalWrite(LED1,LOW);
 digitalWrite(LED2,LOW);
 digitalWrite(LED3,LOW);
 if (radio.available()){
   bool done = false;   
   while (!done)
   {
     done = radio.read(msg, 1);     
     Serial.println(msg[0]);
//expecting message '111' to blink LED1
     if (msg[0] == 111)
       {
        digitalWrite(LED1, HIGH);
        delay(500);
        digitalWrite(LED1, LOW);
         delay(500);}
         
//expecting message '222' to blink LED2         
     if (msg[0] == 222)
       {
        digitalWrite(LED2, HIGH);
        delay(500);
        digitalWrite(LED2, LOW);
        delay(500);}   
//expecting message '77' to blink LED3
     if (msg[0] == 77)
       {
        digitalWrite(LED3, HIGH);
        delay(500);
        digitalWrite(LED3, LOW);
        delay(500);}     
     else {digitalWrite(LED1, LOW);
     digitalWrite(LED2,LOW); digitalWrite(LED3,LOW);}
     delay(1);}}}


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Robin2 on Feb 01, 2016, 10:42 am
Try TMRh20's updated RF24 library (https://tmrh20.github.io/RF24/).

Your array msg[] is defined as an int (which is 2 bytes) but this line only sends 1 byte
radio.write(msg, 1);
it should be
radio.write(msg, sizeof(msg));

...R
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ArduStooge on Feb 07, 2016, 10:19 pm
Thank you! No wonder the message came out weird.

Anyway, I am trying to make receiver to turn on multiple LEDs based on the message received. I don't know if nRF24L01 can transmit multiple messages at the same time so at this time I just make instructions to turn on the LED based on the message received.

On the TX side there are currently three buttons. Every button will transmit unique message if pressed. So far I managed to instruct the RX to turn on correct LED.

Now I want the RX to understand if buttons are pressed simultaneously. So I give different unique message for every combination of pressed buttons. However, I could not figure out the right method. I managed to instruct the RX to turn on two LEDs but it doesn't turn off the LED even though one of the TX button is already depressed and the serial monitor is showing message has changed.  Sorry for my babbling, I hope you understand what I mean. Here is the code
Code: [Select]
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;


int LED1 = 3;
int LED2 = 4;
int LED3 = 5;


void setup(void){
 Serial.begin(9600);
 radio.begin();
 radio.openReadingPipe(1,pipe);
 radio.startListening();
 pinMode(LED1, OUTPUT);
 pinMode(LED2, OUTPUT);
 pinMode(LED3, OUTPUT);}

void loop()
  {

     radio.read(msg, 1);
     Serial.println(msg[0]);

       if (msg[0] == 250)
       {digitalWrite(LED1, HIGH);   
        }
       else

     if (msg[0] == 222)
       {
       digitalWrite(LED2, HIGH); 
       }
       
     else

      if (msg[0] == 111)
       {
       digitalWrite(LED3, HIGH); 
       }

    else
    if (msg[0] == 251)
    {digitalWrite(LED2, HIGH);
     digitalWrite(LED3, HIGH);
    }
 

    else
   
     
    PORTD &= B11000111;
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Robin2 on Feb 07, 2016, 11:20 pm
On the TX side there are currently three buttons. Every button will transmit unique message if pressed. So far I managed to instruct the RX to turn on correct LED.
I think your system will be very much simpler if you always transmit the state of all the buttons even if they don't change. That way there are always 3 values and always in the same order so the receiver has no trouble figuring things out.

...R
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: ArduStooge on Feb 08, 2016, 10:02 pm
I think your system will be very much simpler if you always transmit the state of all the buttons even if they don't change. That way there are always 3 values and always in the same order so the receiver has no trouble figuring things out.

...R
Do you mind to elaborate? I failed to understand your two points
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: terryking228 on Feb 09, 2016, 03:18 am
Quote
would u please help me on
what are pipes and their addresses and the relationship?
I have found this confusing to start. My take:
 
a Pipe is:

- an identifier of a logical connection between two nRF24L01 transceivers that are on the same channel (There are 125 possible channel frequencies from 2.400GHz to 2.524GHz)
  - A transceiver transmitting and the  receiving transceiver must have the same pipe name.

- a data buffer area in each transceiver. There can be 6 receiving pipes on each transceiver (But pipe 1 is taken over and used as the transmitting pipe)

See the How-To for nRF24L01 on the ArduinoInfo.Info page  HERE: (https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo) and follow the example code..

And some suggestions to improve RANGE:

You can do these things to get better range:


Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: nelysk4 on Mar 04, 2016, 12:37 pm
Hi folks!
Didn't create a new topic, as I have some issue with addressing using RF24 library.

Whole system contains two transmitters and one receiver (if it's possible to fix this issue - it will have 4 transmitters).
The problem I've got is, that whether I read from first or second pipe I get data sometimes from right pipe, sometimes from wrong pipe. And data getting sometimes consistent, sometimes not:

Got data on 0  Gauta: 3485
Got data on 0  Gauta: -11673
Got data on 1  Gauta: 3486
Got data on 1  Gauta: -11672
Got data on 1  Gauta: 3487
Got data on 0  Gauta: -11671
Got data on 0  Gauta: 3488
Got data on 1  Gauta: -11670
Got data on 1  Gauta: 3489
Got data on 0  Gauta: -11669
Got data on 0  Gauta: 3490
Got data on 1  Gauta: -11668
Got data on 0  Gauta: 3491
Got data on 0  Gauta: -11667
Got data on 0  Gauta: 3492
Got data on 1  Gauta: -11666
Got data on 0  Gauta: 3493
Got data on 0  Gauta: -11665
Got data on 0  Gauta: 3494
Got data on 0  Gauta: -11664
Got data on 0  Gauta: 3495
Got data on 1  Gauta: -11663
Got data on 0  Gauta: 3496
[on which pipe data was got] [the data itself]

transmitters sends increases data value by 1 each time it sends data (these are started at different times to have different numbers.

As you see in the part of the data receiving module gets it's totally random, while it reads one by one both pipes.
What could be cause of it or how to solve it?

Transmitter code (variable "pipeNumber" defines which receiver it is):
Code: [Select]
//----TRANSMITTER----
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(9,10);
//const uint64_t communication_pipes[5] = { 0xF0F0F0F0D6LL, 0xF0F0F0F0C6LL, 0xF0F0F0F0B4LL, 0xF0F0F0F0A5LL, 0xF0F0F0F096LL };
const uint64_t communication_pipes[5] = { 0xE7D3F03577LL, 0xC2C2C2C2C2LL, 0xC2C2C2C2C3LL, 0xC2C2C2C2C4LL, 0xC2C2C2C2C5LL };
const int pipeNumber = 1; // pirmas pipe = 0
uint64_t pipe = communication_pipes[pipeNumber]; // naudojamas adresas
//------ Adresavimas --------
//------ SIUNTIMO kintamieji --- START -----
bool initialize = false;
int data = 0;
//------ SIUNTIMO kintamieji --- END -----
void setup(){
  Serial.begin(250000);
  printf_begin();
}

void loop(){
  send(pipe, data);
  data++;
  delay();
}

//IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
int send(uint64_t pipeSEND, int dataTOsend){
  if(initialize == false) RF24_Initialization_SEND(pipeSEND);
  bool sendStatus = false;
  int retries = -1;
  printf("Siunciama: %i\n", data);
  radio.write(&dataTOsend, sizeof(dataTOsend));
}

void RF24_Initialization_SEND(uint64_t pipeSENDinit){
  printf("Transmitter %i\n", pipeNumber);
  printf("Address: ");
  Serial.println((long)pipeSENDinit, HEX);
  radio.begin();
  radio.enableAckPayload();
  radio.openWritingPipe(pipeSENDinit);
  radio.printDetails();
  initialize = true;
  printf("Initialization DONE\n");
}


Receiver code:
Code: [Select]
//----RECIEVER----
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(9,10);
//const uint64_t pipesAddress[5] = { 0xF0F0F0F0D6LL, 0xF0F0F0F0C6LL, 0xF0F0F0F0B4LL, 0xF0F0F0F0A5LL, 0xF0F0F0F096LL };
const uint64_t pipesAddress[5] = { 0xE7D3F03577LL, 0xC2C2C2C2C2LL, 0xC2C2C2C2C3LL, 0xC2C2C2C2C4LL, 0xC2C2C2C2C5LL };
const int pipeNumber[5] = {0, 1, 2, 3, 4}; // pirmas pipe = 0

int data;
const int button = 4;
bool buttonState = 0;

void setup(){
  Serial.begin(250000);
  printf_begin();
  RF24_Initialization_GET();
  pinMode(button, INPUT);
}

void loop(){
  get(pipesAddress[0], pipeNumber[0]);
  get(pipesAddress[1], pipeNumber[1]);
}

//IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
int get(uint64_t pipeGET, int pipeNumberTOget){
  int dataGOT = 0;
  if(radio.available()){
    bool done = false;
    while(!done){
      done = radio.read(&dataGOT, sizeof(dataGOT));
    }
    printf("Got data on %i  Gauta: %i\n", pipeNumberTOget, dataGOT);
  }
  return dataGOT;
}

void RF24_Initialization_GET(){
  radio.begin();
  radio.enableAckPayload();
  radio.openReadingPipe(pipeNumber[0], pipesAddress[0]);
  radio.openReadingPipe(pipeNumber[1], pipesAddress[1]);
 // radio.openReadingPipe(pipeNumber[2], pipesAddress[2]);
 // radio.openReadingPipe(pipeNumber[3], pipesAddress[3]);
 // radio.openReadingPipe(pipeNumber[4], pipesAddress[4]);
  radio.startListening();
  radio.printDetails();
  printf("Initialization DONE\n");
}
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Robin2 on Mar 04, 2016, 03:10 pm
You seem to have set up two receiving pipes but you only have a single read() that does not seem to differentiate between them. I confess I have not used multiple reading pipes so I would have to read the documentation to find an answer. I will leave that to you.

As you don't seem to need to send much data why not turn the whole process on its head and make what is now the receiver into a master and treat the other devices as slaves. Then the master can poll each of the slaves in turn. That is how I control a model train system. The code in the pair of programs in this link (http://forum.arduino.cc/index.php?topic=370484.msg2554900#msg2554900) is derived from that.

I recommend using the TMRh20 version of the RF24 library (https://tmrh20.github.io/RF24/) - it solves some problems from the ManiacBug version

...R
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Whandall on Mar 04, 2016, 10:12 pm
You can only read the next packet and determine which pipe it was received on.

There is no 'reading from a pipe'.
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: guow3 on Mar 07, 2016, 02:14 am
Hello

I am having trouble getting this module to work using the tmrh20 lib. I am using these modules with two arduino mega and a 3.3V external power supply. I also placed 10 uF in parallel with the modules power pin. I would really appreciate any comments or suggustions.

In the code below all I am trying to do is turn on a led.
Here are my pin assignment for both arduinos
CE -> 7
CSN -> 8
SCK -> 52
MOSI -> 51
MISO -> 50
IRQ -> unconnected

Transmitter
Code: [Select]
//#include <DigitalIO.h>
#include <SPI.h>
#include "RF24.h"
#include <printf.h>
RF24 radio(7,8);
const uint64_t pipe = 0xE8E8F0F0E1LL;
unsigned long msg = 375983;

void setup() {
    Serial.begin(115200);
    printf_begin();
    Serial.println("Transmitter");
    pinMode(9, INPUT);
    radio.begin();
    radio.setChannel(108);
    radio.openWritingPipe(pipe);
    radio.startListening();
    radio.printDetails();
}

void loop() {
  radio.stopListening();
  if (digitalRead(9) == HIGH)
  {
    while (!radio.write(&msg, sizeof(msg))){
      radio.write(&msg, sizeof(msg));
}
  Serial.println("Sending.....");
  }
  else {
    Serial.println("Awaiting Input....");
  }
  delay(500);

}


Code: [Select]
STATUS = 0xff RX_DR=1 TX_DS=1 MAX_RT=1 RX_P_NO=7 TX_FULL=1
RX_ADDR_P0-1 = 0xffffffffff 0xffffffffff
RX_ADDR_P2-5 = 0x7f 0xff 0x7f 0xff
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0xff 0x7f 0xff 0x7f 0xff 0xff
EN_AA = 0xff
EN_RXADDR = 0xff
RF_CH = 0xff
RF_SETUP = 0xff
CONFIG = 0xff
DYNPD/FEATURE = 0x7f 0xff
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MAX


Receiver
Code: [Select]
//#include <DigitalIO.h>
#include <SPI.h>
#include "RF24.h"
#include <printf.h>
RF24 radio(7,8);
const uint64_t pipe = 0xE8E8F0F0E1LL;
unsigned long msg;

void setup() {
    Serial.begin(115200);
    printf_begin();
    Serial.println("Receiver");
    pinMode(9, OUTPUT);
    radio.begin();
    radio.setChannel(108);
    radio.openReadingPipe(0,pipe);
    radio.printDetails();
 
}

void loop() {
   radio.startListening();
   digitalWrite(9, LOW);
  if(radio.available()){
    while(radio.available())
    {
    radio.read(&msg, sizeof(msg));
    Serial.println("Incoming...");
    delay(500);
    Serial.println(msg);
    }
  }
  else{
    Serial.println("No Msg");
  }
  radio.stopListening();
  Serial.println(msg);
  if (msg == 375983){
    digitalWrite(9, HIGH);
    Serial.println(msg);
  }
  delay(500);
}


Code: [Select]
STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: nelysk4 on Mar 07, 2016, 06:24 pm
@Robin2 Thanks!


You can only read the next packet and determine which pipe it was received on.

There is no 'reading from a pipe'.
Can you give an example? I mean, how to check on which pipe it was received on?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: Whandall on Mar 07, 2016, 08:27 pm
Status register bits 3:1 hold this information. (From the datasheet page 59)

Quote
RX_P_NO 3:1 111 R Data pipe number for the payload available for reading from RX_FIFO
 000-101: Data Pipe Number
 110: Not Used
 111: RX FIFO Empty
From the original library
Code: [Select]
bool RF24::available(uint8_t* pipe_num)
{
  if (!( read_register(FIFO_STATUS) & _BV(RX_EMPTY) )){
    // If the caller wants the pipe number, include that
    if ( pipe_num ){
      uint8_t status = get_status();
      *pipe_num = ( status >> RX_P_NO ) & 0b111;
    }
    return 1;
  }
  return 0;
}
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: nelysk4 on Mar 07, 2016, 11:29 pm
Status register bits 3:1 hold this information. (From the datasheet page 59)

From the original library
Code: [Select]
bool RF24::available(uint8_t* pipe_num)
{
  if (!( read_register(FIFO_STATUS) & _BV(RX_EMPTY) )){
    // If the caller wants the pipe number, include that
    if ( pipe_num ){
      uint8_t status = get_status();
      *pipe_num = ( status >> RX_P_NO ) & 0b111;
    }
    return 1;
  }
  return 0;
}


Thanks! Will try it out
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: omglasers on Sep 01, 2016, 03:01 pm
Hello,
Is there a way to flush the FIFO buffer without calling read() until available() returns 0 ?
Title: Re: RF24 Library: Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Post by: vagulus on Dec 14, 2016, 01:59 am
In post #107, finnduino wrote,

Code: [Select]
It's still showing this when I look status of module:
Data Rate        = 1MBPS
Model            = nRF24L01
CRC Length       = 16 bits
PA Power         = PA_HIGH


Would someone please tell me how to obtain such a status reading?