Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Announcements
  3. 💬 Building a Raspberry Pi Gateway

💬 Building a Raspberry Pi Gateway

Scheduled Pinned Locked Moved Announcements
1.1k Posts 173 Posters 423.1k Views 131 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by
    #578

    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?

    Sergio RiusS 1 Reply Last reply
    0
    • mfalkviddM mfalkvidd

      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?

      Sergio RiusS Offline
      Sergio RiusS Offline
      Sergio Rius
      wrote on last edited by
      #579

      @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.

      mfalkviddM 1 Reply Last reply
      0
      • Sergio RiusS Sergio Rius

        @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.

        mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #580

        @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?

        Sergio RiusS 1 Reply Last reply
        0
        • mfalkviddM mfalkvidd

          @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?

          Sergio RiusS Offline
          Sergio RiusS Offline
          Sergio Rius
          wrote on last edited by
          #581

          @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...

          1 Reply Last reply
          0
          • Sergio RiusS Offline
            Sergio RiusS Offline
            Sergio Rius
            wrote on last edited by Sergio Rius
            #582

            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... #@%&!!! :grinning:

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

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Roman
              wrote on last edited by
              #583

              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

              1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @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

                M Offline
                M Offline
                Matt
                wrote on last edited by
                #584

                @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

                mfalkviddM 1 Reply Last reply
                0
                • M Matt

                  @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

                  mfalkviddM Offline
                  mfalkviddM Offline
                  mfalkvidd
                  Mod
                  wrote on last edited by
                  #585

                  @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.

                  M 1 Reply Last reply
                  0
                  • mfalkviddM mfalkvidd

                    @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.

                    M Offline
                    M Offline
                    Matt
                    wrote on last edited by
                    #586

                    @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.

                    1 Reply Last reply
                    1
                    • O Offline
                      O Offline
                      Oliviakrk
                      wrote on last edited by
                      #587

                      Anyone having issues with compilation of latest stable?

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

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        niehoff80
                        wrote on last edited by
                        #588

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

                        mfalkviddM 1 Reply Last reply
                        0
                        • N niehoff80

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

                          mfalkviddM Offline
                          mfalkviddM Offline
                          mfalkvidd
                          Mod
                          wrote on last edited by
                          #589

                          @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.

                          1 Reply Last reply
                          1
                          • N Offline
                            N Offline
                            niehoff80
                            wrote on last edited by
                            #590

                            @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.

                            1 Reply Last reply
                            1
                            • O Offline
                              O Offline
                              Oliviakrk
                              wrote on last edited by
                              #591

                              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.

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                syotos
                                wrote on last edited by
                                #592

                                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.

                                1 Reply Last reply
                                0
                                • N Offline
                                  N Offline
                                  niehoff80
                                  wrote on last edited by
                                  #593

                                  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!

                                  1 Reply Last reply
                                  1
                                  • M Offline
                                    M Offline
                                    mikkelox
                                    wrote on last edited by
                                    #594

                                    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

                                    1 Reply Last reply
                                    0
                                    • gohanG Offline
                                      gohanG Offline
                                      gohan
                                      Mod
                                      wrote on last edited by
                                      #595

                                      Try latest mysensors version from development branch

                                      M 1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        mikkelox
                                        wrote on last edited by
                                        #596

                                        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

                                        1 Reply Last reply
                                        0
                                        • gohanG gohan

                                          Try latest mysensors version from development branch

                                          M Offline
                                          M Offline
                                          mikkelox
                                          wrote on last edited by
                                          #597

                                          @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

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          11

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular