New Project

CONNECT

Arduino Using NRF24L01 Rf Module

  • Page Views 10983
  • Spread the love
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  

    We use two Arduino communicating Bluetooth or RF modules.In this project I will talk about the arduino using NRF24L01 transceiver module.
    You can use it easily to your use of this module is very easy and good range of projects.In addition, power consumption and price in .LOW 2.4GHz frequency operation gives us the advantage.

     

     

    NRF24L01 2.4GHz Transceiver Module:

    • Picture of NRF24L01 2.4GHz Transceiver Module
      nrf24L01 modul.jpg Pcb module and an external antenna models are available.While the range of PCB model can go up to 250 m to 1000 m in range external antenna model.
    • Bi-directional communication by both the buyer to make your project can use both the transmitter module.

     

    • Modülün Pin Bağlantıları:

     

    The module communicates using SPI protocol.Therefore, you should make looking at the arduino pin connector model SPI pins. Let’s show the pin connections with Arduino UNO as an example.

    nRF24L01  Arduino Uno
    VCC 3.3 V
    GND GND
    CS 7
    CE 8
    MOSI 11
    MISO 12
    SCK 13

     

    One of the other receiver of the wireless communication module when you need to set the transmitter.A module according to status of the project can also be used if desired both the transmitter and receiver. In case the receiver or transmitter module that does not change the cable connection. These connections are the same for all situations.

    Sample Applications:

     

    Wireless servo motor control with potentiometer

    You can make the necessary connections by looking at the receiver and transmitter circuit in Fig.A receiver module for other modules of the software will also perform data transfer by identifying the wireless transmitter.

    Transmitter Software:

    #include <SPI.h>
    #include <nRF24L01p.h>
    nRF24L01p verici(7,8);
    /* CSN - > 7, CE -> 8 olarak belirlendi */
     
    int pot=A0;
    int val;
    char pos;
     
    void setup() {
     Serial.begin(9600);
     SPI.begin();
     SPI.setBitOrder(MSBFIRST);
     /* SPI başlatıldı */
     verici.channel(90);
     verici.TXaddress("kontrol");
     verici.init();
     /* Verici ayarları yapıldı */
    }
    void loop() {
     val = analogRead(pot); /* pot değeri okuma */
     pos= map(val,0,1023,0,180);/* servo açısına çevirme */
     Serial.print("Servo = ");
     Serial.print(pos);
     Serial.println(" derece");/* Açı bilgileri ekrana yazdırıldı */
     
     verici.txPL(pos);
     boolean gondermedurumu = verici.send(FAST);
     /* açı bilgisi nRF24L01'e aktarıldı */
     /* Eğer gönderim başarısız olursa göndermedurumu'nun değeri false olacaktır */
     if(gondermedurumu==true){
     Serial.println("mesaji gonderildi");
     }else{
     Serial.println("mesaji gonderilemedi");
     }
     
     delay(1000); 
    }

    Receiver Software:

    #include <SPI.h>
    #include <nRF24L01p.h>
    #include <Servo.h>
    nRF24L01p alici(7,8);
    /* CSN - > 7, CE -> 8 olarak belirlendi */
    Servo servo1;
    void setup(){
    Serial.begin(9600);
    SPI.begin();
    SPI.setBitOrder(MSBFIRST);
    /* SPI başlatıldı */
    alici.channel(90);
    alici.RXaddress("kontrol");
    alici.init();
    /* Alıcı ayarları yapıldı */
    servo1.attach(9);
    }
    
    char deger;
    
    void loop(){
    while(alici.available()){
    /* Modülden veri geldiği sürece while devam edecek */
    alici.read();
    alici.rxPL(deger);
    
    servo1.write(deger);
    }
    }

    Description of function:

    First we need to define the CE Software and CSN pins.
    nrf24l01p attractive (7.8); >> Here’s command 7.p the CSN 8.p is defined as the CE pin. In this function on behalf of the receiver module “receiver” We named.

    nrf24l01p transmitter (7,8); >> Here’s command 7.p the CSN 8.p is defined as the CE pin. On behalf of transmitter modules in this function “transmitter” We named.

    SPI protocol to communicate with the library SP added SPI.begin(); The setup communications function is started by writing into.

    alici.channel (90); >> defined communication channel value of 90 yaptık.b receiver module in the setup value should be the same value in both modules. Values between 0 and 125 can be written.

    verici.channel (90);>> we do  the value defined in the setup, the communication channel 90 transmitter module. This value can be written in the same value range from 125 olmalıdır.0 in both modules.

    alici.rxaddress (” control “); >> We set the receiver module with the function name and address to the “control” gave the name.

    verici.txaddress (” control “); >> we set this function with the name and address of the transmitter module to the “control” gave the name. The two modules also address the communication channel name and value must be the same.

    Important Note: Module communication between both modules also can not be obtained between VCC and GND pins and placing it between 10 uF 3.3 uF capacitor in the value and try again.

    Share

    8 Comments For "Arduino Using NRF24L01 Rf Module"

    1. Larry Adams
      October 18, 2015

      Salama leckium.

      I have question.
      What Arduino software to use? SPI only? Can you say how to do this using esp8266-12 nodemcu ?

      Thank you!

      Reply
      • October 18, 2015

        Yup, that module is the same as the spin of pins

        Reply
    2. Larry Adams
      November 13, 2015

      Hello
      could you please give a link to the NRF library you are using for this project?

      thank you!

      Reply
    3. sunny
      February 4, 2016

      i’m using arduino mega to drive 10 servo and on the other side 10 poteniometer to control them independently
      could u tell me the where i have to change the code ..or could u please send me the code of both the receiver end and the transmitter end to control the 10 servo with 10 potentiometer

      Reply
    4. andrew lin
      April 26, 2016

      yeah!!!
      great work

      i was also wondering how we control multiple servos with this?

      Reply
    5. walner gomez
      August 29, 2016

      very nice aplication , do you have the libraries related to this code apliation? thanks

      Reply
    6. Federico
      December 14, 2016

      Hello, great work and very well explained.
      Have long RC model aircraft, but just starting out with Arduino.
      I possess different TX RX ilm but my dream would be to build one customized.
      So I was wondering if you can expand your code bringing it to 4 or 6 channels.
      I thank you for your response and for the time you want to devote.
      Greetings
      Federico

      Reply

    Leave a comment

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

    BE A FACEBOOK FAN

    Instagram