Newbie here. Raspberry pi serial gw and arduino sensor.

  • Hi everyone,

    I know my questions must have been repeatedly answered in the past, but I'm afraid I'm so newbie in mysensors that I can not make if all the replies I found match my case or not.
    As with most people, I also plan to integrate a Raspberry Pi Openhab2 with a couple of sensors using NRF24L01. I followed the guide on how to create a Raspberry Pi gateway, using serial gateway.
    It seems the GW is running fine and able to "talk" to the NRF24L01:

    Jan 29 14:16:54 INFO  Starting gateway...
    Jan 29 14:16:54 INFO  Protocol version - 2.3.0
    Jan 29 14:16:54 DEBUG Serial port /dev/ttyMySensorsGateway (115200 baud) created
    Jan 29 14:16:54 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,VER=2.3.0
    Jan 29 14:16:54 DEBUG TSF:LRT:OK
    Jan 29 14:16:54 DEBUG TSM:INIT
    Jan 29 14:16:54 DEBUG TSF:WUR:MS=0
    Jan 29 14:16:54 DEBUG TSM:INIT:TSP OK
    Jan 29 14:16:54 DEBUG TSM:INIT:GW MODE
    Jan 29 14:16:54 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
    Jan 29 14:16:54 DEBUG MCO:REG:NOT NEEDED
    Jan 29 14:16:54 DEBUG MCO:BGN:STP
    Jan 29 14:16:54 DEBUG MCO:BGN:INIT OK,TSP=1

    and from time to time I see these messages:

    Jan 29 14:31:54 DEBUG TSF:SAN:OK
    Jan 29 14:36:54 DEBUG TSM:READY:NWD REQ
    Jan 29 14:36:54 DEBUG TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    Jan 29 14:46:54 DEBUG TSF:SRT:OK
    Jan 29 14:46:54 DEBUG TSF:SAN:OK
    Jan 29 14:56:54 DEBUG TSM:READY:NWD REQ
    Jan 29 14:56:54 DEBUG TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    Jan 29 15:01:54 DEBUG TSF:SAN:OK
    Jan 29 15:16:54 DEBUG TSM:READY:NWD REQ
    Jan 29 15:16:54 DEBUG TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    Jan 29 15:16:54 DEBUG TSF:SRT:OK
    Jan 29 15:16:54 DEBUG TSF:SAN:OK

    I then loaded an Uno (and a NANO just rule out the possibility of a faulty Arduino) with an example sketch (BinarySwitchSleepSensor) and connected it to the NRF24L01 as per the guides.

    When I start the sketch I see:

    16 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
    26 TSM:INIT
    27 TSF:WUR:MS=0
    35 TSF:SID:OK,ID=1
    37 TSM:FPAR
    73 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2082 TSM:FPAR
    2118 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4128 TSM:FPAR
    4164 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6174 TSM:FPAR
    6210 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8218 !TSM:FPAR:FAIL
    8219 TSM:FAIL:CNT=1
    8221 TSM:FAIL:DIS
    8223 TSF:TDI:TSL

    At this point I see nothing on the gateway. No new messages, no nothing.

    So 1st Question. Is this normal? Should the GW be showing something on the logs or the terminal (I usually run the mysgw manually from command line and not as a service, so the messages should be dumped on the terminal) or not?

    Searching around I found that since I have no controller yet (the openhab2 although installed I choose to disable it for now and concentrate on ensuring communication is working) I get no response for a Parent iD. So (again by searching) found some entries that will make my configuration static:

    #define MY_NODE_ID 1
    #define MY_PARENT_NODE_ID 0

    After re-uploading the sketch to the Uno/Nano now I have the following:

    16 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
    26 TSM:INIT
    27 TSF:WUR:MS=0
    37 TSF:SID:OK,ID=1
    39 TSM:FPAR
    43 TSM:ID
    44 TSM:ID:OK
    45 TSM:UPL
    81 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
    2089 TSM:UPL
    2126 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=NACK:1
    4133 TSM:UPL
    4170 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=2,st=NACK:1
    6177 TSM:UPL
    6214 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=3,st=NACK:1
    8221 !TSM:UPL:FAIL

    So 2nd question. There seems to be NACK messages, but who is not acknowledging them? is it the GW or the (not yet existent) Controller?

    In the bottom line, how do I check the communication between the GW and the NODE? is this the problem I'm having?

    Note that both NRF24L01 are checked and if I use manicabug RF24 library on both the Arduino and the Raspberry I do see them communicating just fine. On the exact same pins and the exact same hardware.

    Any pointers would be greatly appreciated!

    Thank you

  • Mod

    @nikosk yes you should be seeing the node's messages in the gateway log. It is parent that should be acknowledging the messages. Since you've set the gateway as static parent, the gateway is responsible for acknowledgement.

    See for the most common problems and how to efficiently troubleshoot them.

    Number one is to check that you've attached the capacitors correctly.

  • Thank you @mfalkvidd

    So basically this is a communication problem then, right?

    On Arduino I'm de-coupling the NRF just fine and I'm also powering it from my bench power supply so I do not expect any issues there. On the Raspberry side, I do not have a cap yet and also I'm using the onboard 3.3V regulator to power the NRF.
    I might be having an issue there BUT I tried ruling out the connectivity or other electrical problem by using the "maniacbug" library that I know for certain that it works. And indeed, raspberry and Arduino can both talk to each other, just fine. The two are just 1 meter apart, btw.
    Which should mean that there are not any issues with power, but on the other hand you never know.... I will use an external regulator and have the NRF decoupled as proper and will revert back.

    BTW, where in the source code can I see the values the nRF gets initialized with?

  • OK, got it working.
    It was probably an error on the compilation of the mysgw binary. I recompiled it and everything works as expected. Probably the guide I was following was messing around with the default channel and me, as a noob did not notice it.

    So everything sorted now. Thanks for the help!

  • Mod

    Great work @nikosk, thanks for reporting back.

Log in to reply

Suggested Topics

  • 3
  • 1
  • 4
  • 2
  • 3
  • 2