where to change code for NRF24L01



  • Hello everybody !

    Working on a project and I'm wondering where I can change some code.

    On the moment the wiring for a NRF24L01 is followed by instruction https://www.mysensors.org/build/connect_radio.

    But for a project of my i want to change the wiring for a smaller and better pcb design. In which file can i change the pins/wiring ?

    Thanks in advance ! 🙂


  • Mod

    You can change the pin directly in your sketch, by using #define. The example at https://www.mysensors.org/build/ethernet_gateway shows how to change the pins of the nrf, if you follow that the process should be fairly straightforward.



  • Hi,
    I am trying to use an Arduino Mega 2560 connected to several sensors.

    Browsing internet and also this forum, I found that the NRF24L01+ module needs to be connected in a different way (see here, i.e.

    CE 40 (instead of 9)
    CNS/CS 53 (instead of 10)
    MOSI 51 instead of 11
    MISO 50 instead of 12
    SCK 52 instead fo 13

    Then they suggest to change the CE and CS pins

    Reading this thread, it seems that I only need to add to my sketch these lines:

    #define RADIO_CE_PIN 40 // radio chip enable
    #define RADIO_CS_PIN 53 // radio SPI serial select

    MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_CS_PIN, RF24_PA_LEVEL);

    But it does not seem to work, as I still obtain "Radio init fail"

    Could you please help me?



  • @Maurizio-Collu

    Are you powering the NRF24L01+ from the 3.3V pin on the 2560? In that case make sure you're using a ELKO (4.7 - 10 uF should work) over 3.3V - GND!

    See this site: https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo

    The Arduino 2560 is more vulnerable for power glitches than the Arduino UNO

    BR,

    Boozz



  • @boozz Yes I'm using it, a 4.7 uF one, always use it also with the uno.

    The problem is not that I cannot transmit, the sketch does not even start to run, as it cannot initialise the radio.

    I think is a problem of pins



  • @Maurizio-Collu

    I've had it running by using the pin layout as described in the wiki site in my previous post. Of course I had to change the CS(N) pin in MyConfig.h (CS-pin to 53). Don't forget to put it back to original if you're using it on other arduino types !!

    As far as I can remember (it was more that a year ago when I tried this) that was the only change needed to get it working.

    See table below; use Mega2560 with RF24 library.

    0_1465043303879_pins.jpg

    Hope this helps.

    Boozz


 

336
Online

7.9k
Users

8.8k
Topics

93.8k
Posts