Which are the *best* NRF24L01+ modules?
-
@Fabien said:
@NeverDie : Can you please post the sketch you use to test your NRFs modules. I just recieve 10 today from Itead. Same packaging that the ones you recieve. I just want to compare result in same conditions.
OK, sure. It started out as RF toy code, and then I just evolved it. It contains a lot of commented out code that I haven't bothered to delete. If that gets in the way of your understanding, just delete the code that's commented out. Aside from that, it's straightforward.
Here's the main transmitter code. After compiling and uploading, you should open a serial window on your computer to read the statistics it prints out:
/* nRF24Sender Demo for RFToy This demo shows how to use RFToy to make a wireless temperature sensor. This is the sender module which transmits the current temperature value to a receiver module. The demo uses the Mirf library. This demo uses a 100K resistor and 100K thermistor to form a simple temperature sensor. Pin A1 is used to read the value. The connection is: VCC->100K->A1->thermistor->GND Written by Jonathan Goldin @ Rayshobby LLC Nov 2014 For details, visit http://rayshobby.net/rftoy */ #include <SPI.h> #include <Mirf.h> #include <nRF24L01.h> #include <MirfHardwareSpiDriver.h> #include <U8glib.h> U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI void setup(){ Serial.begin(115200); Serial.println("Starting..."); /* Set ce and csn pins */ Mirf.cePin = 17; Mirf.csnPin = 16; Mirf.spi = &MirfHardwareSpi; Mirf.init(); /* * Configure reciving address. */ Mirf.setRADDR((byte *)"clie1"); /* * Set the payload length to sizeof(unsigned long) the * return type of millis(). * * NB: payload on client and server must be the same. */ //Mirf.payload = sizeof(long); Mirf.payload = sizeof(long); /* * Write channel and payload config then power up reciver. */ /* * To change channel: * * Mirf.channel = 10; * * NB: Make sure channel is legal in your area. */ // we use channel 90 as it is outside of WLAN bands // or channels used by wireless surveillance cameras //Mirf.channel = 90; Mirf.config(); //This register value is not remembered between power cycles. //It defaults to 0x0F. //It should be initialized each time if different than 0x0F. Mirf.configRegister(RF_SETUP,0x07); //0x0F is 2mbps, max Tx power //0x07 is 1mbps, max Tx power //0x2F is 250kbps, max Tx power. Serial.println("OTA datarate set to 1Mbps. Transmit Power set to Maximum."); // Read and print RF_SETUP byte rf_setup = 0; Mirf.readRegister( RF_SETUP, &rf_setup, sizeof(rf_setup) ); Serial.print( "rf_setup = " ); Serial.println( rf_setup, BIN ); // OLED u8g.firstPage(); do{ uint8_t h; u8g.setFont(u8g_font_10x20); u8g.setFontRefHeightText(); u8g.setFontPosTop(); h = u8g.getFontAscent()-u8g.getFontDescent(); u8g.drawStr(29,(u8g.getHeight()-h)/2,"Tx Sender"); } while(u8g.nextPage()); Mirf.setTADDR((byte *)"serv1"); Serial.write("Sending...\r\n"); delay(200); } // End of *Setup* long temp; int temp1; int temp2; long timeTxSent; long timeRxReceived; long roundTrip; byte age1=52; byte age2=11; long txCounter=0; long matchCount=0; long differentCount=0; long lostCount=0; long cumulativeRoundTrip=0; long averageRoundTrip=0; boolean packetLost=false; float packetErrorRate=0; //no errors yet, and maybe there never will be. float lostPacketRate=0; //no packets lost yet. const int statusFrequency=500; //How many iterations of main loop before printing status info. long minRoundTrip=9999; //value will be driven down when program runs long maxRoundTrip=0; //value will be driven up when program runs void loop(){ txCounter++; packetLost = false; //It can't be lost, because it hasn't even been sent yet. temp = txCounter; //getTemp(resistance); temp1=temp; timeTxSent=micros(); Mirf.send((byte *)&temp); while(Mirf.isSending()){ } /* Serial.write("temp="); Serial.print(temp,DEC); Serial.write("\r\n"); Serial.write("temp1="); Serial.print(temp1,DEC); Serial.write("\r\n"); Serial.write("Finished sending.\r\n"); */ //delay(10); unsigned long time = millis(); while ((!packetLost) && (!Mirf.dataReady())){ //Serial.println("Waiting"); if ( ( millis() - time ) > 8 ) { //Serial.println("Timeout on response from Rx Echo Reflector!"); lostCount++; packetLost=true; } } if (!packetLost) { Mirf.getData((byte *) &temp); timeRxReceived=micros(); temp2 = temp; roundTrip = timeRxReceived - timeTxSent; if (roundTrip < minRoundTrip) { minRoundTrip=roundTrip; } if (roundTrip > maxRoundTrip) { maxRoundTrip = roundTrip; } if(temp1 == temp2){ matchCount++; cumulativeRoundTrip += roundTrip; averageRoundTrip = cumulativeRoundTrip/(txCounter-lostCount-differentCount); } else { differentCount++; Serial.println("***DIFFERENT**"); Serial.write("temp1="); Serial.println(temp1, BIN); Serial.write("temp2="); Serial.println(temp2, BIN); } if ((txCounter%statusFrequency)==0) { /* if(temp1 == temp2){ Serial.print("Match"); } else { Serial.println("***DIFFERENT**"); } Serial.write(","); */ } } lostPacketRate = 100*((float)(lostCount))/((float)txCounter); if ((txCounter%statusFrequency)==0) { Serial.print(txCounter); Serial.write(",lost="); Serial.print(lostPacketRate); /* Serial.write("%,T="); Serial.print(temp,DEC); //Serial.write(". "); Serial.write(",T1="); Serial.print(temp1,DEC); //Serial.write(". "); Serial.write(",T2="); Serial.print(temp2,DEC); */ Serial.write("%,RT="); Serial.print(roundTrip,DEC); Serial.write(",minRT="); Serial.print(minRoundTrip); Serial.write(",maxRT="); Serial.print(maxRoundTrip); Serial.write(",aRT="); Serial.print(averageRoundTrip,DEC); Serial.print(",#lost="); Serial.print(lostCount); //Serial.write(",mat="); //Serial.print(matchCount); Serial.write(",diff="); Serial.print(differentCount); Serial.write("\r\n"); delay(100); //give time for it to print out //txCounter = 0; //restart gathering statistics } /* delay(1000); // keep the 'sending' message displayed on OLED for 1 sec u8g.firstPage(); do{ } while(u8g.nextPage()); delay(2000); // wait for 2 seconds till next transmission */ } //End of main loop.Here's the code for the receiver node. It doesn't need to be plugged into a computer:
/* nRF24Receiver Demo for RFToy This demo shows how to use RFToy to make a wireless temperature sensor. This is the receiver module which displays the received temperature value to OLED. The demo uses the Mirf library. Written by Jonathan Goldin @ Rayshobby LLC Nov 2014 For details, visit http://rayshobby.net/rftoy */ #include <SPI.h> #include <Mirf.h> #include <nRF24L01.h> #include <MirfHardwareSpiDriver.h> #include "U8glib.h" U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI void setup(){ Serial.begin(115200); Serial.println("Echo Receiver. Listening"); Mirf.cePin = 17; //??? Mirf.csnPin = 16; //??? /* * Set the SPI Driver. */ Mirf.spi = &MirfHardwareSpi; /* * Setup pins / SPI. */ Mirf.init(); /* * Configure reciving address. */ Mirf.setRADDR((byte *)"serv1"); /* * Set the payload length to sizeof(unsigned long) the * return type of millis(). * * NB: payload on client and server must be the same. */ Mirf.payload = sizeof(long); /* * Write channel and payload config then power up reciver. */ // we use channel 90 as it is outside of WLAN bands // or channels used by wireless surveillance cameras //Mirf.channel = 90; Mirf.config(); //This register value is not remembered between power cycles. //It defaults to 0x0F. //It should be initialized each time if different than 0x0F. Mirf.configRegister(RF_SETUP,0x07); //0x0F is 2mbps, max Tx power //0x07 is 1mbps, max Tx power //0x2F is 250kbps, max Tx power. Serial.println("OTA datarate set to 1Mbps. Transmit Power set to Maximum."); // Read and print RF_SETUP byte rf_setup = 0; Mirf.readRegister( RF_SETUP, &rf_setup, sizeof(rf_setup) ); Serial.print( "rf_setup = " ); Serial.println( rf_setup, BIN ); u8g.firstPage(); do{ uint8_t h; u8g.setFont(u8g_font_10x20); u8g.setFontRefHeightText(); u8g.setFontPosTop(); h = u8g.getFontAscent()-u8g.getFontDescent(); u8g.drawStr(19,(u8g.getHeight()-h)/2,"Echo Rx"); } while(u8g.nextPage()); } //End of *Setup* procedure void loop(){ /* * A buffer to store the data. */ byte data[Mirf.payload]; /* * If a packet has been recived. * * isSending also restores listening mode when it * transitions from true to false. */ if(!Mirf.isSending() && Mirf.dataReady()){ //Serial.print("Got packet: "); /* * Get load the packet into the buffer. */ Mirf.getData(data); // Set the send address. Mirf.setTADDR((byte *)"clie1"); /* * Send the data back to the client. */ Mirf.send(data); /* * Wait untill sending has finished * * NB: isSending returns the chip to receving after returning true. */ //Serial.println("Reply sent."); } }As background, here's a link to the RFToy:
http://rayshobby.net/rftoy/
Links to the RFToy library, as well as the hardware design, can be found there. It's all open source.This shows the pin assignments: https://github.com/rayshobby/rftoy-hw/blob/master/RFToy.png
You'll need a pinout diagram to match-up those internal pins to the physical pins of whatever Arduino you're using. For instance, for an Uno, here's a pinout diagram which maps internal pins to physical pins:
http://marcusjenkins.com/wp-content/uploads/2014/06/ARDUINO_V2.png
That way you'll know how to properly wire-up your NRF24L01+ so that it works properly with the library code.So, I did that just now and tested it on the UNO, and so for the UNO the simplified wiring directions are:
NRF24L01+Pin --- --> Uno Female Header Pin
GND (1) ----------------------------> GND
VCC (2) -----------------------------> 3.3V
CE (3) ------------------------------> A3
CSN (4) -------------------------------> A2
SCK (5) --------------------------------> D13
MOSI (6) --------------------------------> D11
MISO (7) --------------------------------> D12
IRQ(8) ---------------------------------> n/aThe RFToy has an OLED screen that gets written to. You can remove that code if you wish, but leaving it in does no harm, even if you don't have an OLED screen on your arduino. I modified the code so that it's only written to during the setup loop, so regardless it shouldn't interfere with any of the measurements taken in the main loop..
Hope that helps!
@NeverDie
I just compiled and uploaded your code to two uno's and all I am getting is
OTA datarate set to 1Mbps. Transmit Power set to Maximum.
rf_setup = 111
Sending...how long does it take to get any output on the serial monitor?
-
@NeverDie
I just compiled and uploaded your code to two uno's and all I am getting is
OTA datarate set to 1Mbps. Transmit Power set to Maximum.
rf_setup = 111
Sending...how long does it take to get any output on the serial monitor?
@parachutesj
I was using 3.3v pro mini's, not uno's. Maybe you have a level shift problem. -
@parachutesj
I was using 3.3v pro mini's, not uno's. Maybe you have a level shift problem.@NeverDie
ok, thank you. using Nano's work. getting 13% loss is not too bad -
@nftrix Another way to deal with the fact that some nrf24l01+ modules can not find the gateway, is by reducing the transmit powerlevel. Some of these modules "scream" so loud, that the receiver on the gateway gets a distorted signal and fails to recognise a proper packet.
In my house I have had to reduce the transmit levels of most of my modules, and as a result they now all connect to the gateway without any caps.
The NRF24 on the gateway does have a potent powersupply and caps on the board it is mounted on, but my sensornodes do not need it.@GertSanders
In your experience, which of the SMD modules have you found work the best? -
@GertSanders
In your experience, which of the SMD modules have you found work the best? -
@GertSanders
Are you happy with their performance? I imagine the answer is yes, but I thought I'd ask just to be sure. -
@GertSanders
Are you happy with their performance? I imagine the answer is yes, but I thought I'd ask just to be sure.@NeverDie
I am, there is one on my front door, which needs to cross two floors to get to the gateway in the attic. Bleeps every time. Range (as far as I can see) is close to the classic small version.
Good enough for me. -
@NeverDie
I am, there is one on my front door, which needs to cross two floors to get to the gateway in the attic. Bleeps every time. Range (as far as I can see) is close to the classic small version.
Good enough for me.@GertSanders
Thanks! I just now ordered some of the same SMD modules using the link you provided. The last time I looked into this (at the start of this thread), it seemed as though just about everyone was using a different mix of modules and platforms. and that made an apples-to-apples performance comparison quite difficult. However, this time around, I'll be running the same modules as you on the same hardware platform as you (well, nearly so, assuming I build it to spec), and so if it works well for you it presumably should work the same for me too. -
Good morning together, iam very new in mysensors forum, so this is my first post, and i have a question: a want to buy these NRF's can somebody tell me if they are okay?
https://www.amazon.de/Kuman-nRF24L01-Wireless-Transceiver-Compatible/dp/B01BVAAASY/ref=sr_1_fkmr0_1?ie=UTF8&qid=1464158231&sr=8-1-fkmr0&keywords=nordic+nrf24l01+10pcsThank you!
-
Good morning together, iam very new in mysensors forum, so this is my first post, and i have a question: a want to buy these NRF's can somebody tell me if they are okay?
https://www.amazon.de/Kuman-nRF24L01-Wireless-Transceiver-Compatible/dp/B01BVAAASY/ref=sr_1_fkmr0_1?ie=UTF8&qid=1464158231&sr=8-1-fkmr0&keywords=nordic+nrf24l01+10pcsThank you!
@HarrySteff There is no way (that I know of) to determine in advance if the modules work according to specification. Even different lots from the same supplier can vary in performance. I have a 5 out of 6 succes rate with different suppliers.
-
Thank you @AWI i will Order them to Test...
-
I have had an excellent experience with the SMD version. I cannot say if there are different versions of it, but all transceivers I purchased from different suppliers work flawlessly.
-
@alexsh1 Do you have any links for the SMD versions that you can recommend, i'm wanting to try these now. Thanks.
@Samuel235 these were the ones I ordered last time. Tested all of them and very much pleased
Look what I found on AliExpress
http://s.aliexpress.com/ZfArmaqe -
I have had an excellent experience with the SMD version. I cannot say if there are different versions of it, but all transceivers I purchased from different suppliers work flawlessly.
@alexsh1
At which settings do you use them?
I have those http://www.aliexpress.com/item/10PCS-LOT-NRF24L01-wireless-data-transmission-module-2-4G-the-NRF24L01-upgrade-version/1593276910.html
And not so happy as they seem to loose connection from time to time over distance of 4-5m
I set them at 250 and have good power & caps attachedAt least the chip seems to be original but not soldered very well
-
@alexsh1
At which settings do you use them?
I have those http://www.aliexpress.com/item/10PCS-LOT-NRF24L01-wireless-data-transmission-module-2-4G-the-NRF24L01-upgrade-version/1593276910.html
And not so happy as they seem to loose connection from time to time over distance of 4-5m
I set them at 250 and have good power & caps attachedAt least the chip seems to be original but not soldered very well
@parachutesj I'll be honest with you - so far I had more luck with the SMD version which works 20m+ across a few walls than with a regular transceivers. Sometimes one needs to invite a shaman to make sure that nrf24l01+ works.
I have 250kb rate on all nodes + caps. All works fine. With some regular nrf24l01+ I had issues with some batches and claimed money back successfully after ditching the whole batch. Luckily, this bad batch has not been working at all rather than working intermittently.
Just a suggestion - did you change any settings on your gateway nrf24l01+? I'm using the amplified version by the way feeding it through AMS1117 LDO
-
@parachutesj I'll be honest with you - so far I had more luck with the SMD version which works 20m+ across a few walls than with a regular transceivers. Sometimes one needs to invite a shaman to make sure that nrf24l01+ works.
I have 250kb rate on all nodes + caps. All works fine. With some regular nrf24l01+ I had issues with some batches and claimed money back successfully after ditching the whole batch. Luckily, this bad batch has not been working at all rather than working intermittently.
Just a suggestion - did you change any settings on your gateway nrf24l01+? I'm using the amplified version by the way feeding it through AMS1117 LDO
@alexsh1 said:
I switched to ampliefied nrf24 with antenna from the link in the shop but this seemed to make it even worse. It was powered externally and tried to shield it with no real luck. I ordered some shielded ones from ICstation which are still in customs process and hope to get them by the weekend. I also ordered a bunch of others and I will try which are the best for my operations.
Just today I hade the closest node getting stuck. I wasn't able to send any from controller to the node. After triggering a signal from the node (it is a rollershutter) it came back to live and was able to send via controller again. Quite annoying...
Maybe I need to try some different caps and voltage regulators, actually got "good" ones from my local electronics shop. -
Do the amplified modules simply always function at full amplification, or is there a code change that's needed to adjust the Tx power? Towards the start of this thread I tried some amplified modules from ICStation, but I was hugely disappointed with them. In fact, I don't think I saw any improvement at all, which greatly contradicted the experience that some others appeared to be getting. At least at that time, though, there was no real guidance on how to use them effectively, and so maybe I wasn't driving them right. Maybe there's more information now.
-
@alexsh1 said:
I switched to ampliefied nrf24 with antenna from the link in the shop but this seemed to make it even worse. It was powered externally and tried to shield it with no real luck. I ordered some shielded ones from ICstation which are still in customs process and hope to get them by the weekend. I also ordered a bunch of others and I will try which are the best for my operations.
Just today I hade the closest node getting stuck. I wasn't able to send any from controller to the node. After triggering a signal from the node (it is a rollershutter) it came back to live and was able to send via controller again. Quite annoying...
Maybe I need to try some different caps and voltage regulators, actually got "good" ones from my local electronics shop.@parachutesj What settings do you have on your gateway please?
-
Do the amplified modules simply always function at full amplification, or is there a code change that's needed to adjust the Tx power? Towards the start of this thread I tried some amplified modules from ICStation, but I was hugely disappointed with them. In fact, I don't think I saw any improvement at all, which greatly contradicted the experience that some others appeared to be getting. At least at that time, though, there was no real guidance on how to use them effectively, and so maybe I wasn't driving them right. Maybe there's more information now.
@NeverDie In MyConfig.h there are settings:
#define RF24_PA_LEVEL RF24_PA_MAX #define RF24_PA_LEVEL_GW RF24_PA_LOWThe second one is for the amplified version (RF24_PA_MAX can used)
Please check out this:
https://forum.mysensors.org/topic/653/nrf24l01-pa
