Sending multiple presentation request fails

  • I'm creting a simple switch node wich will be representing multiple buttons. I'm using an Arduino Nano with the NRF24L01 and a 10 uF capacitor attached to VCC and GND on the radio.

    If I call present() multiple times some of the calls fail. I can fix this problem by adding delay(100) between the calls. Is this a power supply related problem?

    The gateway is a NodeMCU-NRF24L01 gateway. Could this problem also be gateway related?

    #define NUM_BUTTONS 10
    for (int i = 0; i < NUM_BUTTONS; i++) {
      present(i, S_BINARY);
      delay(100); // if removed present() fails sometimes

    Starting sensor (RNNNA-, 2.0.0)
    TSP:MSG:SEND 42-42-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-42 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:CHKID:OK (ID=42)
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 42-42-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:MSG:READ 0-0-42 s=255,c=3,t=25,pt=1,l=1,sg=0:1
    TSP:MSG:PONG RECV (hops=1)
    TSP:MSG:SEND 42-42-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
    TSP:MSG:SEND 42-42-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0
    TSP:MSG:SEND 42-42-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0
    TSP:MSG:READ 0-0-42 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    TSP:MSG:SEND 42-42-0-0 s=255,c=3,t=11,pt=0,l=13,sg=0,ft=0,st=ok:Binary Sensor
    TSP:MSG:SEND 42-42-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0
    TSP:MSG:SEND 42-42-0-0 s=0,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    TSP:MSG:SEND 42-42-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    !TSP:MSG:SEND 42-42-0-0 s=2,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=fail:
    !TSP:MSG:SEND 42-42-0-0 s=3,c=0,t=3,pt=0,l=0,sg=0,ft=1,st=fail:
    TSP:MSG:SEND 42-42-0-0 s=4,c=0,t=3,pt=0,l=0,sg=0,ft=2,st=ok:
    !TSP:MSG:SEND 42-42-0-0 s=5,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=fail:
    TSP:MSG:SEND 42-42-0-0 s=6,c=0,t=3,pt=0,l=0,sg=0,ft=1,st=ok:
    !TSP:MSG:SEND 42-42-0-0 s=7,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=fail:
    TSP:MSG:SEND 42-42-0-0 s=8,c=0,t=3,pt=0,l=0,sg=0,ft=1,st=ok:
    !TSP:MSG:SEND 42-42-0-0 s=9,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=fail:
    Request registration...
    TSP:MSG:SEND 42-42-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=ok:2
    TSP:MSG:READ 0-0-42 s=255,c=3,t=27,pt=1,l=1,sg=0:1
    Node registration=1
    Init complete, id=42, parent=0, distance=1, registration=1

  • Replace the delay() with wait(). That function has the same outcome in your sketch but does not block the Duino from executing code in the background (witch is what MySensors is taking care of for you). In your case the acknowledgement from the controller is not processed by your node because you stopped the Duino for 100ms.

    A wait for about 20 to 50 ms should do the trick easily!

    And to answer your second question: yes, it is possible that it is a power related problem. Do you have a large-ish capacitor (4,7 - 10µF) neat the power pins for your radio?

Log in to reply

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.