Raspberry Pi to Arduino with NRF24L01+ failure to receive



  • I'd like to have my Raspberry Pi sending to an Arduino. The Pi will be retrieving and distilling some stats and the Arduino will be, basically, using Servos to turn big dials on a display board we will be building.

    I have had no problem getting another Arduino to talk to the Arduino that will eventually be my controller. I get 100% reliable transmissions (especially after putting a cap across Vcc-GND on the receiver) this way. However .. the Pi's transmissions are never received.

    I took a register dump of the successful Arduino sender and compared with a register dump on Pi after config setup. I did a little bit of tweaking to get them identical but no joy. Now, as I can read and write the registers fine I know that SPI is working. I wired up an LED across CE and I can see this going high during transmission, so I know that's good. On the receiver Arduino I have it turn on an LED when the carrier bit is high, and I can see that come on while the RPi is transmitting.

    So, everything says it ought to be working, but it's not.

    Here is a register dump on the receiver:

    Radio open!
    Max message length:
    28
    0: C
    1: 3F
    2: 3
    3: 3
    4: 3
    5: 64
    6: F
    7: E
    8: 0
    9: 0
    A: E7 E7 E7 E7 E7
    B: C2 C2 C2 C2 C2
    😄 C3
    😧 C4
    E: C5
    F: C6
    10: E7 E7 E7 E7 E7
    11: 0
    12: 0
    13: 0
    14: 0
    15: 0
    16: 0
    17: 11
    1C: 3F
    1D: 5

    Here is a register dump from an Arduino acting as transmitter (sorry, image), that was received perfectly by the receiver above:

    Transmitter

    And here is the register dump off the Pi after I configure it:

    STATUS (07) = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1 (0A, 0B) = 0xe7e7e7e7e7 0xc2c2c2c2c2
    RX_ADDR_P2-5 (0C-0F) = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR (10) = 0xe7e7e7e7e7
    RX_PW_P0-6 (11-16) = 0x00 0x00 0x00 0x00 0x00 0x00
    EN_AA (01) = 0x3f
    EN_RXADDR (02) = 0x03
    RF_CH (05) = 0x64
    RF_SETUP (06) = 0x0f
    SETUP_AW (03) = 0x03
    OBSERVE_TX (08) = 0x00
    CONFIG (00) = 0x0e
    FIFO_STATUS (17) = 0x11
    DYNPD (1C) = 0x3f
    FEATURE (1D) = 0x05
    Data Rate = 2MBPS
    Model = nRF24l01+
    CRC Length from CONFIG register
    CRC Length = 16 bits
    PA Power = PA_MAX

    I'm using the latest version of the nrf24.py library unmodified except to put the register addresses along with the names so that I can compare them with the Arduino more easily.

    Finally, here is the important part of the Python code:

    pipes = [[0xc2, 0xc2, 0xc2, 0xc2, 0xc2], [0xe7, 0xe7, 0xe7, 0xe7, 0xe7]]

    if name == 'main':
    radio = NRF24()
    #### Lib uses BCM numbering -- BCM 16 == BOARD 27
    radio.begin(0, 0, 16, 28) #Set CE and IRQ pins
    radio.powerUp()
    radio.setChannel(100)
    radio.setDataRate(NRF24.BR_2MBPS)
    radio.setPALevel(NRF24.PA_MAX)
    radio.enableDynamicPayloads()
    radio.setAutoAck(1)
    radio.setRetries(0, 3)

        radio.openWritingPipe(pipes[1])
        radio.openReadingPipe(1, pipes[0])
        radio.openReadingPipe(0, pipes[1])
    
        setup = radio.read_register(NRF24.RF_SETUP)
        print "SETUP: " + str(setup)
        setup = setup | 0x01
        radio.write_register(NRF24.RF_SETUP, setup)
        feature = radio.read_register(NRF24.FEATURE)
        print "FEATURE: " + str(feature)
        feature = feature | 0x01
        radio.write_register(NRF24.FEATURE, feature)
        radio.printDetails()
        print 'Sending ping message'
        radio.write('PING')
    

    Any ideas?



  • @ExParrot_NZ

    Oh, update: I have setup a receiver Python script on the RPi, and it can also receive the packets transmitted by the Arduino. It just won't transmit anything.


  • Mod

    Hi @ExParrot_NZ, welcome to the MySensors forum!

    Most people here don't use the radio directly, since the MySensors library provides a nice abstraction. But almost all radio issues we've seen have been power related. Try to use a lower power setting on both the sending and receiving node.

    The troubleshooting flowchart is focused at users using the MySensors library, but the power issues part should be applicable to any radio use.

    If you have't already, switch the radio to rule out the possibility of a defect radio module.



  • Hi, thanks. 🙂 I will see if I can give the Pi transmitter a better power supply, and reduce the transmit power level. I notice that when the Arduino is (attempting) to receive from the Raspberry Pi the carrier LED does not come on as brightly as it does when it is successfully receiving from the other Arduino. I did try a cap across Vcc-GND on the Pi but it made no difference. So, yeah - I might try an external power supply for the radio tied to the same ground.

    I have tried several modules on it in both transmitter and receiver mode. I have three different modules from three different sources (all NRF24L01+). They all receive, although, interestingly, the really cheap one ($4) is 100% reliable as a receiver, whereas the two somewhat more expensive ones I tried got some garbled packets.



  • @ExParrot_NZ

    You don't mention whether you're using the MySensors library on your Arduino, however my assumption is that you are. Have you checked the obvious, that the Raspberry Pi (being used to transmit) has configured the nRF24 data rate to be the same as your Arduino's nRF24 is expecting? I note that you're using the highest data rate setting of 2Mbps on the RPi transmit side of things. By default the MySensors library on the Arduino side will configure the nRF24 for 250Kbps, unless you have remembered to over ride that.

    Just a thought!



  • No, I'm not using MySensors on the Arduino, I'm using RadioHead. I posted on here as there seemed to be a lot of people using that module on this forum. But yes: the radios are both configured to 2Mbps. The fact that the RPi can receive even though not transmit certainly lends weight to @mfalkvidd's suggestion that it might be power-related. I'm getting some voltage regulators and will power it separately from the Pi to see if that improves anything.

    On a related note ... why are 3.3V regulators so hard to come by!? It's been years since I last picked up a soldering iron... Grumble


 

480
Online

7.9k
Users

8.7k
Topics

93.6k
Posts