I'm a Raspberry Pi n00b and a python beginner, but I have a lot of experience with DIY electronics, arduino and c#.
I've tried everything I can think of, and I just can't get the Pi to recognise the RF24.
here's my setup
Raspberry Pi 3 model B nRF24L01+
I'm using this tutorial which uses the Blavery version of the RF24 library, but I have tried at least 4 different tutorials and libraries, which all seem pretty similar.
here is the code:
import RPi.GPIO as GPIO
from lib_nrf24 import NRF24
import time
import spidev
GPIO.setmode(GPIO.BCM)
pipes = [[0xe7, 0xe7, 0xe7, 0xe7, 0xe7], [0xc2, 0xc2, 0xc2, 0xc2, 0xc2]]
radio = NRF24(GPIO, spidev.SpiDev())
radio.begin(0, 17)
radio.setPayloadSize(32)
radio.setChannel(0x60)
radio.setDataRate(NRF24.BR_1MBPS)
radio.setPALevel(NRF24.PA_MIN)
radio.setAutoAck(True)
radio.enableDynamicPayloads()
radio.enableAckPayload()
radio.openReadingPipe(0, pipes[1])
radio.printDetails()
radio.startListening()
while(1):
ackPL = [1]
while not radio.available(0):
time.sleep(1 / 100)
receivedMessage = []
radio.read(receivedMessage, radio.getDynamicPayloadSize())
print("Received: {}".format(receivedMessage))
print("Translating the receivedMessage into unicode characters")
string = ""
for n in receivedMessage:
# Decode into standard unicode set
if (n >= 32 and n <= 126):
string += chr(n)
print(string)
radio.writeAckPayload(1, ackPL, len(ackPL))
print("Loaded payload reply of {}".format(ackPL))
and here is the output:
Warning (from warnings module):
File "/home/pi/Desktop/NRF24L01/lib_nrf24.py", line 377
self.GPIO.setup(self.ce_pin, self.GPIO.OUT)
RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 � = 0x0808080808 0x0808080808
RX_ADDR_P2-5 � = 0x08 0x08 0x08 0x08
TX_ADDR = 0x0808080808
RX_PW_P0-6 � = 0x08 0x08 0x08 0x08 0x08 0x08
EN_AA = 0x08
EN_RXADDR � = 0x08
RF_CH = 0x08
RF_SETUP � = 0x08
CONFIG = 0x08
DYNPD/FEATURE � = 0x08 0x08
Data Rate = 2MBPS
Model = nRF24L01
CRC Length = 8 bits
PA Power = PA_MIN
Sometimes the addresses are different, but they never match the addresses from the code.
I've tried checking all the wiring with a multimeter, and it seems to be solid. I've tried with many different wires including ribbon cable directly to the nRF24 module and using a breadboard with the breakout. I tried using a capacitor on the power supply to the RF24. I tried sever different RF modules, all of which I tested with an Arduino and they work fine. I tried it with a Raspberry Pi 2, and had more or less the same results.
As its my first time using Pi, I don't really know the steps for how to debug the problem. I unfortunately don't have an oscilliscope/signal analyzer, so it's hard to test the serial pins. Any suggestions would be greatly appreciated!
thanks