I started out this morning trying to get a gesture control system I had working a few months ago running again, it wasn't. I determined that the receiver wasn't getting the data correctly. To make a long story short, I've tried 4 different Nanos, 3 NRF24's and wiring. Then I got a couple of basic sketches off of the howtomechatronics.com website, his project usually work pretty good. He has a simple test, one sketch sends "Hello World" the other reads it. This is where I'm at now. It's probably something dumb but I don't understand.
If I set CE and CSN to the digital pins I have them wired to, 7,8, nothing works, I put a print statement inside the if radio.available() statement and it doesn't print so it must not be available. If I set CE and CSN to 8,9 but keep the wires on 7,8 it does print that it's available but prints all question marks. I expected it not to read correctly but don't understand why when wired wrong it's available.
I have 2 Unos with rf24 radios attached. I uploaded your code to them and I get
available
Hello World
available
Hello World
available
Hello World
available
Hello World
in the receiver serial monitor. So there is nothing wrong with the code.
How are your radios powered? The number one cause of problems with those radio modules is power.
What modules do you have? The high power modules (with external antenna) can have trouble talking to each other if they are too close together. Try moving them a few meters apart.
CE and CSN must be wired correctly.
I would suggest that you look at Robin2's simple rf24 tutorial. There is a discussion of the power problem and how to solve it in the tutorial. That tutorial is what I used to get my radios to work. Also there is a sketch in reply #30 of the tutorial to test the wired connection between a radio module and its processor that can help with troubleshooting..
I didn't know of the other basic examples, that's what I was looking for when I got the examples I used. I will try them.
I did know about the power problem, right now it's just a Nano and the NRF powered by the 3.3v from the Nano. I connected a 9v battery to the Vin on them and it didn't make much of a difference. Will add a capacitor across the power feeds as well.
I actually didn't think the codes where the problem but after 3 different set ups I wanted to check. I've triple checked my wiring but obviously it's something on my end that is the problem
I'll go back and check it all and use the other examples
I have been using homemade versions of those adapters for years with 100% success.
The 3.3V regulator on the Nano is known to be too weak for the rf24 radio modules. The cap may help, but the adapters mentioned by @UKHeliBob (or a version thereof) will be better.
I like those adaptors for the NRF. But, I wish the header pins were on the other side so it could be mounted on a PWB.
I had a long, drawn-out email exchange regarding this with the Chinese manufacturer. I just wanted them to supply the board with the header pins NOT installed, I'd solder them in the way I want. Bottom line ... couldn't make it happen, mostly because they are unable or unwilling to have a meaningful exchange in the English language.
Depending on which Nano / clone you have, the 3.3volts may be derived from the USB interface chip and works only when the Nano is powered via the USB port. In this case it is anyway only about 50mA and is, as already pointed out, insufficient for these NRF24L01 modules.
It must have been the power, I had a couple of the adapters and wired them in and bingo, the sketches I was using worked fine. I'll still go through the other examples mentioned. Especially robin2's, he's helped me on a few other issues. Always get great feedback from this forum.
Thanks all, now back to the original project that I started on
John