New Project

CONNECT

Arduino Using NRF24L01 Rf Module

  • Page Views 8812
  • 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

    What did they say ?

    10 Comment - "Arduino Using NRF24L01 Rf Module"

    avatar
    Sort:   The Newests | Ancients | Likes
    Larry Adams
    Visitor
    Larry Adams

    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!

    Larry Adams
    Visitor
    Larry Adams

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

    thank you!

    sunny
    Visitor
    sunny

    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

    andrew lin
    Visitor
    andrew lin

    yeah!!!
    great work

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

    walner gomez
    Visitor
    walner gomez

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

    Federico
    Visitor
    Federico

    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

    wpDiscuz

    BE A FACEBOOK FAN

    Instagram