💬 Building a Raspberry Pi Gateway


  • Contest Winner

    @sineverba yes, well that is for the official release so so far so good. I assume you also run the official version of the library and not the beta version, right?
    For details on rPi configuration, perhaps @marceloaqno can provide some assistance but you will find all information needed on that page for configuring signing on your nodes.


  • Hardware Contributor

    @Anticimex On Raspberry PI V1 I can work only with branch development. With master the radio / serial doesn't work


  • Contest Winner

    @sineverba then please use this documentation instead.


  • Hardware Contributor

    @Anticimex thank you but... it is not the same?


  • Contest Winner

    @sineverba no, it isn't. There are newer features on beta branch. A third simplified option for signing exist (and if you have a hard time figuring out signing I highly recommend you use it).


  • Hardware Contributor

    Raspberry PI V1 Model B (2 USB ports, no wifi, 26 GPIO).

    RASPBIAN JESSIE LITE v 2017-04-10-raspbian-jessie-lite.

    Some day ago I did compile the gateway only with development branch, using this:

    ./configure --my-transport=nrf24 --my-rf24-irq-pin=15 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
    

    And all works fantastic.

    Today I did try a new fresh installation for a friend, same PI, and same commands and routine from zero:

    1. Logged with PI
    2. Changed Password
    3. Activate SSH
    4. Activate SPI
    5. Expand Filesystem
    6. Changed timezone

    launched

    ./configure --my-transport=nrf24 --my-rf24-irq-pin=15 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
    

    No error on output, rebooted many times, gateways locked. See the screen:

    alt text

    With current setup (that works perfect), if I reconfigure to use Led TX/RX/Err, I get same lock.

    I have SD and a copy of it, but I would setup another one from zero.... and I cannot.

    Thank you


  • Hardware Contributor

    I don't want give up!

    I did download last RASPBIAN version (2017-06-21).
    Gitted from development branch...

    alt text

    My question is.... is it a problem of my PI? Too old? Need to buy the V3?

    I don't understand why some time ./configure works (and entire system with domoticz works without problem!!!) and other time no!

    @sineverba said in 💬 Building a Raspberry Pi Gateway:

    Raspberry PI V1 Model B (2 USB ports, no wifi, 26 GPIO).

    RASPBIAN JESSIE LITE v 2017-04-10-raspbian-jessie-lite.

    Some day ago I did compile the gateway only with development branch, using this:

    ./configure --my-transport=nrf24 --my-rf24-irq-pin=15 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
    

    And all works fantastic.

    Today I did try a new fresh installation for a friend, same PI, and same commands and routine from zero:

    1. Logged with PI
    2. Changed Password
    3. Activate SSH
    4. Activate SPI
    5. Expand Filesystem
    6. Changed timezone

    launched

    ./configure --my-transport=nrf24 --my-rf24-irq-pin=15 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
    

    No error on output, rebooted many times, gateways locked. See the screen:

    alt text

    With current setup (that works perfect), if I reconfigure to use Led TX/RX/Err, I get same lock.

    I have SD and a copy of it, but I would setup another one from zero.... and I cannot.

    Thank you


  • Hardware Contributor

    Hi to all!
    I did another test, on a new SD with Raspbian Lite 2017-06-21.

    It doesn't work. Hangs on protocol version.

    But... I did note this, after ./configure

    Master branch

    [SECTION] Detecting target machine.
      [OK] machine detected: SoC=unknown, Type=unknown, CPU=armv6l.
    [SECTION] Checking GPIO Sysfs.
      [OK] /sys/class/gpio/export found
    [SECTION] Detecting SPI driver.
      [OK] SPI driver detected:SPIDEV.
    [SECTION] Detecting init system.
      [OK] init system detected: systemd.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.
    

    Development branch

    [SECTION] Detecting target machine.
      [OK] machine detected: SoC=BCM2835, Type=rpi1, CPU=armv6l.
    [SECTION] Detecting SPI driver.
      [OK] SPI driver detected:BCM.
    [SECTION] Detecting init system.
      [OK] init system detected: systemd.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.
    

    I'm going crazy 😞

    @sineverba said in 💬 Building a Raspberry Pi Gateway:

    I don't want give up!

    I did download last RASPBIAN version (2017-06-21).
    Gitted from development branch...

    alt text

    My question is.... is it a problem of my PI? Too old? Need to buy the V3?

    I don't understand why some time ./configure works (and entire system with domoticz works without problem!!!) and other time no!

    @sineverba said in 💬 Building a Raspberry Pi Gateway:

    Raspberry PI V1 Model B (2 USB ports, no wifi, 26 GPIO).

    RASPBIAN JESSIE LITE v 2017-04-10-raspbian-jessie-lite.

    Some day ago I did compile the gateway only with development branch, using this:

    ./configure --my-transport=nrf24 --my-rf24-irq-pin=15 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
    

    And all works fantastic.

    Today I did try a new fresh installation for a friend, same PI, and same commands and routine from zero:

    1. Logged with PI
    2. Changed Password
    3. Activate SSH
    4. Activate SPI
    5. Expand Filesystem
    6. Changed timezone

    launched

    ./configure --my-transport=nrf24 --my-rf24-irq-pin=15 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
    

    No error on output, rebooted many times, gateways locked. See the screen:

    alt text

    With current setup (that works perfect), if I reconfigure to use Led TX/RX/Err, I get same lock.

    I have SD and a copy of it, but I would setup another one from zero.... and I cannot.

    Thank you


  • Mod

    Try DIETPI instead of raspian and see if it changes


  • Hardware Contributor

    @gohan
    I can and I will try, of sure. But, why do you think that something will change? My hardware is too old?



  • Can you look and see what power supply you are using and also tell us what you have connected to the pi?
    Do you have a volt meter and know how to use it?


  • Hardware Contributor

    @skywatch
    For a moment, I did hope that your was final solution.

    By the way, I have HDMI attached (but TV is off) and a hub usb (with nothing attached).

    I did try 7 sd cards.

    I did try also Samsung charger (ETA U90EWE) and a powerbank, both 5v/2a

    I have a cheap multimeter and I have basic knolewdge. What do you want I measure?

    The radio is firmed soldered on an header array and linked with jumpers:

    alt text

    No caps 'cause the nodes and gw can transmit without problem on over 15 meters on my home 🙂

    Exact configuration with a 7-days-old installation works very well. If I try to replicate, with every combination (last raspi/previous raspi/master/development) sometimes works, I re-flash and doesn't work anymore.

    I'm not crazy, I would to be sure that in every moment I can replicate totally the configuration from scratch and... I want understand whats the problem!

    PS The config that works very well, If I try to reconfigure to use the LEDS, after configure hangs on same, same step of debug. Luckily, I use rpi-clone before every single edit on my so-precious configuration.

    PPS If someone wants, I could torrent my SD configured.... 😞



  • OK! - Now I am not saying I have the solution to your problem, but I think it is worth ruling out a few things.

    If nothing is attached to the USB hub, disconnect it.
    With your voltmeter set to DC Volts, measure between TP1 and TP2 on the pi. You should see 5V DC. Up to about 5.5V is OK, but less than 4.8V can affect some things. Many time I have seen power issues be the problem.

    Why not wire the NRF24L01 direct to the pi?

    If all is well, then seems it is software problem after all 😉


  • Hardware Contributor

    @skywatch

    Thank you for your support.
    So, I did disconnect everything.
    I did try and I have 4.95 - 4.98v on every moment, also during the "make" of ./configure.

    alt text

    A bit low, but I think no so low. The mysgw -d lock / hangs with every power supply...

    PS Radio between headers because I want learn skill solders and more easy swap to test others radio, and, last but not last, with headers dupont/wires are more firmly than directly on the radio.



  • That all seems to be OK - Always worth checking though if you ever get issues.
    That means that I am lost for any ideas on why you have problems with ./configure>make>make install. It seems odd. Do you have another pi to try it on? That's the only thing I can think of now....even a cheap pi zero would be OK for a test.

    I would still disconnect the USB hub and all the gpio wiring at the pi and see how it goes.

    Good Luck! 🙂


  • Hardware Contributor

    @skywatch Unfortuntately not, it's only pi that I have.
    No problem, better to check everything. I don't know if open in github, leave here, pass to arduino connected via USB.....

    And.. for Arduino connected via USB, I need to abilitate something with raspi-config or the only thing to do is to connect and domoticz will read it? (of course with sketch gateway loaded on arduino!)



  • @OliverDog said in 💬 Building a Raspberry Pi Gateway:

    Why do Tx and Rx Leds blink every 5 to 6 seconds?
    Is it about communication between RPi and Gateway?
    Is there a way to disable it and keep blinks only with nodes communication?

    Is there an answer for that?
    Thanks again



  • Hi and sorry for the question..
    I have been trying to build a gateway with a raspberry pi 1 and a radio module nrf24 + for several days without success. .I am analyzing step by step what I can be wrong..
    You can kindly indicate the exact command syntax ./configure I have to give?
    thank you so much


  • Mod

    Welcome to the MySensors community @pandy

    ./configure --my-transport=nrf24
    

    should be sufficient. What results did you get from the make and sudo ./bin/mysgw -d commands?



  • @mfalkvidd said in 💬 Building a Raspberry Pi Gateway:

    ./configure --my-transport=nrf24

    Hi and thanks for the quick answer..
    This is the result of the command:

    [SECTION] Detecting target machine.
    [OK] machine detected: SoC=BCM2835, Type=rpi1, CPU=armv6l.
    [SECTION] Detecting SPI driver.
    [OK] SPI driver detected:BCM.
    [SECTION] Detecting init system.
    [OK] init system detected: systemd.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.



  • The result of the "make" command is very long ..


  • Hardware Contributor

    @pandy

    On pi1 I cannot get a stable and re-doable configuration. See some post before.

    I finally swith to Arduino connected via USB. WOrks like a charme. Probably an issue with PI1.



  • the result of sudo ./bin/mysgw -d is :

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta

    and it blocks..


  • Mod

    @pandy that's definitely a problem. What linux are you using?


  • Hardware Contributor

    @pandy Same my problem.
    @gohan I did try also the DIETPI, how you did suggest to me some days ago. Only to say to @pandy let down the idea to use PI1. Use arduino usb/serial with your PI1.
    I did use several nights.... 😞



  • Thanks to everyone for the answers and suggestions...
    At this point I think the problem is the raspberry type..
    I will try the suggested solution above otherwise I will be forced to change raspberry ..
    Thanks to everyone for help



  • @sineverba thank you for your suggestion..Do you have a link where I can find a tutorial for this system?
    thank you so much


  • Mod

    @pandy go for a new rpi3 that works very well.



  • Hello everyone!

    I am trying to use a NRF24 module on the SPI1 of a Raspberry2 (so that I can also use a touch tft on SPI0).

    I enabled it in the config.txt so that is lists under /dev/spidev1.0 - for conveniency I configured the CS0 to be at GPIO16=Pin36 (by using dtoverlay=spi1-1cs,cs0_pin=16).

    I use the dev branch of MySensors.git as the master branch does not recognize my Pi. I used this configure line:

    ./configure --my-rf24-channel=124 --my-rf24-irq-pin=29 --my-rf24-ce-pin=31 --my-rf24-cs-pin=36 --spi-driver=SPIDEV --spi-spidev-device=/dev/spidev1.0
    

    successful make
    but when I run the gateway in the shell with sudo ./bin/mysgw -d, I get the following:

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.2.0-beta
    
    mysgw: MCO:BGN:INIT CP=RNNG--Q-
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: pinMode: invalid pin: 29
    mysgw: pinMode: invalid pin: 31
    mysgw: pinMode: invalid pin: 36
    mysgw: digitalWrite: invalid pin: 31
    mysgw: digitalWrite: invalid pin: 36
    mysgw: digitalPinToInterrupt: invalid pin: 29
    mysgw: digitalPinToInterrupt: invalid pin: 29
    mysgw: digitalWrite: invalid pin: 36
    

    Any ideas what I can do to make it work?



  • I think I might have found the root of the problem. The ./configure detects my Rpi2 as such (rpi2) but in the RPi.cpp in line 26 there is the pin to GPIO translation array and it is lacking translations for the high pin numbers - which is obviously wrong as on the RPi2 you have the extended GPIO connector with 40 pins...

    const static int pin_to_gpio_rev1[41] = {-1, -1, -1, 0, -1, 1, -1, 4, 14, -1, 15, 17, 18, 21, -1, 22, 23, -1, 24, 10, -1, 9, 25, 11, 8, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
    const static int pin_to_gpio_rev2[41] = {-1, -1, -1, 2, -1, 3, -1, 4, 14, -1, 15, 17, 18, 27, -1, 22, 23, -1, 24, 10, -1, 9, 25, 11, 8, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
    const static int pin_to_gpio_rev3[41] = {-1, -1, -1, 2, -1, 3, -1, 4, 14, -1, 15, 17, 18, 27, -1, 22, 23, -1, 24, 10, -1, 9, 25, 11, 8, -1, 7, -1, -1, 5, -1, 6, 12, 13, -1, 19, 16, 26, 20, -1, 21 };
    

    I copied the rev3 array to the rev2 array and compiled this and it seems to work in my case!



  • @Velo17 Thank you! I had been pulling my hair out over this issue on installing a new RPi2 setup.


  • Mod

    Adding link to the github issue (thanks for creating!) for future reference
    https://github.com/mysensors/MySensors/issues/895



  • I just noticed that mysgw is constantly consuming 95-100% CPU here. This even happens when I unplug the NRF24 module so that after starting mysgw basically nothing happens. Running development branch. Hmmmm. Any idea what to check?


  • Mod

    @Velo17 strace might be able to help:

    sudo strace ./bin/mysgw -d
    

    Could you post your configure command? I'd like to try to reproduce the problem. I have a gateway with development from git as of about 2 weeks ago (a9418271) but I'm not using the nrf24. That gateway uses about 2% cpu on my Raspberry Pi 1. There have only been 6 commits since I built my gateway but I can update it and see if it starts acting up.

    On my gateway, strace outputs loads and loads of these:

    gettimeofday({1501098316, 668956}, NULL) = 0
    ioctl(6, FIONREAD, [0])                 = 0
    gettimeofday({1501098316, 671383}, NULL) = 0
    gettimeofday({1501098316, 672447}, NULL) = 0
    gettimeofday({1501098316, 673818}, NULL) = 0
    nanosleep({0, 10000000}, NULL)          = 0
    gettimeofday({1501098316, 685602}, NULL) = 0
    getsockopt(6, SOL_TCP, TCP_INFO, "\1\0\0\0\0\7g\1P4\3\0@\234\0\0\250\5\0\0\30\2\0\0\0\0\0\0\0\0\0\0"..., [104]) = 0
    getsockopt(6, SOL_TCP, TCP_INFO, "\1\0\0\0\0\7g\1P4\3\0@\234\0\0\250\5\0\0\30\2\0\0\0\0\0\0\0\0\0\0"..., [104]) = 0
    gettimeofday({1501098316, 689179}, NULL) = 0
    ioctl(6, FIONREAD, [0])                 = 0
    

    Also, which git hash are you using? (git log -1)

    Another thing to try could be to enable all the debug flags in MyConfig.h and see if they give you something interesting.


  • Mod

    I updated my gateway to 10ef623 (latest from git). Still works ok.



  • @mfalkvidd I make / make install a couple of times and maybe did a git pull inbetween as well - now everything is back to normal again. Thank you for giving me some dbug tips for the next issue 🙂

    My strace output looks similiar.

    My configure line is

    ./configure --my-rf24-channel=124 --my-rf24-irq-pin=29 --my-rf24-ce-pin=31 --my-rf24-cs-pin=36 --spi-driver=SPIDEV --spi-spidev-device=/dev/spidev1.0 --my-debug=disable
    


  • Should be possible to connect two radio modules and run two instances at the same time?
    It could be interesting to have a hat with nrf+rfm, all in one.


  • Mod

    @Sergio-Rius it would be great if you could contribute to making that a reality.
    An earlier discussion on the same topic: https://forum.mysensors.org/topic/4151/nrf24l01-and-rfm69-on-one-gw/

    So far, people have found it easier to add a separate gateway for each transport.



  • @mfalkvidd thanks for guiding me on the starting point. Perhaps the raspberry can break the doble transport limitation.
    I'll investigate in how to install two services at once. But it'll would be nice any advice on the device virtualization part.


  • Mod


  • Mod

    Maybe it could be as simple as running two instances of mysgw, using different pins for the nrf and the rfm?



  • @mfalkvidd Maybe. I'm programmer, but not for Linux. My concern is the part of the service that creates the virtual device colliding between the instances.
    I'll do a test in a virtual machine as soon as I have some time.
    It should be something easy to test.


  • Mod

    @Sergio-Rius by "virtual device", do you mean the com port? If that's the caee, it can be specified with --my-serial-pty=

    Ot let one gateway be serial and the other ethernet.



  • @mfalkvidd yes. Should work. I admit I've not taken a look at the code nor I don't know how to install the service two times.
    I'm used to having problems with programs that use static resources allocation. But I don't know if that's the case.


  • Mod

    maybe you could also consider making 2 ethernet gateway one on port 5003 and the other on port 5004 so that you can use myscontroller to debug from remote.



  • Hi guys couple of questions, apologies if they have been covered elsewhere.
    I am running latest dev branches of domoticz and MYS on a pi2.
    At random times it seems the NRF24L01+ LNA/PA goes down, or MYS goes down and domotics stops receiving signals from all of the nodes at the same time. I have the interrupt feature enabled.
    I have set the option under domoticz/hardware/data timeout to restart if no data received in five minutes but I dont think this is an ideal solution, and have yet to find out if this domoticz feature actually works in my scenario.
    Any idea what causes this? I found an old thread over on the domoticz/mysensors forum but no answers there. I am using a new sd card class 10.
    What I want to do is try out the different MYS builds on domoticz ie MQTT and SERIAL as well as ethernet which I am currently running. However I'm not sure how to stop the current MYS service and completely clean up the current build to start from scratch... I have tried just re entering the ./configure commands then 'make' but this does not seem to work.
    Many thanks,
    Matt


  • Mod

    @Matt log files for the time where the problem occurred will be essential for troubleshooting.

    make uninstall will stop the service and uninstall
    make cleanconfig will remove previous ./configure settings
    make clean will remove compiled code



  • @ccy that correction to the detect_machine function was necessary on my Rpi 3 too (I took the latest version from master). I got it working with that addition.
    Soooo I guess that would be worth adding to the code / opening an issue on github, wouldn't it?



  • I'm just now testing the two instances installation. I was going to just alter the flag --prefix but now I see in options that there's also the install dir:

    Installation options:
        --prefix=<PREFIX>           Installation prefix path. [/usr/local]
        --gateway-dir=<DIR>         Gateway files installation directory. [PREFIX/bin]
    

    What do you think should be the preferred way for installing two instances, only changing --gateway-dir?



  • @mfalkvidd OK thanks for your reply.
    Have set up the -d parameter in mysgw.servie and am waiting for it to fall over again.
    If I catch it I will post syslog.
    Thanks,
    Matt



  • Seems that I'll need some help for getting this properly done.
    I can't launch two instances of the service.

    What I've done is following the guide instructions with the following configuration:

    ./configure \
     --my-transport=nrf24 \
     --my-rf24-irq-pin=18 \
     --my-gateway=ethernet --my-port=5003 \
     --prefix=/opt/mysgw-nrf
    

    Then manually executed it, and it run ok and get one test node connected and Domoticz saw it all.

    Then I duplicated the MySensors folder and in there made the build with the following configuration:

    ./configure \
     --my-transport=nrf24 \
     --my-rf24-channel=82 \
     --my-rf24-ce-pin=37 \
     --my-rf24-cs-pin=36 \
     --my-rf24-irq-pin=33 \
     --my-gateway=ethernet --my-port=5004 \
     --prefix=/opt/mysgw-rfm
    

    Even when it says rfm, i connected a second NRF with the following pinout (blue=first NRF, green=second):
    0_1501511919817_Pinouts.png
    *IRQ on pin 33 as config says, and power from 1.

    Then I tried to make and run and I get this output:

    pi@domo_testing:~/MySGW_RFM $ sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.2.0-beta
    
    mysgw: MCO:BGN:INIT CP=RNNG--Q-
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: pinMode: invalid pin: 33
    mysgw: pinMode: invalid pin: 37
    mysgw: pinMode: invalid pin: 36
    mysgw: digitalWrite: invalid pin: 37
    mysgw: digitalWrite: invalid pin: 36
    mysgw: You need root privilege to use SPI.
    

    Is that I have to connect MOSI and MISO to the same pins that the first NRF?


  • Mod



  • @mfalkvidd That was the culprit. Thanks.
    But now... seems that the radio that is using channel 76 also get connections from nodes on channel 83, and the second radio, the 83 one doesn't pick anything.

    Is there a way to confirm that gw and nodes are using one channel or other during the bootup?


  • Mod

    @Sergio-Rius try increasing the distance between channels to at least 10 or more



  • @gohan Done. I've just burnt the node with channel 125 and it seems to have no effect. It registers on the 76 radio.

    Does the #define MY_RF24_CHANNEL 125 has to be before or after the include of mysensors.h? I have it before.



  • Well, I've changed the channel for the 1st radio to 83 and left the second at 125.
    If I burn the testing node for ch125 it doesn't receives reply from the gw. If I then burn it on ch83, it registers and comunicates with the first radio.

    So I think the second radio does not work on the Raspberry Pi. The service communicates with the controller but does nothing for the network side.
    Also on the second radio:

    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: !TSF:SAN:FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:DIS
    mysgw: TSF:TDI:TSL
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: TSM:FAIL:RE-INIT
    mysgw: TSM:INIT
    mysgw: TSM:INIT:TSP OK
    mysgw: TSM:INIT:GW MODE
    mysgw: TSM:READY:ID=0,PAR=0,DIS=0
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: Client 0: 0;0;3;0;18;PING
    

  • Mod

    @Sergio-Rius if you shut down mysgw for the first radio and restart mysgw for the second radio, does the second radio start to work?
    And do you get the same debug output? The SPI message looks bad. Maybe the two gateways are conflicting.



  • @mfalkvidd Nope, the service seems to have stopped the SAN errors but still no communication:

    pi@domo_testing:~/MySGW_RFM $ sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.2.0-beta
    
    mysgw: MCO:BGN:INIT CP=RNNG--Q-
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: TSM:INIT:TSP OK
    mysgw: TSM:INIT:GW MODE
    mysgw: TSM:READY:ID=0,PAR=0,DIS=0
    mysgw: MCO:REG:NOT NEEDED
    mysgw: Listening for connections on 0.0.0.0:5004
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1
    mysgw: New connection from 127.0.0.1
    mysgw: Client 0 connected
    mysgw: Client 0: 0;0;3;0;2;
    mysgw: Client 0: 0;0;3;0;2;Get Version
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: Client 0: 0;0;3;0;18;PING
    
    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    4 TSM:INIT
    4 TSF:WUR:MS=0
    12 TSM:INIT:TSP OK
    14 TSF:SID:OK,ID=1
    16 TSM:FPAR
    51 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2060 !TSM:FPAR:NO REPLY
    2062 TSM:FPAR
    2099 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4106 !TSM:FPAR:NO REPLY
    4108 TSM:FPAR
    4145 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6152 !TSM:FPAR:NO REPLY
    6154 TSM:FPAR
    6191 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8198 !TSM:FPAR:FAIL
    8200 TSM:FAIL:CNT=1
    8202 TSM:FAIL:PDT
    18206 TSM:FAIL:RE-INIT
    18208 TSM:INIT
    18214 TSM:INIT:TSP OK
    18219 TSF:SID:OK,ID=1
    18221 TSM:FPAR
    18257 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    20267 !TSM:FPAR:NO REPLY
    20269 TSM:FPAR
    20305 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    22315 !TSM:FPAR:NO REPLY
    22317 TSM:FPAR
    22353 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    24363 !TSM:FPAR:NO REPLY
    24365 TSM:FPAR
    24401 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    26411 !TSM:FPAR:FAIL
    26413 TSM:FAIL:CNT=2
    26415 TSM:FAIL:PDT
    36419 TSM:FAIL:RE-INIT
    36421 TSM:INIT
    36427 TSM:INIT:TSP OK
    36431 TSF:SID:OK,ID=1
    36433 TSM:FPAR
    36470 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    38479 !TSM:FPAR:NO REPLY
    38481 TSM:FPAR
    38518 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    40527 !TSM:FPAR:NO REPLY
    40529 TSM:FPAR
    40566 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    42575 !TSM:FPAR:NO REPLY
    42577 TSM:FPAR
    42614 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    44623 !TSM:FPAR:FAIL
    44625 TSM:FAIL:CNT=3
    

    You find the pinouts I send before are right to you?


  • Mod

    MY_* defines need to be before #include MySensors.h so you're doing the right thing.
    I don't know about the pins, have never used anything but the default wiring myself. But if the pins were wrong you should get TSM:INIT:TSP FAIL instead of TSM:INIT:TSP OK.

    If you reconfigure the first mysgw (the one with the default pins) to use channel 83, does communication with the node on channel 83 work?



  • @mfalkvidd yeah, look three posts before.
    I'll try to get mosi and miso from the default pin out sharing with the first radio. Now I'm using the ones marked as 1, when the default ones are marked 0.


  • Mod

    @Sergio-Rius I see. Sorry. Then we know the channel parameter works. Good testing.
    Strange problem. It looks from the threads I linked earlier that using the second SPI does indeed work (if the pin definition fix is applied). When the first mysgw is stopped, your second mysgw should behave just as it did for Velo17 and wergeld. Can you think of any difference in your setup?



  • @mfalkvidd I have the impression that if I stop the first service, the second picks the first radio.
    I disconnected the power from the first radio and left the second all connected and I only got TSM errors and fails. As soon as I attached power to the first NRF it worked.
    Perhaps the other users only used the configurable pins (CS/CE/IRQ) on the extended bank...



  • That's it. It doesn't use MOSI, MISO and SCLK from the SPI1. I removed the NRF1 and only connected those tree pins of NRF2 into SPI0 and service2 works with NRF2 at channel 125.

    I've tried to share those pins (MOSI, MISO, SCLK) between both radios but as soon as I connect NRF1, 2 stops communicating. Same effect than connecting NRF2 to SPI1.

    What a pity... #@%&!!! 😀

    Edit: I finally tried a more "standard" configuration. Using only the first SPI bank and also doesn't work.



  • Hi!
    I have a problem with the pseudo port. Node-serialport (v4.0.7) on the command serialport.list produces the result of the undefined.

    Rpi3 and DietPi, nodejs 4.8.4



  • @mfalkvidd OK have attached the logfiles below.
    No clues that I can see. At 1502 the NRF goes quiet. I have tried a different pi2, different NRF (PA/LNA) and am currently running the NRF off of 5V from the PI through one of those $1.00 regulator adapter things with built in caps and such. Have also tried different PSUs including a 2A one.
    Only thing I can think left to try is reducing the power output in case the high output of the radio module is inducing transients in the cables...
    Am kinda stumped here. I have an arduino NRF gateway that I will try via USB if low power does not work. I have tried setting up MYSGW as LAN and USB via ./configure but the same thing happens each time.
    One thought just came to me, I AM using the pin15 IRQ option on the NRF now that is still experimental?
    So next time will try without IRQ and low power...

    Any help/suggestions greatly appreciated.
    FYI I have had domoticz running on a lubuntu netbook with USB arduino NRF gateway that has been rock solid. Am trying the get a workable PI solution though, for myself and my father in law but not workable as yet sadly...

    At 15:02:34 you can see the last incoming node message after that the only MYSGW activity is the PING thing... which seems to happen every 10S or so. This goes on for an hour after that with no more incomings. I have ~12 sensors around the place including a power meter one which reports every minute.

    15:02:29 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
    Aug  5 15:02:33 raspberrypi mysgw: TSF:MSG:READ,23-23-0,s=1,c=1,t=0,pt=7,l=5,sg=0:18.0
    Aug  5 15:02:33 raspberrypi mysgw: TSF:MSG:READ,23-23-0,s=0,c=1,t=1,pt=7,l=5,sg=0:21.0
    Aug  5 15:02:34 raspberrypi mysgw: TSF:MSG:READ,23-23-0,s=255,c=3,t=0,pt=1,l=1,sg=0:68
    Aug  5 15:02:34 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
    Aug  5 15:02:36 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
    Aug  5 15:02:37 raspberrypi mysgw: TSF:MSG:READ,41-7-0,s=0,c=1,t=0,pt=7,l=5,sg=0:11.6
    Aug  5 15:02:41 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
    Aug  5 15:02:46 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
    Aug  5 15:02:50 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
    Aug  5 15:02:56 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
    Aug  5 15:02:57 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
    Aug  5 15:03:06 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
    Aug  5 15:03:06 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
    Aug  5 15:03:13 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
    Aug  5 15:03:16 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
    

    Also FWIW to log from domoticz below. Ignore FANFLAG thats just a blockly flag I use...

    2017-08-05 15:01:18.936 (GW) General/Voltage (FanIntakeV)
    2017-08-05 15:02:04.935 (GW) General/kWh (Meter)
    2017-08-05 15:02:33.940 (GW) Temp + Humidity (Mitch2)
    2017-08-05 15:02:33.945 (GW) Temp + Humidity (Mitch2)
    2017-08-05 15:02:37.941 (GW) Temp (MBR Fan)
    2017-08-05 15:50:02.678 Set UserVariable FanFlag = 1
    2017-08-05 15:51:02.693 Set UserVariable FanFlag = 1
    2017-08-05 15:52:02.703 Set UserVariable FanFlag = 1
    2017-08-05 15:53:02.710 Set UserVariable FanFlag = 1
    2017-08-05 15:54:00.037 Set UserVariable FanFlag = 1
    

    Thanks,
    Matt


  • Mod

    @Matt I agree that power is the most likely cause. The nrf24 is very sensitive.

    Before you recompile, add --extra-cxxflags=-DMY_DEBUG_VERBOSE_RF24 to the configure command and you'll get extra details on the radio status in the gateway's debug log.



  • @mfalkvidd Thankyou. Stable for now. Not sure if they are even genuine modules so... Can reach outside to my glasshouse even on low power setting.
    If it starts playing up again I'll add verbose logging and have another look.



  • Anyone having issues with compilation of latest stable?

    Looks like missing libraries... fatal error: SPI.h: No such file or directory



  • Yesterday I've tried compiling it also (first time for me) and I had same error.


  • Mod

    @niehoff80 and/or @Oliviakrk can you run

    sudo raspi-config
    

    (install it using sudo apt-get install raspi-config if it isn't already installed)
    Select

    8 Advanced Options
    

    and

    A6 SPI
    

    and

    Yes
    

    to all questions. Reboot the raspberry pi and try running make again. If that works I'll add it to the documentation.



  • @mfalkvidd

    I was able to compile it after doing what you're suggesting. It's still have error message during communication with the gateway but that is probably a noobs-error in my config. so I have to investigate a bit more.



  • Hi

    I enabled SPI. For Rasberry PI B it was under 5. Interfacing options. The build completed successfully. Thanks!

    But there is a problem...When I run mysqgw -d I get:
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:PDT

    I also tried development release. Works perfectly. Looks like there is problem with stable.



  • Have the same problem with the stable branch as @Oliviakrk using the NRF24 transport on an Raspberry PI B, it might be a driver issue, is see that the make for the development branche builds the BCM drivers while the master branche does not.



  • Ok, I had same error as Oliviakrk & syotos on my Raspberry Pi 3 and I also tried the development release and that one works perfectly!



  • Hi I followed the instructions, but I can't get it to work, I have a Raspberry Pi 1 Rev1 with NRF24 connected following the instructions.
    First I configured it just using ./configure --spi-driver=SPIDEV --spi-spidev-device=/dev/spidev0.0 --soc=BCM2835 --my-transport=nrf24 --my-rf24-ce-pin=22 --my-rf24-cs-pin=24 --my-gateway=ethernet --my-port=5003
    I also tried with almost every combination but I always get the same errors.
    The idea is for it to be used as a standalone GW running from RPI with RF directly attached to it (SPI is enabled and I don't get any errors when compiling)
    I can send the logs if needed, any help will be welcome, thanks!
    pi@raspberrypi:~/MySensors $ sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:PDT
    mysgw: TSM:FAIL:RE-INIT
    mysgw: TSM:INIT
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=2
    mysgw: TSM:FAIL:PDT


  • Mod

    Try latest mysensors version from development branch



  • Tried it and got the same output, I also tried with a different NRF24 just in case and doublechecked the connections. are the options I am using ok?
    ./configure --spi-driver=SPIDEV --spi-spidev-device=/dev/spidev0.0 --soc=BCM2835 --my-debug=enable --my-transport=nrf24 --my-rf24-ce-pin=22 --my-rf24-cs-pin=24 --my-gateway=ethernet --my-port=5003



  • @gohan, Thank you! I got it to work. First I tried with the development branch and it didn't work either, then I used the following instructions https://forum.mysensors.org/topic/1151/tutorial-raspberry-pi-nrf24l01-direct-connection
    And when that didn't work either I rechecked the wiring which ended up being the reason for it to fail previously, "faulty wires".
    I got it to work with the master branch.

    pi@raspberrypi:~/MySensors $ sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: TSM:INIT:TSP OK
    mysgw: TSM:INIT:GW MODE
    mysgw: TSM:READY:ID=0,PAR=0,DIS=0
    mysgw: MCO:REG:NOT NEEDED



  • Sorry, just want to ask does anyone have the output of this gateway?


  • Mod

    @Zuhairi the previous post?



  • Hi.
    I have a Raspberry Pi already configured as gateway, but I don't know how to interact with. I means, how can I read incoming data from? I tried open /dev/ttyMySensorsGateway as a common serial port but I got a message error:
    cu: open (/dev/ttyMySensorsGateway): Permission denied
    cu: /dev/ttyMySensorsGateway: Line in use
    With 'ps ax' command I can see only '/usr/local/sbin/PiGatewaySerial -d' running as a deamon.
    Could someone explain me what's ne next step for?


  • Mod

    I'd compile it as ethernet gateway, follow the guide on how to configure the parameters, then you can use MySController (search the forum, there is a topic with download link) and use that to connect to it


  • Mod

    Welcome to the MySensors community @Djames-Suhanko

    It looks like you are using the Raspberry Pi gateway for MySensors 1.5. If you are just starting out, I suggest you use the gateway for the current version instead. Documentation: https://www.mysensors.org/build/raspberry

    That version of the gateway has a debug mode where you can see the messages in the console.

    The next step would be to select a controller. Information about this is available at https://www.mysensors.org/about/network



  • @gohan Thank you to answer! Good tip, I will do that!



  • @mfalkvidd Yes, I'm using 1.5. Thank you for suggest me the newer version. I will update it today!



  • Hello, all!
    I read a lot of comments to find a solution to my problem, but seems it's something that I couldn't understand yet.

    The old version was working in my Raspberry Pi using Raspbian Wheeze, so, to install the new version i updated my system until the latest version (Raspbian Stetch). I could compile MySensors, but I'm getting the common error when testing with mysgw -d:
    "MYSGW: MCD:BGN INIT GW, CP=RNNG---,VER-2.1.1" and so on.

    I used this parameters in configure:
    ./configure --my-transport=nrf24 --my-gateway=ethernet
    --my-port=5003 --my-controlle-ip-address=192.168.1.2
    --my-gateway=mqtt --my-mqtt-publish-topic-prefix=mysensors-out
    --my-mqtt-subscribe-topic-prefix=mysensors-in
    --my-mqtt-client-id=mygateway1

    I couldn't find a solution yet. Can someone help me?


  • Mod

    @Djames-Suhanko MYSGW: MCD:BGN INIT GW, CP=RNNG---,VER-2.1.1 means that the gateway is starting up. It is not an error.

    "controller" is misspelled in your configure command though.


  • Mod

    @Djames-Suhanko I think you have to decide wether you want to make an ethernet or mqtt gateway, you can't specify both



  • wow, it's was really fast! Thanks to answer. I'm use an ethernet interface. It's up but have no cable on their. I didn't install a controller yet, so, is there no problem yet, right?
    Sorry that, I'm really a newbie using MySensors.

    [updating]
    ysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:PDT
    mysgw: TSM:FAIL:RE-INIT
    mysgw: TSM:INIT
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=2
    mysgw: TSM:FAIL:PDT


  • Mod

    @Djames-Suhanko said in 💬 Building a Raspberry Pi Gateway:

    --my-controlle-ip-address

    this also is not necessary. Also for now remove all these --my-gateway=mqtt --my-mqtt-publish-topic-prefix=mysensors-out
    --my-mqtt-subscribe-topic-prefix=mysensors-in
    --my-mqtt-client-id=mygateway1
    and use it as ethernet gateway to keep it simple



  • Ok, I will try it right now!



  • Hello folks,
    my past experience is using nrf24 library at https://github.com/Blavery/lib_nrf24, and i was able to send/receive "text" data (or "string" data) in between Raspi3 (master node) and Arduino (slave). And this is a big issue, because what i need is numerical data (float or integer), not text data, so Raspi 3 can process the numerical data (such as to do the plotting), and based on the processed data to make some decisions. My raspi 3 is controlling a moving robot. Can you advise appropriate nrf24 library for raspberry pi and Arduino, and sample codes for this kind of applicaitons? Thanks


  • Mod

    Welcome to the MySensors community @erobot !

    Not sure how you found us, but the library we use here is...MySensors. It certanly does what you describe. The best way to start is to read how MySensors works at https://www.mysensors.org/about and then go on to the many build examples and build your first node.



  • hi there, somehow my gateway seems to stop receiving data after a day or so from my sensors,
    restarting the service seems to solve it for a time, how can i troubleshoot this issue ?



  • @Richard-van-der-Plas

    Same trouble for me. I use mySensors since 2 years and I have no problem with my Arduino Gateway. But from now 2 weeks, I try to use a pi gateway. It's working well but sometime, don't no why, my nrf24 stop to receive messages. Just restarting mygw service and re-work again. I don't see nothing anormal in my log, stop randomlly after 1 or 2 days.

    Maybe a power issue to nrf24, I will try to add capacitor just for testing if can resolve this problem.



  • Same here too. With Rpi3 gateway. Would stop for hours, maybe start agian for a hour or two and then stop.
    Have been running debug mode for last day, no idea what happened, but been stable so perhaps something in the update/upgrade made a problem and has now been fixed.
    Will keep an eye on here and let you know if I find anything.



  • Looks as if it happened after updating Home Assistant, but that should be 2 different things right ?


  • Mod

    @Richard-van-der-Plas what version are you using?



  • @gohan for me version dev (2.2)



  • dev 2.2.0 beta


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 2
  • 109
  • 164
  • 109

13
Online

11.4k
Users

11.1k
Topics

112.7k
Posts