Nrf24l01 transceivers

Hi,
so I am trying to make a robot with a transmitter and reserve. I am using nrf24l01+ PA/LNA transceivers (the one with the antenna). The transceivers to connect but they will not send data. if you have any ideas please comment.
transmitter code



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

RF24 radio(7, 8); // CE, CSN
int state = 1;
const byte address[6] = "00001";

void setup() {
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MAX);
  radio.stopListening();
}

void loop() {
  
  radio.write(&state, sizeof(state));
  delay(1000);
}

receiver code



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

RF24 radio(7, 8); // CE, CSN
int state = 0;
const byte address[6] = "00001";
int led = 12;
int ledno = 11;
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MAX);
  radio.startListening();
  pinMode(led, OUTPUT);
  pinMode(ledno, OUTPUT);
}

void loop() {
  if (radio.available()) {
    digitalWrite(ledno, LOW);
    radio.read(&state, sizeof(state));
  }else{
    digitalWrite(ledno, HIGH);
    delay(1000);
  }
  if (state == 1){
    digitalWrite(led, HIGH);
  } else {
    digitalWrite(led, LOW);
  }
}

Surprisingly, most of the time this issue is caused by insufficient current supply to the radio modules. Did you try running the library example sketches?

1 Like

yes, and I used a capacitor they both did not work

@free2create Installation and Troubleshooting is for Problems with the Arduino itself NOT your project. It says so in the description of the section. Therefore I have moved your post here. Please be more careful where you post in future.

You may want to read this before you proceed:-
how to get the best out of this forum

A capacitor is no cure for an insufficient power supply.

Hi,

I think you will need more than the 5V from the Arduino top power those units which have a built in Power Amplifier.
Do you have a DMM.
Can you please measure the voltage at the NRF of your transmit end when you signal it to transmit?
A schematic of both units will help also?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

I have been using 3.3v because that is what it said to use i will try 5v to see what happens.

You need to get the example sketches working FIRST.

Scroll down through Robins examples to the Connection Test sketch and try that first of all. You need this sketch to work on both devices before attempting to use any other sketches.

The NRF24L01 modules run of 3V3. Do you have an adapter board that drops the 5V down to 3V3?

Which Arduino are you using?

EDIT: Connection Test is post #30 in this discussion.

Hi,

Can you please post an image(s) of your project, we need to see what your NRF has.
Some come with a 5V to 3V3 pcb.
If yours hasn't then stay with 3V3.

What model Arduino are you using, if a UNO or Nano, then the 3V3 supply pin will not be able to supply enough current.
Measure the 3V3 at the NRF when it is trying to transmit.

Tom... :grinning: :+1: :coffee: :australia:

:open_mouth:
Without a 3.3V regulator (some breakouts have them) this will fry your NRF24L01!

Can you post a schematic / images of you project?

Also, the NRF24L01 needs a ~10µF cap directly next to the VCC and GND pins of the NRF24L01.

I am not using the boards and I am using Arduino Uno and Mega

this is what i got with the that test sketch

when I run the example sketch it is saying the hardware is not responding on both.

Here are the top things that I learned while trying to get my radios to work:

If you read and, closely, follow Robin2's simple rf24 tutorial you should be able to get them working. That tutorial sure helped me. Run the CheckConnection.ino (look in reply #30) to verify the physical wiring between the radio module and its processor (Arduino).

Make sure the rf24 power supply can provide enough current. This is especially true for the high power (external antenna) modules. I use homemade adapters like these. They are powered by 5V and have a 3.3V regulator on the board. Robin2 also has suggested trying with a 2 AA cell battery pack.

If using the high powered radios make sure to separate them by a few meters. They may not work too close together. Try the lower power settings.

Reset the radios by cycling power to them after uploading new code. I have found that to help. They do not reset with the Arduino.

Switch to 1MB data rate to catch the not so cloned clones.
radio.setDataRate( RF24_1MBPS );

i have a pair of those boards but when i run the test it is all 0x00

You might have a wiring error. Please honour the requests in reply #8.

i have a pair of those boards but when i run

Do you see our problem here?

i have them but they don't work

and right now i have no project it is just the nrfs and arduinos

Enough one line responses please. Please provide the items requested in reply #8. Second time asking... a wiring diagram would be very helpful too, but I have a feeling you probably didn't make one. But it's not too late.

sorry I don't have the best hand writing