nRF24l01 - Transmitter LED INDICATOR

Hello Dear Friends, my english is not very good but i know You will know me :slight_smile:

I have two Arduino Nano's and 2 nRF24l01 transceivers with their Base Module. I have a connection between theese arduino's but i dont know how to make a LED INDICATOR for show me are there a SIGNAL or NOT . I do it for receiver.. but it doesnt happen this for transmitter ... Please help me and thank you :slight_smile:

Best regards .............. Tayfun Topchu :slight_smile:

I cannot tell from your question whether you already have the wireless communication working properly. If not have a look at this Simple nRF24L01+ Tutorial

I'm also not sure what you want the led indicator to tell you. A single wireless transmission only takes a few millisecs so lighting an LED for that short period would not be much use - probably not even visible to the human eye.

There is no concept of the two nRF24s being "connected" when there is no message being sent. One of them will be listening and the other is probably doing nothing. Or else they are both listening (or both doing nothing :slight_smile: ).

If all of that does not help then you need to post your programs and tell us what the actually do and what you want them to do.

...R

ttopchu:
There is a led lamp on receiver and when its connected and there is a SIGNAL the green led is on and red is off, but when there is NO SIGNAL and not connected 2 NRF's , the green is off and red is on.

What receiver are you using? Post a link to its datasheet. The nRf24L01+ modules that I have do not have any LEDs.

And please post your code here in this Forum. See How to use the Forum

...R

But you have not said what board you are using or where the LED is? Please read Reply #3 again.

...R
PS. Reply #3 has become Reply #2 because the OP deleted the post I was responding to.

Hello Dear Friends, my english is not very good but i know You will know me :slight_smile:

I have two Arduino Nano’s and 2 nRF24l01 PA+LN transceivers with their Base Module. I have a connection between theese arduino’s but i dont know how to make a LED INDICATOR for show me are there a SIGNAL or NOT . I do it for receiver… but it doesnt happen for transmitter …
i need LED Indicator for signal on transmitter…

Code for Receiver :

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[2];
RF24 radio(7,8);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int LED2 = 3;
int LED1 = 4;
int LED3=5;

void setup(void){
 Serial.begin(9600);
 radio.begin();
 radio.setChannel(108); 
 radio.setPALevel(RF24_PA_LOW);
 radio.setDataRate(RF24_250KBPS);
 radio.openReadingPipe(1,pipe);
 radio.startListening();
 pinMode(LED1, OUTPUT);
 pinMode(LED2,OUTPUT);
 pinMode(LED3,OUTPUT);
 }

void loop(void){
 if (radio.available()){
  digitalWrite(LED1, HIGH);
  digitalWrite(LED3, LOW);
   while (radio.available()){
     radio.read(msg,sizeof(msg));      
     Serial.println(msg[0]);
     if (msg[0] == 'A'){digitalWrite(LED2, HIGH);}
     else {digitalWrite(LED2, LOW);}
     Serial.println(msg[1]);}
   }
 else{Serial.println("No radio available"); 
 digitalWrite(LED1, LOW);
 digitalWrite(LED3, HIGH);}}

Code for Transmitter:

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int msg[2];
RF24 radio(7,8);
const uint64_t pipe = 0xE8E8F0F0E1LL;
int SW1 = 4;
int led1=2;
void setup(void){
 Serial.begin(9600);
 radio.begin();
 radio.setChannel(108);
 radio.setPALevel(RF24_PA_MIN);
 radio.setDataRate(RF24_250KBPS);
 radio.openWritingPipe(pipe);
pinMode(led1,OUTPUT);
digitalWrite(led1,LOW);
}
void loop(void){
int pok=digitalRead(SW1);
if(pok==HIGH)msg[0]='A';
else msg[0]=0;
radio.write(msg,sizeof(msg));
}

There is Pictures:
Transmitter NOT LIGHTNING UP LED for signal
RECEIVER - WHEN NO SIGNAL - RED LIGHT
RECEIVER WHEN CONNECTED - GREEN LIGHT

I NEED TO DO THIS FOR TRANSMITTER.

Thank you :slight_smile:

You seem to have deleted your Reply (which I already replied to) in your other Thread on the exact same subject.

That is very poor behaviour and I am not prepared to help further until you fix it.

I am asking the Moderator to merge your Threads.

...R

I'm so sorry for this .. But my english is not good and I confused all this.. this is the reason why I deleted my replie and create new topic :slight_smile: I'm so so so sorry for all. I'm not a stupid or unruly boy. Thank you for all and please help me :slight_smile:

ttopchu:
I NEED TO DO THIS FOR TRANSMITTER.

That does not make any sense for me.

In the transmitter code you have the line

radio.write(msg,sizeof(msg));

and you could certainly put a digtalWrite() immediately before it to turn on the LED and another one after it to turn off the LED. But the LED would be on for such a short time that you would not see it.

If you explain what is the purpose of having the LED then I may be able to make some other suggestion.

...R

Maybe @ttopchu wants to mimic the behavior of the RX/TX LED of, for example, the Nano board?
Btw. if the transmission lasts at least 1 ms the LED flashing should be visible.
Give it a try:

digitalWrite(PINLED,HIGH);
delay(1);
digitalWrite(PINLED,LOW);
delay(1000);

Perfectly visible.

Best

terraduino:
Perfectly visible.

Of course. But I try to keep unnecessary delay()s out of my programs.

And, to be honest, I still don't see that the flash adds any value. The nRF24s are very reliable.

...R

I agree with you, @Robin2.
But maybe he simply wants to understand how things work ... or it's a XY problem :wink:

Robin2:
Of course. But I try to keep unnecessary delay()s out of my programs.

And, to be honest, I still don't see that the flash adds any value. The nRF24s are very reliable.

...R

I would agree with avoiding delay().
But I'd use a LED for debugging, in the field trouble shooting, customer confidence.
Nothing more soothing to a user is a flashing light to tell you all is well.
Tom... :slight_smile: