nRF24L01

i use two nrf24l01 one as a transmitter and the other as a receiver. i want to know the time difference between i transmit the signal and when i receive the signal?

Run the attached RF24 Library example and it will print those value out. (install the RF24 Library first.

Ping out role.  Repeatedly send the current time

GettingStarted_2_pde.ino (4.99 KB)

It won't be much. If you want a visual indication, add code to the receiver to light an LED when it receives the message. If you want to measure it, do similar on the sender when it sends the message and use a scope to measure the latency between the two outputs. If you don't have a scope available you could electrically connect the sender and receiver so that the sender can read the state of the receiver's 'led' output and have the sender measure how long it takes for that to respond after sending the message.

My own experience with these transceivers is that they can be very slow (several tenths of a second) but I expect that depends how many retries and timeouts are needed to get a successful transmission, so your results may vary.

Peter, I thought of that but when I ran the Ping-Pong RF24 example the time was about 10mS and I don't think the human eye can detect that.

raschemmel: I thought of that

I don't know what 'that' refers to, but if you want to measure an interval of the order of 10ms you can connect the sender and receiver together and have the sender monitor an output from the receiver, and that would enable you to measure the elapsed time down to about 4us resolution. You'd be measuring the reaction time of the receiving sketch as well as the RF254 transceiver, but I guess that's what you want anyway.

I don’t know what ‘that’ refers to

If you want a visual indication, add code to the receiver to light an LED when it receives the message

you can connect the sender and receiver together and have the sender monitor an output from the receiver,

I believe that is what the “GettingStarted” example (attached) in the RF24 LIBRARY does.

// Spew it
      printf("Got response %lu, round-trip delay: %lu\n\r",got_time,millis()-got_time);

GettingStarted_2_pde.ino (4.99 KB)

raschemmel: I believe that is what the "GettingStarted" example (attached) in the RF24 LIBRARY does.

The round-trip time is not the same as the transmission time. In some situations the time taken to send in different directions can be very different so estimating transmission time from the round trip time could give a misleading answer. However, it would give you the upper bound of the transmission time, at the very least.