NRF24L01+ Setup With Arduino Nanos

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024
  • This video shows how to set up an NRF24L01+ module with Arduino Nanos.
    Don't forget to like, comment and subscribe.
    You can also follow me on Twitter here: / eman2000_yt

Комментарии • 32

  • @Eman2000
    @Eman2000  8 лет назад +11

    Receive Code:
    /* YourDuinoStarter Example: nRF24L01 Receive Joystick values
    - WHAT IT DOES: Receives data from another transceiver with
    2 Analog values from a Joystick or 2 Potentiometers
    Displays received values on Serial Monitor
    - SEE the comments after "//" on each line below
    - CONNECTIONS: nRF24L01 Modules See:
    arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
    1 - GND
    2 - VCC 3.3V !!! NOT 5V
    3 - CE to Arduino pin 9
    4 - CSN to Arduino pin 10
    5 - SCK to Arduino pin 13
    6 - MOSI to Arduino pin 11
    7 - MISO to Arduino pin 12
    8 - UNUSED
    - V1.00 11/26/13
    Based on examples at www.bajdi.com/
    Questions: terry@yourduino.com */
    /*-----( Import needed libraries )-----*/
    #include
    #include
    #include
    /*-----( Declare Constants and Pin Numbers )-----*/
    #define CE_PIN 9
    #define CSN_PIN 10
    // NOTE: the "LL" at the end of the constant is "LongLong" type
    const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe
    /*-----**( Declare objects )**-----*/
    RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
    /*-----**( Declare Variables )**-----*/
    int joystick[2]; // 2 element array holding Joystick readings
    float count = 0;
    float ok = 0;
    float sig = 0;
    void setup() /****** SETUP: RUNS ONCE ******/
    {
    Serial.begin(9600);
    delay(1000);
    Serial.println("Nrf24L01 Receiver Starting");
    radio.begin();
    radio.setDataRate(RF24_250KBPS);
    radio.openReadingPipe(1, pipe);
    radio.startListening();;
    }//--(end setup )---
    void loop() /****** LOOP: RUNS CONSTANTLY ******/
    {
    if ( radio.available() )
    {
    {
    // Fetch the data payload
    radio.read( joystick, sizeof(joystick) );
    Serial.print("X = ");
    Serial.print(joystick[0]);
    Serial.print(" Y = ");
    Serial.println(joystick[1]);
    ok ++;
    }
    }
    else
    {
    Serial.println("No radio available");
    }
    count ++;
    sig = (ok / count) * 100;
    Serial.print("percent of time signal is available ");
    Serial.print(sig);
    Serial.println("%");
    delay(250);
    }//--(end main loop )---
    /*-----**( Declare User-written Functions )**-----*/
    //NONE
    //*********( THE END )***********
    Transmit Code:
    /* YourDuinoStarter Example: nRF24L01 Transmit Joystick values
    - WHAT IT DOES: Reads Analog values on A0, A1 and transmits
    them over a nRF24L01 Radio Link to another transceiver.
    - SEE the comments after "//" on each line below
    - CONNECTIONS: nRF24L01 Modules See:
    arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
    1 - GND
    2 - VCC 3.3V !!! NOT 5V
    3 - CE to Arduino pin 9
    4 - CSN to Arduino pin 10
    5 - SCK to Arduino pin 13
    6 - MOSI to Arduino pin 11
    7 - MISO to Arduino pin 12
    8 - UNUSED
    -
    Analog Joystick or two 10K potentiometers:
    GND to Arduino GND
    VCC to Arduino +5V
    X Pot to Arduino A0
    Y Pot to Arduino A1
    - V1.00 11/26/13
    Based on examples at www.bajdi.com/
    Questions: terry@yourduino.com */
    /*-----**( Import needed libraries )**-----*/
    #include
    #include
    #include
    /*-----**( Declare Constants and Pin Numbers )**-----*/
    #define CE_PIN 9
    #define CSN_PIN 10
    #define JOYSTICK_X A0
    #define JOYSTICK_Y A1
    // NOTE: the "LL" at the end of the constant is "LongLong" type
    const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe
    /*-----**( Declare objects )**-----*/
    RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
    /*-----**( Declare Variables )**-----*/
    int joystick[2]; // 2 element array holding Joystick readings
    void setup() /****** SETUP: RUNS ONCE ******/
    {
    Serial.begin(9600);
    radio.begin();
    radio.setDataRate(RF24_250KBPS);
    radio.openWritingPipe(pipe);
    }//--(end setup )---
    void loop() /****** LOOP: RUNS CONSTANTLY ******/
    {
    joystick[0] = analogRead(JOYSTICK_X);
    joystick[1] = analogRead(JOYSTICK_Y);
    radio.write( joystick, sizeof(joystick) );
    }//--(end main loop )---
    /*-----**( Declare User-written Functions )**-----*/
    //NONE
    //*********( THE END )***********

  • @giglu3
    @giglu3 Год назад

    thx brother you the best i was sitting a whole day with it and you finnaly helped me. For every one that has a problem with it don't working try pluging in one and onother arduino to powerbank with 5v it could be a power problem. To test it just plug joystick to transmiter and servo to reciver and paste this in reciver between Serial.print(joystick[0]); and Serial.print(" Y = "); it is in void loop
    joystick[0] = map(joystick[0], 0, 1023, 0, 180); // scale it for use with the servo (value between 0 and 180)
    myservo.write(joystick[0]); // sets the servo position according to the scaled value
    delay(1);
    don't forget to add library to reciver
    #include
    and another time thx

  • @heinhtetsoe63
    @heinhtetsoe63 6 лет назад

    Thanks a lot man..Finally i've got how to prepare and code for tranciever

  • @henrychoquemaquera5097
    @henrychoquemaquera5097 7 лет назад

    Hi, I love the video about the NRF24L01 is very good ..... if it is not much trouble I do not know if I could clarify a doubt I have which is: How could I use the NRF24L01 in an external interrupt that has the arduino?
    Thank you

  • @freecrypto5263
    @freecrypto5263 3 года назад

    How much is the capacitor and how much is used in the NRF24I1?

  • @austincroft6992
    @austincroft6992 5 лет назад +2

    Hey, I am trying to test your code, and the serial monitor on the receiving end tells that
    "percent of time signal is available 100.00%
    X = 0 Y = 0
    "
    I am not sure where to go from here. Anyone know anything that could help?

    • @Eman2000
      @Eman2000  5 лет назад

      Are you sure the NRF boards are wired right and working? Maybe try code from the library examples to test them. Usually when I had issues like that it was from hardware problems.

    • @austincroft6992
      @austincroft6992 5 лет назад

      @@Eman2000
      I don't think it's a hardware problem. It behaves as though the arduino acknowledges that the transmitter is there, but it won't transfer the data. My transmitter is an arduino Uno board, and my receiver is an arduino Nano board.

    • @Eman2000
      @Eman2000  5 лет назад

      Turn off the transmitter and see it it still says its receiving something.

    • @austincroft6992
      @austincroft6992 5 лет назад +1

      @@Eman2000
      I did that last night, and it then told me that there was no radio available.

    • @coolwizard1582
      @coolwizard1582 3 года назад +1

      same here

  • @myonline88
    @myonline88 6 лет назад +1

    Can you help me? I have a problem. I have built few Arduino robots using NRF24L01 modules, the robot runs very slow when I make it move forward or backward, but faster when I move it let or right. When I turn the Autonomous mode, it runs fast. It seems that it becomes slower when controlled by NRF24L01. My robot runs also fast when I use bluetooth module.

    • @Eman2000
      @Eman2000  6 лет назад

      sounds like there is something in the code that is turning the motors back off instead of leaving them on when you use the NRF module.

    • @myonline88
      @myonline88 6 лет назад

      If I tried to switch the joystick assignment from X-axis to Y axis from the TX arduino (will exchange the TurnRight to Forward dc motion), the robot runs faste forward and backwardr, but the TurnRight and TurnLeft now runs very slow. It seems to slows down one direction or the other.

    • @daisybristow7036
      @daisybristow7036 6 лет назад

      is this robot using a single joy stick? do you have the coding to share please?

    • @myonline88
      @myonline88 6 лет назад

      give me your email address

    • @myonline88
      @myonline88 6 лет назад

      here is the sample video of it. The T300 tank robot using a DIY thumb joystick and few pots. /watch?v=KeQAiAUj8b8

  • @durgamanil
    @durgamanil 5 лет назад

    why your connecting capacitor at pin1(gnd) and pin2(vcc)...please tell me the reason and which value capacitor is best

    • @Eman2000
      @Eman2000  5 лет назад

      It's not really necessary, but it helps if the power supply for the board isn't very stable. Value isn't too important. Something around 10uf should be more than enough.

  • @Mrtt4
    @Mrtt4 5 лет назад +1

    Can u share that circuit diagram?

  • @abhinavmishra4290
    @abhinavmishra4290 5 лет назад

    What is the capacitance and voltage of the capacitors used.
    I m not using any capacitors, and my circuit is not working.. It is not showing any signals as I m sending hello and receiving it from other end.. But it does nothing.
    Is this becoz of capacitors???
    Plz reply...
    And provide the details of capacitor..

  • @szczurek9459
    @szczurek9459 6 лет назад

    Hi, following your tutorial I've built both circuits, downloaded your sketches and everything seemed to work for a tiny bit. Shortly after a small victory of finally being able to set up these two little demons I have ran into an issue; I would no longer recieve any signals... sometimes when I touched the antena or put both antenas in a specific position I would get signal coming in for a second or two and loose it again. Would you be able to give me any advice on why this is happening? Thanks in advance.

    • @francoisguyot789
      @francoisguyot789 5 лет назад

      Same problem

    • @WaterDisplayed
      @WaterDisplayed Год назад

      Hi there ! If you still need a solution, you should use an independent source for the nrf24l01 combined with a step down 3V3 circuit. That problem emerges because of the demanding current required by the nrf

    • @WaterDisplayed
      @WaterDisplayed Год назад

      Also a suitable solution is the capacitor that he used, because of the variations the board has on source pin.

  • @FPChris
    @FPChris 4 года назад +1

    Pulling my hair out.

    • @timmyg37
      @timmyg37 2 года назад

      I have no hair left.. fuck this shit... one day it works.. the next day it don't...fuckkkkkkk

  • @hemantverma267
    @hemantverma267 6 лет назад

    PLZZ provide us codes

    • @Eman2000
      @Eman2000  6 лет назад

      Check the pinned comment