Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Which are the *best* NRF24L01+ modules?

Which are the *best* NRF24L01+ modules?

Scheduled Pinned Locked Moved Hardware
310 Posts 42 Posters 259.3k Views 37 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • YveauxY Yveaux

    @Moshe-Livne said:

    why don't you start a github sketch with simple regression results that will evolve with time?

    I'm thinking about a simple sketch, based of the nRF24 Sniffer's code, which connects two radios and checks on air how a radio communicates. This should allow detecting the inverted NO_ACK bit (see Jay Tyzzer's comment here) to immediately quilify a module as fake when detected.
    Of course this doesn't mean it's genuine when doesn't have the bit inverted, but the sketch could also dump register settings to be able to detect a pattern.

    Moshe LivneM Offline
    Moshe LivneM Offline
    Moshe Livne
    Hero Member
    wrote on last edited by
    #41

    @Yveaux wonderful! Even if fake, ones with correct ack bit will probably work better so its a step in the right direction

    1 Reply Last reply
    0
    • YveauxY Yveaux

      An overview of the module I have lying around (origin is unclear, as I don't really keep track of where they come from)
      The chip close-ups were taken using a microscope, so they have far higher resolution then shown in the table (right-click & show image to view at native resolution) .

      Datecode YYWWLL Module top Module bottom Closeup Fake/Genuine
      0830AE 2015-07-27 18.59.21.jpg 2015-07-27 18.59.32.jpg 20150727_0005.jpg Genuine? Datecode 0830 indicates production wk30 2008. nRF24L01+ was launched in 2008
      1242AF 2015-07-27 18.53.12.jpg 2015-07-27 18.53.28.jpg 20150727_0006.jpg Known counterfeit, according to this
      1322DQ 2015-07-27 18.55.35.jpg 2015-07-27 18.55.45.jpg 20150727_0007.jpg
      1331AF 2015-07-27 18.56.26.jpg 2015-07-27 18.56.34.jpg 20150727_0008.jpg Known counterfeit, according to this
      1405FJ 2015-07-27 18.59.00.jpg 2015-07-27 18.59.08.jpg 20150727_0003.jpg
      1408AF 2015-07-27 18.54.33.jpg 2015-07-27 18.54.41.jpg 20150727_0002.jpg Probably fake (identical to left one bottom of the page
      NeverDieN Offline
      NeverDieN Offline
      NeverDie
      Hero Member
      wrote on last edited by
      #42

      @Yveaux said:

      An overview of the module I have lying around (origin is unclear, as I don't really keep track of where they come from)
      The chip close-ups were taken using a microscope, so they have far higher resolution then shown in the table (right-click & show image to view at native resolution) .

      Datecode YYWWLL Module top Module bottom Closeup Fake/Genuine
      0830AE 2015-07-27 18.59.21.jpg 2015-07-27 18.59.32.jpg 20150727_0005.jpg Genuine? Datecode 0830 indicates production wk30 2008. nRF24L01+ was launched in 2008

      FWIW, the 0830AE date code is only a little earlier (4 weeks?) than the 0834AF datecode on the chip above in Hek's post where Hek alleges the module is genuine.

      1 Reply Last reply
      1
      • YveauxY Yveaux

        @hek said:

        What microscope are you using?

        This one. It's sold under various names/brands (e.g. Oitez e-scope).
        I really needed it to hand-solder those QFN's ;-)

        NeverDieN Offline
        NeverDieN Offline
        NeverDie
        Hero Member
        wrote on last edited by
        #43

        @Yveaux said:

        I really needed it to hand-solder those QFN's ;-)

        How hard would it be to desolder a bogus NRF chip and then solder a known good NRF24L01+ (purchased either directly from Nordic, if Nordic does that, or else from a trusted distributor like Digikey) in its place? Perhaps in this way the modules can be given a second life of sorts.

        1 Reply Last reply
        0
        • NeverDieN Offline
          NeverDieN Offline
          NeverDie
          Hero Member
          wrote on last edited by NeverDie
          #44

          @Yveaux: Those are wonderful photos! Thanks so much for posting them. :smile: Did you use the microscope for the module shots also, or just the NRF chip closeups?

          Since you have a nice module collection that spans different NRF chips and also different module types, have you noticed whether any of your modules stand out head-and-shoulders above the others as having clearly better performance?

          1 Reply Last reply
          0
          • DwaltD Offline
            DwaltD Offline
            Dwalt
            wrote on last edited by Dwalt
            #45

            Lol, I just checked all of my radios from Alice1101983 and they are all dated 1242AF - FAKES! I have 20 from two orders of 10 radios each placed about six months apart (10/14 & 4/15) and they all have the same production date. They do work but I have occasional and random node hangup. This is an ongoing problem which I have been unable to troubleshoot. @hek, we might want to change the vendor in the MySensors store.

            Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

            1 Reply Last reply
            0
            • NeverDieN Offline
              NeverDieN Offline
              NeverDie
              Hero Member
              wrote on last edited by NeverDie
              #46

              Here's a module that is itself surface mountable. It seems like roughly half the footprint of typical modules.
              smm.jpg
              Anyone have suggestions on how best to cheaply hook it up to an arduino? Not sure, but the pin pitch might be 1.27mm. I do have arduino prototyping shields, and there do seem to be 7 pin areas meant for soldering on something with surface mount (see SOIC area in upper left below):
              protoshield.jpg
              Unfortunately, there are only 7 pads on the SOIC that I can solder it to, and the ground pin is on the end, with the IRQ next to it.
              pinout.jpg
              Not ideal! Should I try soldering a wire to the ground pin but solder the rest of the pins to the SOIC pads on the prototyping board? Seems like that may be the cleanest way to do it.

              That might be fine if using an Uno, but what about if using a pro mini? How best to connect it then? Anyone here already doing it?

              As a ghetto method I could also run jumper pins through each through-hole and solder into place, and then run each wire to the proper pin on the pro mini and solder into place, but... not very elegant. Are there better ways I'm not aware of?

              1 Reply Last reply
              0
              • NeverDieN Offline
                NeverDieN Offline
                NeverDie
                Hero Member
                wrote on last edited by
                #47

                Anyone know by what method Nordic prints the lettering on the chips? In looking at Yveaux's CSI-like photos, from chip-to-chip all of the letters have some amount of black mixed in, but on some they seem to be gaps left by air bubbles (so you're seeing through paint gaps to the black background) from the lettering being sprayed on, and on others the black seems like black dust or or something that was sprinkled on top after the lettering was applied. So, if you look closely through a microscope, some differences do seem to emerge. Under magnification, the lettering on the 1331AF is visibly sloppy, almost as if printed by a professional cake decorator from your local bakery.

                Anyone know what some of the other lettering is supposed to mean? e.g. M, AF, EV, CH, A, 0, CL, AE, DQ, FJ, or FY? On Hek's genuine chip, it seems blank after the NRF, whereas that's not true for any of the other chips.

                YveauxY 1 Reply Last reply
                0
                • SparkmanS Offline
                  SparkmanS Offline
                  Sparkman
                  Hero Member
                  wrote on last edited by
                  #48

                  My "regular" modules were bought from gc_supermarket and the NRF chips all have the following printing. There is no circle in the center of the +.

                  .
                  NRF  T
                  24L01+
                  1420JB
                  

                  My LNA/PA modules were bought from alice11011983 and the NRF chips have the following printing. There is a circle in the center of the + on the first set, but not the second set.

                  .
                  NRF  M
                  24L01+
                  1431FC
                  
                  .
                  NRF  O
                  24L01+
                  1417GP
                  

                  I'll try to grab some pics this weekend.

                  Cheers
                  Al

                  NeverDieN 1 Reply Last reply
                  0
                  • NeverDieN Offline
                    NeverDieN Offline
                    NeverDie
                    Hero Member
                    wrote on last edited by NeverDie
                    #49

                    Update: I provided Itead with my contact information, and they will try to arrange for a Nordic FAE to contact me.

                    As there's no telling how long the above might take to resolve, I decided to roll the dice again and ordered three of these modules:

                    red1.JPG
                    red2.JPG
                    I hope to receive them by later in the week. I'm hopeful, but only slightly optimistic. If there's interest, I'll post closeups after I receive and test them.

                    I also ordered more blob modules, but from a different source than the two I already have, so who knows what I'll actually receive. If it turns out blob modules from different sources are all about the same, I might standardize on that and simply move on. The two that I have work well enough that I wouldn't mind doing that, though it may put me on a fork from the rest of you. My only reluctance is that we'd all be more productive if we can find some way to leverage a common platform, so that remains my preference (and hope) for the long-term.

                    1 Reply Last reply
                    0
                    • NeverDieN NeverDie

                      Anyone know by what method Nordic prints the lettering on the chips? In looking at Yveaux's CSI-like photos, from chip-to-chip all of the letters have some amount of black mixed in, but on some they seem to be gaps left by air bubbles (so you're seeing through paint gaps to the black background) from the lettering being sprayed on, and on others the black seems like black dust or or something that was sprinkled on top after the lettering was applied. So, if you look closely through a microscope, some differences do seem to emerge. Under magnification, the lettering on the 1331AF is visibly sloppy, almost as if printed by a professional cake decorator from your local bakery.

                      Anyone know what some of the other lettering is supposed to mean? e.g. M, AF, EV, CH, A, 0, CL, AE, DQ, FJ, or FY? On Hek's genuine chip, it seems blank after the NRF, whereas that's not true for any of the other chips.

                      YveauxY Offline
                      YveauxY Offline
                      Yveaux
                      Mod
                      wrote on last edited by
                      #50

                      @NeverDie said:

                      Did you use the microscope for the module shots also, or just the NRF chip

                      Only the chips were shot using my microscope. The field of view is simply too small to shoot the whole module.

                      Only > Since you have a nice module collection that spans different NRF chips and also different module types, have you noticed whether any of your modules stand out head-and-shoulders above the others as having clearly better performance?

                      No, but I had troubles mixing different modules in the past (even the NO_ACKs were involved iirr), so I'm very interested to know which ones are genuine.

                      http://yveaux.blogspot.nl

                      YveauxY 1 Reply Last reply
                      0
                      • YveauxY Yveaux

                        @NeverDie said:

                        Did you use the microscope for the module shots also, or just the NRF chip

                        Only the chips were shot using my microscope. The field of view is simply too small to shoot the whole module.

                        Only > Since you have a nice module collection that spans different NRF chips and also different module types, have you noticed whether any of your modules stand out head-and-shoulders above the others as having clearly better performance?

                        No, but I had troubles mixing different modules in the past (even the NO_ACKs were involved iirr), so I'm very interested to know which ones are genuine.

                        YveauxY Offline
                        YveauxY Offline
                        Yveaux
                        Mod
                        wrote on last edited by
                        #51

                        @NeverDie said:

                        Anyone know by what method Nordic prints the lettering on the chips?

                        Yes, it's in the data sheet. The date code is in YYWWLL which stands for year & week of production, an LL indicates wafer lot. The top right code indicates the production location (first letter) followed by optional letter indicating engineering sample.

                        Nordic is fabless so only they know what the location letters mean.

                        The text is normally written using a laser scriber, so no ink is involved.
                        Thinking of it, differences in font/thickness etc. can be caused by different laser scribers at different production facilities (or even within one facility) so I'm starting to doubt if it will help us in distinguishing fakes from genuine.

                        http://yveaux.blogspot.nl

                        NeverDieN 1 Reply Last reply
                        0
                        • YveauxY Yveaux

                          @NeverDie said:

                          Anyone know by what method Nordic prints the lettering on the chips?

                          Yes, it's in the data sheet. The date code is in YYWWLL which stands for year & week of production, an LL indicates wafer lot. The top right code indicates the production location (first letter) followed by optional letter indicating engineering sample.

                          Nordic is fabless so only they know what the location letters mean.

                          The text is normally written using a laser scriber, so no ink is involved.
                          Thinking of it, differences in font/thickness etc. can be caused by different laser scribers at different production facilities (or even within one facility) so I'm starting to doubt if it will help us in distinguishing fakes from genuine.

                          NeverDieN Offline
                          NeverDieN Offline
                          NeverDie
                          Hero Member
                          wrote on last edited by
                          #52

                          @Yveaux said:

                          @NeverDie said:

                          Anyone know by what method Nordic prints the lettering on the chips?

                          Yes, it's in the data sheet. The date code is in YYWWLL which stands for year & week of production, an LL indicates wafer lot. The top right code indicates the production location (first letter) followed by optional letter indicating engineering sample.

                          Nordic is fabless so only they know what the location letters mean.

                          The text is normally written using a laser scriber, so no ink is involved.
                          Thinking of it, differences in font/thickness etc. can be caused by different laser scribers at different production facilities (or even within one facility) so I'm starting to doubt if it will help us in distinguishing fakes from genuine.

                          Thanks for pointing that out. Looking at the version 1.0 spec sheet (available at http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01P), I see it covered in section 13.1 and 13.2.

                          Curiously, according to the spec sheet, the chips should be marked "nRF", not "NRF".

                          YveauxY 1 Reply Last reply
                          0
                          • NeverDieN NeverDie

                            @Yveaux said:

                            @NeverDie said:

                            Anyone know by what method Nordic prints the lettering on the chips?

                            Yes, it's in the data sheet. The date code is in YYWWLL which stands for year & week of production, an LL indicates wafer lot. The top right code indicates the production location (first letter) followed by optional letter indicating engineering sample.

                            Nordic is fabless so only they know what the location letters mean.

                            The text is normally written using a laser scriber, so no ink is involved.
                            Thinking of it, differences in font/thickness etc. can be caused by different laser scribers at different production facilities (or even within one facility) so I'm starting to doubt if it will help us in distinguishing fakes from genuine.

                            Thanks for pointing that out. Looking at the version 1.0 spec sheet (available at http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01P), I see it covered in section 13.1 and 13.2.

                            Curiously, according to the spec sheet, the chips should be marked "nRF", not "NRF".

                            YveauxY Offline
                            YveauxY Offline
                            Yveaux
                            Mod
                            wrote on last edited by
                            #53

                            @NeverDie said:

                            Curiously, according to the spec sheet, the chips should be marked "nRF", not "NRF".

                            Maybe they hoped the copycats would also copy this error, but unfortunately they didn't :facepunch:

                            http://yveaux.blogspot.nl

                            1 Reply Last reply
                            0
                            • SparkmanS Sparkman

                              My "regular" modules were bought from gc_supermarket and the NRF chips all have the following printing. There is no circle in the center of the +.

                              .
                              NRF  T
                              24L01+
                              1420JB
                              

                              My LNA/PA modules were bought from alice11011983 and the NRF chips have the following printing. There is a circle in the center of the + on the first set, but not the second set.

                              .
                              NRF  M
                              24L01+
                              1431FC
                              
                              .
                              NRF  O
                              24L01+
                              1417GP
                              

                              I'll try to grab some pics this weekend.

                              Cheers
                              Al

                              NeverDieN Offline
                              NeverDieN Offline
                              NeverDie
                              Hero Member
                              wrote on last edited by
                              #54

                              @Sparkman said:

                              My "regular" modules were bought from gc_supermarket and the NRF chips all have the following printing. There is no circle in the center of the +.

                              .
                              NRF  T
                              24L01+
                              1420JB
                              

                              My LNA/PA modules were bought from alice11011983 and the NRF chips have the following printing. There is a circle in the center of the + on the first set, but not the second set.

                              .
                              NRF  M
                              24L01+
                              1431FC
                              
                              .
                              NRF  O
                              24L01+
                              1417GP
                              

                              I'll try to grab some pics this weekend.

                              Cheers
                              Al

                              Hi Al,
                              Funny that you happen to mention gc_supermarket, because just yesterday I was noticing that they had good pricing on blob modules. These visually resemble the two blob modules I have and which seem to perform quite well at 1mbps air datarate. Intriguingly, the listing title says "Power enhanced version Compatible NRF24L01" and in the description it says:
                              "This module is design to solve the problem of small power in NRF24L01 module, its distance is far away than NRF24L01
                              Please download the data in below link
                              http://www.ai-thinker.com/forum.php?mod=viewthread&tid=411&extra=page%3D1 "

                              It would be easy to dismiss this as gibberish or as a failed attempt at chinglish, except for the fact that my two blob modules do, in fact, seem to have much better range than any of the "regular" NRF24L01+ modules I've tried so far. So, whether deserved or not, that does seem to give gc_supermarket more credability in my eyes than a lot of other re-sellers. Also, whether by luck or intent, they referred to it as "NRF24L01", not "NRF24L01+", which is also closer to reality, as it doesn't support 250kbps. So, in my book they get some credibility points for that also.

                              Have your transactions to date with gc_supermarket gone well?

                              SparkmanS 1 Reply Last reply
                              0
                              • NeverDieN NeverDie

                                @Sparkman said:

                                My "regular" modules were bought from gc_supermarket and the NRF chips all have the following printing. There is no circle in the center of the +.

                                .
                                NRF  T
                                24L01+
                                1420JB
                                

                                My LNA/PA modules were bought from alice11011983 and the NRF chips have the following printing. There is a circle in the center of the + on the first set, but not the second set.

                                .
                                NRF  M
                                24L01+
                                1431FC
                                
                                .
                                NRF  O
                                24L01+
                                1417GP
                                

                                I'll try to grab some pics this weekend.

                                Cheers
                                Al

                                Hi Al,
                                Funny that you happen to mention gc_supermarket, because just yesterday I was noticing that they had good pricing on blob modules. These visually resemble the two blob modules I have and which seem to perform quite well at 1mbps air datarate. Intriguingly, the listing title says "Power enhanced version Compatible NRF24L01" and in the description it says:
                                "This module is design to solve the problem of small power in NRF24L01 module, its distance is far away than NRF24L01
                                Please download the data in below link
                                http://www.ai-thinker.com/forum.php?mod=viewthread&tid=411&extra=page%3D1 "

                                It would be easy to dismiss this as gibberish or as a failed attempt at chinglish, except for the fact that my two blob modules do, in fact, seem to have much better range than any of the "regular" NRF24L01+ modules I've tried so far. So, whether deserved or not, that does seem to give gc_supermarket more credability in my eyes than a lot of other re-sellers. Also, whether by luck or intent, they referred to it as "NRF24L01", not "NRF24L01+", which is also closer to reality, as it doesn't support 250kbps. So, in my book they get some credibility points for that also.

                                Have your transactions to date with gc_supermarket gone well?

                                SparkmanS Offline
                                SparkmanS Offline
                                Sparkman
                                Hero Member
                                wrote on last edited by
                                #55

                                @NeverDie said:

                                Have your transactions to date with gc_supermarket gone well?

                                Overall yes. First shipment from them got lost, but they replaced the shipment right away without any argument and it showed up ok. The modules seem to be a good quality with nice soldering and the flux cleaned up properly. I haven't done any packet loss testing with them, but have had good range with them (@250kbps).

                                Cheers
                                Al

                                1 Reply Last reply
                                0
                                • NeverDieN Offline
                                  NeverDieN Offline
                                  NeverDie
                                  Hero Member
                                  wrote on last edited by NeverDie
                                  #56

                                  Here's a link which lists chips similar to the NRF24L01+ (there are many more than I had supposed), and it also highlights some of their differences: http://sigrok.org/wiki/Protocol_decoder:Nrf24l01
                                  Especially useful is the mirror of the datasheets.

                                  I have a hunch that a simple way to differentiate among the various chips might be to measure the amount of current consumed in various modes (e.g. standby, powerdown, etc), because those numbers are also given in the datasheets. Anyone tried that?

                                  1 Reply Last reply
                                  0
                                  • NeverDieN Offline
                                    NeverDieN Offline
                                    NeverDie
                                    Hero Member
                                    wrote on last edited by NeverDie
                                    #57

                                    I just placed an order on Ali Express for four NRF24L01+ modules that look similar to the one Hek says is genuine: http://www.aliexpress.com/item/Free-shipping-Original-Genuine-NRF24L01-Wireless-Module-2-4G-wireless-communication-module-2-54mm-Interface-2/1781618813.html I mainly picked this seller because he will be sending by ePacket for only 4 cents extra, and that should mean much faster delivery (5 to 15 days). Also, the seller has decent feedback and is promising that the chips are "original" and "genuine." So, with shipping, the modules will be costing me an average of $2.82 each. I hope they're worth not just the money, but also the wait.

                                    I would have preferred to first receive and then test the modules I've already ordered to see if they are genuine, but given the shipping time from Asia, I'm doing parallel orders in the hope of getting at least one shipment of genuine NRF24l01+ modules up and working fairly soon. Doing the orders serially would have run the risk of the procurement process taking too long.

                                    1 Reply Last reply
                                    0
                                    • F Offline
                                      F Offline
                                      Fabien
                                      wrote on last edited by
                                      #58

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

                                      NeverDieN 1 Reply Last reply
                                      0
                                      • OitzuO Offline
                                        OitzuO Offline
                                        Oitzu
                                        wrote on last edited by Oitzu
                                        #59

                                        I ordered some surface-mounted by accident.
                                        2015-07-29 10.04.56.jpg

                                        The reading say:
                                        NRF M
                                        24L01+
                                        1436AH

                                        They seem to work fine, but if somebody has an packet-loss testing sketch i would test it.

                                        1 Reply Last reply
                                        0
                                        • F Fabien

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

                                          NeverDieN Offline
                                          NeverDieN Offline
                                          NeverDie
                                          Hero Member
                                          wrote on last edited by NeverDie
                                          #60

                                          @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/a

                                          The 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!

                                          parachutesjP 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          8

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular