The capacitor is definitely helpful for these sensors. Its absence manifests in rather devious ways, as I learned when working from a tutorial that didn’t have a capacitor: When testing the IR decoding in isolation, it might very well work. Once you add other elements to the circuit (in my case, an RGB LED), the IR decoder suddenly starts generating nonsense readings.
I would suggest you edit this question and use the code
format to pretty print your code as it's very hard to follow the way it currently is.
The value for the pipe
variable is an address, more or less the equivalent of your computer IP address: when a message is broadcast into the air all the potential receivers will filter out any message not corresponding to an address they are interested into.
In particular your nRF24L01+ chip is capable to listen for up to 6 addresses.
Another address is the one you use to transmit, so that everybody receiving your message knows who has sent it and to reply to.
So, in your code
radio.openReadingPipe(1,pipe); // pipe value being 0xE8E8F0F0E1LL
means hey, radio, use the second pipe to listen for any message incoming from address 0xE8E8F0F0E1LL, while
radio.openWritingPipe(pipe); // pipe value being 0xE8E8F0F0E1LL
means hey, radio, when sending messages identify yourself with address 0xE8E8F0F0E1LL.
That's the explanation for the pipe
thing and in a short form: those two values in your sketch must match.
Regarding the fact you are not receiving the message, I suggest the following:
- try setting the message payload size to a fixed value with
radio.setPayloadSize(1)
- add a 1uF capacitor short between GND and Vcc on your nRF24 board
- try to use the most reliable configuration which, on the nRF24L01+ is the 250Kbps with maximum PA level by setting
radio.setPALevel(RF24_PA_HIGH); radio.setDataRate(RF24_250KBPS);
Best Answer
The GND of the battery and the Arduino shoud be anyway connected together so it does not matter. Connect it that way and the Arduino to the battery (Vcc to 3.3V the data-pins are 5V tolerant):
An example pin-connection would be (but this depends on your code):
For the Nano this might help: