Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. where to change code for NRF24L01

where to change code for NRF24L01

Scheduled Pinned Locked Moved Development
6 Posts 4 Posters 2.6k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Dennis van der HaveD Offline
    Dennis van der HaveD Offline
    Dennis van der Have
    wrote on last edited by
    #1

    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 ! :)

    1 Reply Last reply
    0
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • Maurizio ColluM Offline
        Maurizio ColluM Offline
        Maurizio Collu
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          boozz
          wrote on last edited by
          #4

          @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

          Maurizio ColluM 1 Reply Last reply
          0
          • B boozz

            @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

            Maurizio ColluM Offline
            Maurizio ColluM Offline
            Maurizio Collu
            wrote on last edited by
            #5

            @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

            B 1 Reply Last reply
            0
            • Maurizio ColluM Maurizio Collu

              @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

              B Offline
              B Offline
              boozz
              wrote on last edited by
              #6

              @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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              20

              Online

              11.7k

              Users

              11.2k

              Topics

              113.0k

              Posts


              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular