Go Down

Topic: NRF24L01 writing and reading data at the same time? (Read 1 time) previous topic - next topic

davutsadoglu

Hello everyone,

I need reading and writing data at the same time for my automation system. How can I do that? Thank you...

robertiko07

i think is not possible read/write same time, but you have 2Mbps very very fast.
so now what is you proyect??

Robin2

I need reading and writing data at the same time for my automation system. How can I do that? Thank you...
I suspect an XY-problem

Tell us what you are trying to do rather than how you think it needs to be done.

...R

Two or three hours spent thinking and reading documentation solves most programming problems.

davutsadoglu

Hello,

Firstly thanks for answers. I can't clearly understand but I can explain this project.

My project is home automation system prototype and I'm going to use NRF24L01 for this. Because NRF is cheaper than Zigbee. For project example: wall plug algoritm is; server is send to serial data (as 'open') with NRF24L01 and server is see wall plug (Plug is open/close serial data) AT THE SAME TIME. When sending data, I need to see wall plug state(high/low). I hope, you're understand.

As a solution, I think NRF24L01 can be 10ms receiver and 10ms transmitter maybe. What do you think?

Robin2

I can understand why you want to use the nRF24 - they work very well.

I don't understand your description of the requirement.

I think you are saying ...
  • ArduinoA sends a message "open" to ArduinoB attached to a wall plug.
  • Presumably that causes the ArduinoB to switch the plug OFF
  • Then you want ArduinoB to report the status of the plug to Arduino A


If that is wrong, please tell us the correct version.

If that is correct I see no reason for sending and receiving at the same time. In any case a pair of nRF24s can send a message and receive a reply (acknowledgment) in a very short space of time  - a number of milliseconds.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

davutsadoglu

I think you are saying ...
  • ArduinoA sends a message "open" to ArduinoB attached to a wall plug.
  • Presumably that causes the ArduinoB to switch the plug OFF
  • Then you want ArduinoB to report the status of the plug to Arduino A



Exactly, my goal is this! And I should be able to see different reports on ArduinoA(transmitter arduino). Different reports is like a sensors values.

I think, wall plug should work normally as receiver. If wall plug state is change, NRF24L01 mode changing (receiver to transmitter). After the 10ms NRF24L01 is rechanging mode (Transmitter to receiver). I think, you are thinking like that.




Basic scheme:

http://i.hizliresim.com/4rpEDQ.png

Hopefully, presence. Thank you so much...



Robin2

Image from Reply #5 so we don't have to download it. See Image Guide



...R

Two or three hours spent thinking and reading documentation solves most programming problems.

Robin2

If you use the ackPayload feature the "slave" can send data back to the "master" without either of them needing to change role.

The pair of programs in this link work like that.

That system can easily be extended so that the master can communicate with several slaves.

I got my nRF24s working with this Tutorial

I suggest you use the TMRh20 version of the RF24 library - it solves some problems from the ManiacBug version


...R
Two or three hours spent thinking and reading documentation solves most programming problems.

davutsadoglu

Hello,

I looked your links but i can't clearly understand. I think, It is different example, don't like a my home automation project. Do you know tutorials for NRF24L01 transducer/receiver at the same time? Thank you so much...

Robin2

I looked your links but i can't clearly understand. I think, It is different example, don't like a my home automation project. Do you know tutorials for NRF24L01 transducer/receiver at the same time? Thank you so much...
If you want help you have to explain what you don't understand.

The example is different in so far as it is was derived from a model train controller. It is the same in the sense that it sends and receives data. Look for similarities, not differences.

You are still focused on "at the same time" - why? You said my description in Reply #4 was correct and that did not depend on "at the same time"

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Arctic_Eddie

Any transmitter and receiver operating on the same frequency and using the same antenna need a T/R switch. This switch steers the antenna to one of the two circuits on command. If both are working at the same time then the transmit power would fry the receiver input. An isolator would help but not at the power differences encountered. The signal level difference between the two circuits is around 100dB or 1e+10. The only case where a transmitter and receiver can share the same antenna is an amateur radio repeater where both operate at different but similar frequencies and share the antenna through a duplexer. This device is essentially a dual trap keeping the signal of one device from entering the line to the other device. This approach is not appropriate for the nRF24 family. Since turnaround time is in microseconds, they are functionally simultaneous.

KF4JU


Robin2

Any transmitter and receiver operating on the same frequency and using the same antenna need a T/R switch.
That is probably true but it can happen invisbly with the nRF24.  When it sends a message it can receive an acknowledgment without your code needing to change anything.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Arctic_Eddie

Even if the RF24 were capable of simultaneous two-way operation, it would not work as the unit has to process the incoming data before deciding what to send back. The same is true in the Arduino as you can't process the answer until you issue the question.


Robin2

Even if the RF24 were capable of simultaneous two-way operation, it would not work as the unit has to process the incoming data before deciding what to send back. The same is true in the Arduino as you can't process the answer until you issue the question.
I was not suggesting it does simultaneous two-way operation. What I said is that when you issue a write() command and data gets sent from A to B there follows (automatically) an acknowledgement from B to A which can be used to carry data.

If you are saying that the acknowledgement can't contain the answer to the question in the latest message then I agree completely. The acknowledgment must be ready before the message is sent so it can contain the answer to the previous question which is good enough in very many situations - it certainly should be sufficient for the OPs application.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Arctic_Eddie

I agree. For the OP's purpose, your train control example is as instantaneous as he needs.

Go Up