XIAO with Nrf24L01? Need help

Hey guys I’m new to the forum so I’m not sure if this is the correct place to post the question, but I have a bunch of XIAO boards and have been wanting to incorporate them into small projects as the size is optimal. So here’s my question,
Connecting the Nrf24L01 to xiao?

Project- I use arduino pro minis with NRF modules all over my shop and have a single controller that I use to trigger the relays on my devices. So I wanted to use the XIAO to make the controller smaller and use that as my transmitter-as it’s 3.3v and so is the NRF, I thought it would be a match made in heaven. So replacing all of my relay boards with XIAOs as well to make the enclosures as small as possible.

So what I did was load almost the identical code to my arduino units (transmitter and receivers) and they complied fine upload, yay. But are not triggering and I believe the nrf is not connected properly and also there may be special code to enable the SPI communication (SERCOM0 I believe) but there is no information online in regards to this board and the nrf24l01.

Any help would be awesome, I’ll post the code when I get to my computer. Also this project is as basic as it gets, transmitter with 2 switches and an NRF that switch on and off relays of other receivers around the shop.

Thanks in advance,
-Bobby

Code:

    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>

    #define buttonPin1 A0
    #define buttonPin2 A1

    int buttonState1 = 0;
    int buttonState2 = 0;

    RF24 radio(6, 7); // CE, CSN

    const byte address[6] = "00002";

    void setup() {
      pinMode(buttonPin1, INPUT);
      pinMode(buttonPin2, INPUT);
      Serial.begin(9600);
      radio.begin();
      radio.openWritingPipe(address);
      radio.setPALevel(RF24_PA_MIN);
      radio.stopListening();
    }
    void loop() {
      buttonState1 = digitalRead(buttonPin1);
      buttonState2 = digitalRead(buttonPin2);

      if (buttonState1 == 1)
      {
        buttonState1 = 1;
      }
      else  if (buttonState1 == 0)
      {
        buttonState1 = 0;
      }
      if (buttonState2 == 1)
      {
        buttonState2 = 3;
      }
      else  if (buttonState2 == 0)
      {
        buttonState2 = 2;
      }
      Serial.print(buttonState1);
      Serial.print("\t");
      Serial.println(buttonState2);
      radio.write(&buttonState1, sizeof(buttonState1));
      radio.write(&buttonState2, sizeof(buttonState2));
    }

@salman Please help him .

2 Likes

Hi @Bmazey, Can you please share the nRF24L01 module you are using and the connection diagram with the nRF24L01 module and XIAO? Thanks :slightly_smiling_face:.

1 Like

Salman, thanks for the response but I have everything working now! 1 nrf module was toasted and just swapped it out. To confirm for anyone curious like I was.

NRF PINS > XIAO
CE -> pin 6
CN -> pin 7
SCK -> pin 8
MISO -> pin 9
MOSI -> pin 10

I also used a single LD33v voltage regulator to provide power for both nrf/Xiao/3v Relays
You could also use a simple more efficient buck converter set to 3.3v

Thanks for the quick responses guys, i’m loving these XIAO boards, super tiny and really powerful. Also this forum is great!

2 Likes

Hi @salman @Baozhu . I am trying to connect NRF24L01 + modules to seeduino xiao board, set up one as transmitter and another as receiver and establish connection between them. However I am not able to find which pins of the nrf modules I should connect to which pins of the seeduino board. Can you please help me with this?