nRF24L01 wireless transceiver module Arduino

nRF24L01 is a work in the world-wide 2.4 ~ 2.5GHz ISM band single-chip wireless transceiver chip。Wireless transceiver comprising:Frequency generator、Enhanced SchockBurstTM Mode Controller、PA、Crystal Oscillator、Modulator、Demodulator。Set the output power and channel selection protocol can be set via the SPI interface。

Easy setup and low power consumption so that it is widely used in wireless mouse、Keyboard;Wireless Access、A variety of intelligent communications networking equipment, etc.。

Parameters

  • Supply voltage:1.9 V~3.6V;
  • Maximum transmit power:0 dBm;
  • The maximum data transfer rate:2000 kbps;
  • Transmit mode current consumption(0When dBm):11.3 but;
  • Receive mode current consumption(2000kbps):12.3 but;
  • Receive mode data transfer rate of 1000kbps under sensitivity:-85 dBm;
  • Power-down mode current consumption:900 nA。

link

We borrow the forum is about wiring photos here:

nRF24L01 wireless transceiver module

nRF24L01 wireless transceiver module

  • VCC <-> 3.3V
  • GND <-> GND
  • THIS <-> D9
  • CSN <-> D10
  • DAWDLE<-> D11
  • MISO<-> D12
  • SCK <-> D13
  • IRQ <-> Do not take

experiment

Since nRF24L01 is full duplex communication module,Therefore, each module can do both the sender can do the receiving end。Here we goDownload Library Mirfspare。

The first is the initial configuration:

Of course,This is the sender,Here is the receiving end of a similar,Just change the address to the corresponding:

Mirfa.init()Once invoked,Front setting that is unchangeable,However, the name of the transmission and reception、Window size,Channel, etc. can all be changed in real time,Here we do not do code demonstrates,From now on,Let's write a simple echo - ie the sender to send our pre-written B string,A string immediately after receiving the content sent back to B。

Here, we first list what Mirf libraries commonly used method:

  • Mirfa.isSending() It returns a boolean displays the current chip is sending information;
  • Mirfa.send() Send a byte array,That string must be converted to send;
  • Mirfa.getData() Get the information received from the chip,It is also a byte array;
  • Mirfa.dataReady() To determine whether the chip has received information。

Since the transmission and reception of data you want to convert some complex data types directly rather than send strings,Here we package the two functions to perform this function:

Such,This function will receive a good package,Now we come to realize the function,First, the sender:

Then receiving (echo) end:

Next is the code for these two different brush each in two different Arduino Development board,Energized simultaneously,You can see the result in the serial terminal!

characteristic

One thing we would like to mention here,The wireless module is supported nRF24L01Mixed Interconnectof,That is,It is one of those"Propaganda"mode,That multiple modules use the same receiver identifies no problem,If you do,They will each receive an identical message。As long as the window size is consistent with the same channel,Then the module will receive the corresponding address information without conflict。

It does not implement any function of the upper layer,In addition to the most basic bit transmission and reception outside,Any other advanced features you need to complete on their own (such as slicing、Retransmission and other similar TCP / IP functionality)。

Speaking transmission distance,Use module comes with a small antenna, then,Really not very far。

metaphysics

2017 year 11 moon 14 On the afternoon 2:13

The students are given a solution,But I have not tested conditions,I hope everyone has to help。 :)

Finally add,The execution order of code sends the address and the recipient address is not the same transceiver module,For example, this:

Then the final result is that the two modules can not communicate - you have to put them in order to change,Like this:

 

Original article written by LogStudio:R0uter's Blog » nRF24L01 wireless transceiver module Arduino

Reproduced Please keep the source and description link:https://www.logcg.com/archives/1823.html

About the Author

R0uter

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Comments

  1. Hello bloggers,I tried your code,About metaphysics section,In fact, the two issues that address the definition of a long name on the solution of the decision,And the receiving terminal may not necessarily be defined in the initialization address,As long as the receiving end address is defined before execution Functions,This can be done one to many communication

  2. Hello,Glad to see your blog,I am now a floating-point data transmission via arduino and nrf24l01,Will the floating-point data such as sending "21.23",I am using this floating-point data by sending after shaping into 100 21.23 or can be directly converted to a string sent?

    1. Can,Theoretically float can also directly interchangeable with string,You can use C ++ try,If you can convert,You do not have to convert plastic。But one thing,If you really need to float a fixed format,The sub-string or handle it better。

Leave a Reply

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