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. Hardware
  3. Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)

Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)

Scheduled Pinned Locked Moved Hardware
nrf24raspberry piraspberryraspberry nrf24l01 gpiogateway
168 Posts 47 Posters 175.0k Views 36 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.
  • Sander StolkS Offline
    Sander StolkS Offline
    Sander Stolk
    wrote on last edited by Sander Stolk
    #82
    pi@Domoticz3:~/Raspberry$ sudo ./PiGatewaySerial
    Starting PiGatewaySerial...
    Protocol version - 1.4
    Created PTY '/dev/pts/1'
    Gateway tty: /dev/ttyMySensorsGateway
    ================ SPI Configuration ================
    CSN Pin          = CE0 (PI Hardware Driven)
    CE Pin           = Custom GPIO25
    Clock Speed      = 8 Mhz
    ================ NRF Configuration ================
    STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1     = 0xa8--------------------------------
    RX_ADDR_P2-5     = 0xff 0xc-----------------
    TX_ADDR          = 0xe7e7e7e7e7
    RX_PW_P0-6       = 0x20 0x20 0x20 0x00 0x00 0x00
    EN_AA            = 0x3b
    EN_RXADDR        = 0x06
    RF_CH            = 0x4c
    RF_SETUP         = 0x23
    CONFIG           = 0x0e
    DYNPD/FEATURE    = 0x3f 0x06
    Data Rate        = 250KBPS
    Model            = nRF24L01+
    CRC Length       = 16 bits
    PA Power         = PA_LOW
    ^[read: 1-1-0 s=0,c=1,t=0,pt=7,l=5:16.1
    read: 1-1-0 s=0,c=1,t=23,pt=2,l=2:1022
    read: 1-1-0 s=1,c=1,t=23,pt=2,l=2:1023
    read: 1-1-0 s=2,c=1,t=23,pt=2,l=2:1021
    Received SIGINT^C
    Exiting...
    pi@Domoticz3:~/Raspberry$ sudo cat /dev/ttyMySensorsGateway
    cat: /dev/ttyMySensorsGateway: No such file or directory
    pi@Domoticz3:~/Raspberry$ sudo /etc/init.d/PiGatewaySerial start
    [....] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.serviceFailed to start PiGatewaySerial.service: Unit PiGatewaySerial.service failed to load: No such file or directory.
     failed!
    pi@Domoticz3:~/Raspberry$
    

    Playing with a RPI 3 B and a NRF24+ radio I got this error message above.
    Running Jessie but with no luck...

    Anybody else got this problem?

    mfalkviddM 1 Reply Last reply
    0
    • Sander StolkS Sander Stolk
      pi@Domoticz3:~/Raspberry$ sudo ./PiGatewaySerial
      Starting PiGatewaySerial...
      Protocol version - 1.4
      Created PTY '/dev/pts/1'
      Gateway tty: /dev/ttyMySensorsGateway
      ================ SPI Configuration ================
      CSN Pin          = CE0 (PI Hardware Driven)
      CE Pin           = Custom GPIO25
      Clock Speed      = 8 Mhz
      ================ NRF Configuration ================
      STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
      RX_ADDR_P0-1     = 0xa8--------------------------------
      RX_ADDR_P2-5     = 0xff 0xc-----------------
      TX_ADDR          = 0xe7e7e7e7e7
      RX_PW_P0-6       = 0x20 0x20 0x20 0x00 0x00 0x00
      EN_AA            = 0x3b
      EN_RXADDR        = 0x06
      RF_CH            = 0x4c
      RF_SETUP         = 0x23
      CONFIG           = 0x0e
      DYNPD/FEATURE    = 0x3f 0x06
      Data Rate        = 250KBPS
      Model            = nRF24L01+
      CRC Length       = 16 bits
      PA Power         = PA_LOW
      ^[read: 1-1-0 s=0,c=1,t=0,pt=7,l=5:16.1
      read: 1-1-0 s=0,c=1,t=23,pt=2,l=2:1022
      read: 1-1-0 s=1,c=1,t=23,pt=2,l=2:1023
      read: 1-1-0 s=2,c=1,t=23,pt=2,l=2:1021
      Received SIGINT^C
      Exiting...
      pi@Domoticz3:~/Raspberry$ sudo cat /dev/ttyMySensorsGateway
      cat: /dev/ttyMySensorsGateway: No such file or directory
      pi@Domoticz3:~/Raspberry$ sudo /etc/init.d/PiGatewaySerial start
      [....] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.serviceFailed to start PiGatewaySerial.service: Unit PiGatewaySerial.service failed to load: No such file or directory.
       failed!
      pi@Domoticz3:~/Raspberry$
      

      Playing with a RPI 3 B and a NRF24+ radio I got this error message above.
      Running Jessie but with no luck...

      Anybody else got this problem?

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

      @Sander-Stolk did you run

      sudo make install
      

      ?
      What happens if you run

      sudo /usr/local/sbin/PiGatewaySerial
      

      ?

      Sander StolkS 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @Sander-Stolk did you run

        sudo make install
        

        ?
        What happens if you run

        sudo /usr/local/sbin/PiGatewaySerial
        

        ?

        Sander StolkS Offline
        Sander StolkS Offline
        Sander Stolk
        wrote on last edited by
        #84

        @mfalkvidd
        Tnx that worked but this is not in the tutorial I'm I right?

        If this happens, double-check your wiring and correct any problems. Press Ctrl+Z and type
        
        sudo killall PiGatewaySerial
        to get rid of the non-functioning Gateway. Then run sudo /usr/local/sbin/PiGatewaySerial again
        
        If all is well, exit PiGatewaySerial by pressing Ctrl+C. Then run
        
        sudo /etc/init.d/PiGatewaySerial start
        to start the gateway as a background process. Verify that it started correctly by running```
        1 Reply Last reply
        0
        • mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #85

          Yes it is. See the section under
          COMPILING THE GATEWAY

          also, you ran sudo ./PiGatewaySerial instead of sudo /usr/local/sbin/PiGatewaySerial described in the instructions.

          1 Reply Last reply
          0
          • mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #86

            I have added a
            TROUBLESHOOTING
            section in the original post to cover for this error. Hopefully it can help if someone else makes the same mistake.

            1 Reply Last reply
            1
            • micahM Offline
              micahM Offline
              micah
              wrote on last edited by
              #87

              Any thoughts on making a version for the 2.0 dev branch?

              I recently switched my in-progress builds to 2.0 and am in the process of "trying" to get my Raspberry Pi2 setup with OpenHab and Mosquito. And the idea of not having to have an ethernet gateway arduino in the mix is appealing to me.

              I would do it myself but I probably only have 3.275% of the required knowledge at this point

              1 Reply Last reply
              0
              • mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #88

                I'm unfortunately at about the same level as you. I can compile stuff and do basic troubleshooting, but merging the dev branch with the gateway code is way out of my league.

                micahM 1 Reply Last reply
                0
                • mfalkviddM mfalkvidd

                  I'm unfortunately at about the same level as you. I can compile stuff and do basic troubleshooting, but merging the dev branch with the gateway code is way out of my league.

                  micahM Offline
                  micahM Offline
                  micah
                  wrote on last edited by
                  #89

                  @mfalkvidd said:

                  I'm unfortunately at about the same level as you. I can compile stuff and do basic troubleshooting, but merging the dev branch with the gateway code is way out of my league.

                  There is no way you are at 3.275% knowledge like me... I've seen many of your posts on here and you are at least a 4.532%... lol.... no honestly I've liked your posts and you seem very knowledgeable. You've got to be at least a 84.5% ;)

                  1 Reply Last reply
                  1
                  • Sander StolkS Offline
                    Sander StolkS Offline
                    Sander Stolk
                    wrote on last edited by
                    #90

                    Can somebody tell me how to change the channel after compiling and using the Gateway for a couple of days?
                    Changing the channel in MyConfig.h in the dir Raspberry doesnt bother even after a reboot.
                    Still 0x4c channel / 76 when I run the PiSerialGateway program.

                    alexsh1A 1 Reply Last reply
                    0
                    • Sander StolkS Sander Stolk

                      Can somebody tell me how to change the channel after compiling and using the Gateway for a couple of days?
                      Changing the channel in MyConfig.h in the dir Raspberry doesnt bother even after a reboot.
                      Still 0x4c channel / 76 when I run the PiSerialGateway program.

                      alexsh1A Offline
                      alexsh1A Offline
                      alexsh1
                      wrote on last edited by
                      #91

                      @Sander-Stolk said:

                      Can somebody tell me how to change the channel after compiling and using the Gateway for a couple of days?
                      Changing the channel in MyConfig.h in the dir Raspberry doesnt bother even after a reboot.
                      Still 0x4c channel / 76 when I run the PiSerialGateway program.

                      Did you recompile the code after changing the channel?

                      Sander StolkS 1 Reply Last reply
                      0
                      • alexsh1A alexsh1

                        @Sander-Stolk said:

                        Can somebody tell me how to change the channel after compiling and using the Gateway for a couple of days?
                        Changing the channel in MyConfig.h in the dir Raspberry doesnt bother even after a reboot.
                        Still 0x4c channel / 76 when I run the PiSerialGateway program.

                        Did you recompile the code after changing the channel?

                        Sander StolkS Offline
                        Sander StolkS Offline
                        Sander Stolk
                        wrote on last edited by Sander Stolk
                        #92

                        @alexsh1 I did this after changeing the channel in MyConfig.h: make all && sudo make install
                        Rebooted after that but no luck

                        1 Reply Last reply
                        0
                        • mfalkviddM Offline
                          mfalkviddM Offline
                          mfalkvidd
                          Mod
                          wrote on last edited by
                          #93

                          That should be sufficient but you could see if running make clean before make all helps.

                          Sander StolkS 1 Reply Last reply
                          0
                          • mfalkviddM mfalkvidd

                            That should be sufficient but you could see if running make clean before make all helps.

                            Sander StolkS Offline
                            Sander StolkS Offline
                            Sander Stolk
                            wrote on last edited by Sander Stolk
                            #94

                            @mfalkvidd I did the make clean and the make install and rebooted.
                            Still 0x4c eq. 76

                            Using username "pi".
                            Server refused our key
                            pi@192.168.1.14's password:
                            ______                      _   _
                            |  _  \                    | | (_)
                            | | | |___  _ __ ___   ___ | |_ _  ___ ____
                            | | | / _ \| '_ ` _ \ / _ \| __| |/ __|_  /
                            | |/ / (_) | | | | | | (_) | |_| | (__ / /
                            |___/ \___/|_| |_| |_|\___/ \__|_|\___/___|
                            
                            
                            Last login: Sat Apr  9 18:41:17 2016 from 192.168.1.34
                            
                            Monday, 11 April 2016, 12:10:24 pm CEST
                            Linux 4.1.18-v7+ armv7l GNU/Linux
                            Uptime.............: 1 days, 17h29m13s
                            Memory.............: 520336kB (Free) / 948056kB (Total)
                            Load Averages......: 0.00, 0.01, 0.05 (1, 5, 15 min)
                            Running Processes..: 97
                            IP Addresses.......: 192.168.1.14
                            
                            pi@Domoticz3:~$ cd Raspberry/
                            pi@Domoticz3:~/Raspberry$ cat MyConfig.h
                            /*
                             The MySensors library adds a new layer on top of the RF24 library.
                             It handles radio network routing, relaying and ids.
                            
                             Created by Henrik Ekblad <henrik.ekblad@gmail.com>
                             12/10/14 - Ported to Raspberry Pi by OUJABER Mohamed <m.oujaber@gmail.com>
                            
                             This program is free software; you can redistribute it and/or
                             modify it under the terms of the GNU General Public License
                             version 2 as published by the Free Software Foundation.
                            */
                            
                            #ifndef MyConfig_h
                            #define MyConfig_h
                            
                            /***
                             * Configure Sensor Network
                             */
                            #define RF24_CHANNEL       111             //RF channel for the sensor net, 0-127
                            #define RF24_DATARATE      RF24_250KBPS   //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
                            #define RF24_PA_LEVEL      RF24_PA_MAX    //Sensor PA Level == RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12dBm, RF24_PA_HIGH=-6dBM, and RF24_PA_MAX=0dBm
                            #define RF24_PA_LEVEL_GW   RF24_PA_MAX  //Gateway PA Level, defaults to Sensor net PA Level.  Tune here if using an amplified nRF2401+ in your gateway.
                            #define BASE_RADIO_ID      ((uint64_t)0xA8A8E1FC00LL) // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
                            
                            // MySensors online examples defaults
                            #define DEFAULT_CE_PIN 9
                            #define DEFAULT_CS_PIN 10
                            
                            
                            /***
                             * Enable/Disable debug logging
                             */
                            #define DEBUG
                            
                            
                            #ifdef __Raspberry_Pi
                                    #define vsnprintf_P vsnprintf
                                    #define snprintf_P snprintf
                                    #define PSTR(x) (x)
                                    #define printf_P printf
                                    #define strlen_P strlen
                            #endif
                            
                            #endif
                            pi@Domoticz3:~/Raspberry$ make clean
                            rm -rf MyGateway MySensor MyMessage PiEEPROM PiGateway PiGatewaySerial MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGateway.o PiGatewaySerial.o
                            pi@Domoticz3:~/Raspberry$ make all
                            g++ -c -o MyGateway.o MyGateway.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                            g++ -c -o MySensor.o MySensor.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                            g++ -c -o MyMessage.o MyMessage.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                            g++ -c -o PiEEPROM.o PiEEPROM.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                            g++ -c -o PiGateway.o PiGateway.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                            g++ -o PiGateway MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGateway.o -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 -lrf24-bcm
                            g++ -c -o PiGatewaySerial.o PiGatewaySerial.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                            g++ -o PiGatewaySerial MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGatewaySerial.o -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 -lrf24-bcm -lutil
                            pi@Domoticz3:~/Raspberry$ sudo reboot
                            
                            Broadcast message from pi@Domoticz3 on pts/1 (Mon 2016-04-11 12:12:17 CEST):
                            
                            The system is going down for reboot NOW!
                            
                            pi@Domoticz3:~/Raspberry$
                            Using username "pi".
                            Server refused our key
                            pi@192.168.1.14's password:
                            ______                      _   _
                            |  _  \                    | | (_)
                            | | | |___  _ __ ___   ___ | |_ _  ___ ____
                            | | | / _ \| '_ ` _ \ / _ \| __| |/ __|_  /
                            | |/ / (_) | | | | | | (_) | |_| | (__ / /
                            |___/ \___/|_| |_| |_|\___/ \__|_|\___/___|
                            
                            
                            Last login: Mon Apr 11 12:10:24 2016 from 192.168.1.34
                            
                            Monday, 11 April 2016, 12:12:45 pm CEST
                            Linux 4.1.18-v7+ armv7l GNU/Linux
                            Uptime.............: 0 days, 00h00m25s
                            Memory.............: 770952kB (Free) / 948056kB (Total)
                            Load Averages......: 0.59, 0.16, 0.05 (1, 5, 15 min)
                            Running Processes..: 100
                            IP Addresses.......: 192.168.1.14
                            
                            pi@Domoticz3:~$ ls
                            bash_scripts  domoticz  Dropbox-Uploader  Raspberry  RF24
                            pi@Domoticz3:~$ sudo /etc/init.d/PiGatewaySerial start
                            [ ok ] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.service.
                            pi@Domoticz3:~$ sudo /etc/init.d/PiGatewaySerial start
                            [ ok ] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.service.
                            pi@Domoticz3:~$ sudo ln -s /dev/ttyMySensorsGateway /dev/ttyUSB20
                            ln: failed to create symbolic link ‘/dev/ttyUSB20’: File exists
                            pi@Domoticz3:~$ sudo /usr/local/sbin/PiGatewaySerial
                            Starting PiGatewaySerial...
                            Protocol version - 1.4
                            Created PTY '/dev/pts/2'
                            Gateway tty: /dev/ttyMySensorsGateway
                            ================ SPI Configuration ================
                            CSN Pin          = CE0 (PI Hardware Driven)
                            CE Pin           = Custom GPIO25
                            Clock Speed      = 8 Mhz
                            ================ NRF Configuration ================
                            STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
                            RX_ADDR_P0-1     = 0xa8a8e
                            RX_ADDR_P2-5     = 0xff 0xc4 
                            TX_ADDR          = 0xa8a8e1fc07
                            RX_PW_P0-6       = 0x20 0x20 0x20 0x00 0x00 0x00
                            EN_AA            = 0x3b
                            EN_RXADDR        = 0x06
                            RF_CH            = 0x4c
                            RF_SETUP         = 0x23
                            CONFIG           = 0x0e
                            DYNPD/FEATURE    = 0x3f 0x06
                            Data Rate        = 250KBPS
                            Model            = nRF24L01+
                            CRC Length       = 16 bits
                            PA Power         = PA_LOW
                            read: 5-5-5 s=5,c=5,t=5,pt=0,l=0:
                            version mismatch
                            ^CReceived SIGINT
                            Exiting...
                            pi@Domoticz3:~$
                            
                            mfalkviddM J 2 Replies Last reply
                            0
                            • Sander StolkS Sander Stolk

                              @mfalkvidd I did the make clean and the make install and rebooted.
                              Still 0x4c eq. 76

                              Using username "pi".
                              Server refused our key
                              pi@192.168.1.14's password:
                              ______                      _   _
                              |  _  \                    | | (_)
                              | | | |___  _ __ ___   ___ | |_ _  ___ ____
                              | | | / _ \| '_ ` _ \ / _ \| __| |/ __|_  /
                              | |/ / (_) | | | | | | (_) | |_| | (__ / /
                              |___/ \___/|_| |_| |_|\___/ \__|_|\___/___|
                              
                              
                              Last login: Sat Apr  9 18:41:17 2016 from 192.168.1.34
                              
                              Monday, 11 April 2016, 12:10:24 pm CEST
                              Linux 4.1.18-v7+ armv7l GNU/Linux
                              Uptime.............: 1 days, 17h29m13s
                              Memory.............: 520336kB (Free) / 948056kB (Total)
                              Load Averages......: 0.00, 0.01, 0.05 (1, 5, 15 min)
                              Running Processes..: 97
                              IP Addresses.......: 192.168.1.14
                              
                              pi@Domoticz3:~$ cd Raspberry/
                              pi@Domoticz3:~/Raspberry$ cat MyConfig.h
                              /*
                               The MySensors library adds a new layer on top of the RF24 library.
                               It handles radio network routing, relaying and ids.
                              
                               Created by Henrik Ekblad <henrik.ekblad@gmail.com>
                               12/10/14 - Ported to Raspberry Pi by OUJABER Mohamed <m.oujaber@gmail.com>
                              
                               This program is free software; you can redistribute it and/or
                               modify it under the terms of the GNU General Public License
                               version 2 as published by the Free Software Foundation.
                              */
                              
                              #ifndef MyConfig_h
                              #define MyConfig_h
                              
                              /***
                               * Configure Sensor Network
                               */
                              #define RF24_CHANNEL       111             //RF channel for the sensor net, 0-127
                              #define RF24_DATARATE      RF24_250KBPS   //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
                              #define RF24_PA_LEVEL      RF24_PA_MAX    //Sensor PA Level == RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12dBm, RF24_PA_HIGH=-6dBM, and RF24_PA_MAX=0dBm
                              #define RF24_PA_LEVEL_GW   RF24_PA_MAX  //Gateway PA Level, defaults to Sensor net PA Level.  Tune here if using an amplified nRF2401+ in your gateway.
                              #define BASE_RADIO_ID      ((uint64_t)0xA8A8E1FC00LL) // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
                              
                              // MySensors online examples defaults
                              #define DEFAULT_CE_PIN 9
                              #define DEFAULT_CS_PIN 10
                              
                              
                              /***
                               * Enable/Disable debug logging
                               */
                              #define DEBUG
                              
                              
                              #ifdef __Raspberry_Pi
                                      #define vsnprintf_P vsnprintf
                                      #define snprintf_P snprintf
                                      #define PSTR(x) (x)
                                      #define printf_P printf
                                      #define strlen_P strlen
                              #endif
                              
                              #endif
                              pi@Domoticz3:~/Raspberry$ make clean
                              rm -rf MyGateway MySensor MyMessage PiEEPROM PiGateway PiGatewaySerial MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGateway.o PiGatewaySerial.o
                              pi@Domoticz3:~/Raspberry$ make all
                              g++ -c -o MyGateway.o MyGateway.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                              g++ -c -o MySensor.o MySensor.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                              g++ -c -o MyMessage.o MyMessage.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                              g++ -c -o PiEEPROM.o PiEEPROM.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                              g++ -c -o PiGateway.o PiGateway.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                              g++ -o PiGateway MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGateway.o -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 -lrf24-bcm
                              g++ -c -o PiGatewaySerial.o PiGatewaySerial.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24
                              g++ -o PiGatewaySerial MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGatewaySerial.o -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 -lrf24-bcm -lutil
                              pi@Domoticz3:~/Raspberry$ sudo reboot
                              
                              Broadcast message from pi@Domoticz3 on pts/1 (Mon 2016-04-11 12:12:17 CEST):
                              
                              The system is going down for reboot NOW!
                              
                              pi@Domoticz3:~/Raspberry$
                              Using username "pi".
                              Server refused our key
                              pi@192.168.1.14's password:
                              ______                      _   _
                              |  _  \                    | | (_)
                              | | | |___  _ __ ___   ___ | |_ _  ___ ____
                              | | | / _ \| '_ ` _ \ / _ \| __| |/ __|_  /
                              | |/ / (_) | | | | | | (_) | |_| | (__ / /
                              |___/ \___/|_| |_| |_|\___/ \__|_|\___/___|
                              
                              
                              Last login: Mon Apr 11 12:10:24 2016 from 192.168.1.34
                              
                              Monday, 11 April 2016, 12:12:45 pm CEST
                              Linux 4.1.18-v7+ armv7l GNU/Linux
                              Uptime.............: 0 days, 00h00m25s
                              Memory.............: 770952kB (Free) / 948056kB (Total)
                              Load Averages......: 0.59, 0.16, 0.05 (1, 5, 15 min)
                              Running Processes..: 100
                              IP Addresses.......: 192.168.1.14
                              
                              pi@Domoticz3:~$ ls
                              bash_scripts  domoticz  Dropbox-Uploader  Raspberry  RF24
                              pi@Domoticz3:~$ sudo /etc/init.d/PiGatewaySerial start
                              [ ok ] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.service.
                              pi@Domoticz3:~$ sudo /etc/init.d/PiGatewaySerial start
                              [ ok ] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.service.
                              pi@Domoticz3:~$ sudo ln -s /dev/ttyMySensorsGateway /dev/ttyUSB20
                              ln: failed to create symbolic link ‘/dev/ttyUSB20’: File exists
                              pi@Domoticz3:~$ sudo /usr/local/sbin/PiGatewaySerial
                              Starting PiGatewaySerial...
                              Protocol version - 1.4
                              Created PTY '/dev/pts/2'
                              Gateway tty: /dev/ttyMySensorsGateway
                              ================ SPI Configuration ================
                              CSN Pin          = CE0 (PI Hardware Driven)
                              CE Pin           = Custom GPIO25
                              Clock Speed      = 8 Mhz
                              ================ NRF Configuration ================
                              STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
                              RX_ADDR_P0-1     = 0xa8a8e
                              RX_ADDR_P2-5     = 0xff 0xc4 
                              TX_ADDR          = 0xa8a8e1fc07
                              RX_PW_P0-6       = 0x20 0x20 0x20 0x00 0x00 0x00
                              EN_AA            = 0x3b
                              EN_RXADDR        = 0x06
                              RF_CH            = 0x4c
                              RF_SETUP         = 0x23
                              CONFIG           = 0x0e
                              DYNPD/FEATURE    = 0x3f 0x06
                              Data Rate        = 250KBPS
                              Model            = nRF24L01+
                              CRC Length       = 16 bits
                              PA Power         = PA_LOW
                              read: 5-5-5 s=5,c=5,t=5,pt=0,l=0:
                              version mismatch
                              ^CReceived SIGINT
                              Exiting...
                              pi@Domoticz3:~$
                              
                              mfalkviddM Offline
                              mfalkviddM Offline
                              mfalkvidd
                              Mod
                              wrote on last edited by
                              #95

                              @Sander-Stolk I don't see a new make install in your output. Did you miss that or is the output just not included?

                              make all compiles the code. The result is a binary file in the Raspberry folder
                              make install copies the binary (and some scripts I think) from the Raspberry folder to the system folders.

                              1 Reply Last reply
                              0
                              • Sander StolkS Offline
                                Sander StolkS Offline
                                Sander Stolk
                                wrote on last edited by
                                #96

                                Ok here's the deal to change the channel or other settings:

                                cd Raspberry
                                make clean
                                make all
                                sudo make install
                                Done!

                                1 Reply Last reply
                                1
                                • Tore André RosanderT Offline
                                  Tore André RosanderT Offline
                                  Tore André Rosander
                                  wrote on last edited by Tore André Rosander
                                  #97

                                  Does anyone know what this error is about?
                                  RPi2, NRF24l01, OSMC (Debian jessie), Domoticz v3.5051.

                                  osmc@osmc:~/Raspberry$ sudo make install
                                  Installing PiGatewaySerial to /usr/local/sbin
                                  Installing PiGateway to /usr/local/sbin
                                  Installing initscripts to /etc/init.d
                                  Installing syslog config to /etc/rsyslog.d
                                  Failed to restart rsyslog.service: Unit rsyslog.service failed to load: No such file or directory.
                                  Makefile:79: recipe for target 'install-initscripts' failed
                                  make: *** [install-initscripts] Error 6
                                  

                                  I can run the gateway even with the error, i can also add it to Domoticz and send/receive data.
                                  But after a few minutes i get a massive error in domoticz saying "(24) Too many files open" on every logentry and my domoticz loose connection to the Logitech mediaserver, remote Kodi hardware, mqtt server etc.

                                  osmc@osmc:~/Raspberry$ sudo ./PiGatewaySerial
                                  Starting PiGatewaySerial...
                                  Protocol version - 1.4
                                  Created PTY '/dev/pts/2'
                                  Gateway tty: /dev/ttyMySensorsGateway
                                  ================ SPI Configuration ================
                                  CSN Pin          = CE0 (PI Hardware Driven)
                                  CE Pin           = Custom GPIO25
                                  Clock Speed      = 8 Mhz
                                  ================ NRF Configuration ================
                                  STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
                                  RX_ADDR_P0-1     = 0xa8a8e1fc00 0xa8a8e1fc00
                                  RX_ADDR_P2-5     = 0xff 0xc4 0xc5 0xc6
                                  TX_ADDR          = 0xa8a8e1fc02
                                  RX_PW_P0-6       = 0x20 0x20 0x20 0x00 0x00 0x00
                                  EN_AA            = 0x3b
                                  EN_RXADDR        = 0x06
                                  RF_CH            = 0x4c
                                  RF_SETUP         = 0x23
                                  CONFIG           = 0x0e
                                  DYNPD/FEATURE    = 0x3f 0x06
                                  Data Rate        = 250KBPS
                                  Model            = nRF24L01+
                                  CRC Length       = 16 bits
                                  PA Power         = PA_LOW
                                  
                                  1 Reply Last reply
                                  0
                                  • C Offline
                                    C Offline
                                    cingolanifede
                                    wrote on last edited by
                                    #98

                                    Hi, is signing supported using this library? thanks.

                                    mfalkviddM 1 Reply Last reply
                                    0
                                    • C cingolanifede

                                      Hi, is signing supported using this library? thanks.

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

                                      @cingolanifede the Raspberry Pi gateway does not support signing.

                                      1 Reply Last reply
                                      0
                                      • B Offline
                                        B Offline
                                        BikeDan
                                        wrote on last edited by
                                        #100

                                        I'm looking for some help in getting "PiGatewaySerial" running properly. I am having no issue running "PiGateway" and receiving all data from a counter node I'm using for testing. When I try to run "PiGatewaySerial", only intermittent data appears. For this example, I have my counter sending increasing integers at 1 second intervals, and receives fewer than 1 in 25 through the "PiGatewaySerial" script. I previously had this working reliably on a RPi2, reading in the tty output and logging it to a file. Now, I cannot repeat that on either that device, nor the current RPi B+ I'm working with. I'm sure there's some basic setting that I'm missing, but I can't seem to figure it out. Thanks!

                                        An example of "PiGateway" correctly receiving all messages:

                                        pi@raspberrypi:/dev/pts $ sudo /usr/local/sbin/PiGateway
                                        Starting Gateway...
                                        ================ SPI Configuration ================
                                        CSN Pin  	 = CE0 (PI Hardware Driven)
                                        CE Pin  	 = Custom GPIO25
                                        Clock Speed	 = 8 Mhz
                                        ================ NRF Configuration ================
                                        STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
                                        RX_ADDR_P0-1	 = 0xa8a8e1fc00 0xa8a8e1fc00
                                        RX_ADDR_P2-5	 = 0xff 0xc4 0xc5 0xc6
                                        TX_ADDR		 = 0xe7e7e7e7e7
                                        RX_PW_P0-6	 = 0x20 0x20 0x20 0x00 0x00 0x00
                                        EN_AA		 = 0x3b
                                        EN_RXADDR	 = 0x06
                                        RF_CH		 = 0x4c
                                        RF_SETUP	 = 0x23
                                        CONFIG		 = 0x0e
                                        DYNPD/FEATURE	 = 0x3f 0x06
                                        Data Rate	 = 250KBPS
                                        Model		 = nRF24L01+
                                        CRC Length	 = 16 bits
                                        PA Power	 = PA_LOW
                                        [CALLBACK]0;0;3;0;14;Gateway startup complete.
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:906
                                        [CALLBACK]0;33;1;0;38;906
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:907
                                        [CALLBACK]0;33;1;0;38;907
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:908
                                        [CALLBACK]0;33;1;0;38;908
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:909
                                        [CALLBACK]0;33;1;0;38;909
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:910
                                        [CALLBACK]0;33;1;0;38;910
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:911
                                        [CALLBACK]0;33;1;0;38;911
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:912
                                        [CALLBACK]0;33;1;0;38;912
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:913
                                        [CALLBACK]0;33;1;0;38;913
                                        

                                        an example of "PiGatewaySerial" missing most messages:

                                        pi@raspberrypi:/dev/pts $ sudo /usr/local/sbin/PiGatewaySerial
                                        Starting PiGatewaySerial...
                                        Protocol version - 1.4
                                        Created PTY '/dev/pts/1'
                                        Gateway tty: /dev/ttyMySensorsGateway
                                        ================ SPI Configuration ================
                                        CSN Pin  	 = CE0 (PI Hardware Driven)
                                        CE Pin  	 = Custom GPIO25
                                        Clock Speed	 = 8 Mhz
                                        ================ NRF Configuration ================
                                        STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
                                        RX_ADDR_P0-1	 = 0xa8a8e1fc00 0xa8a8e1fc00
                                        RX_ADDR_P2-5	 = 0xff 0xc4 0xc5 0xc6
                                        TX_ADDR		 = 0xe7e7e7e7e7
                                        RX_PW_P0-6	 = 0x20 0x20 0x20 0x00 0x00 0x00
                                        EN_AA		 = 0x3b
                                        EN_RXADDR	 = 0x06
                                        RF_CH		 = 0x4c
                                        RF_SETUP	 = 0x23
                                        CONFIG		 = 0x0e
                                        DYNPD/FEATURE	 = 0x3f 0x06
                                        Data Rate	 = 250KBPS
                                        Model		 = nRF24L01+
                                        CRC Length	 = 16 bits
                                        PA Power	 = PA_LOW
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:301
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:302
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:303
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:328
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:353
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:378
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:403
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:428
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:454
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:479
                                        read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:504
                                        

                                        I'm running a RPi B+, NRF24l01+, on a clean install of Jessie, and using only a few percent of the CPU power.

                                        1 Reply Last reply
                                        0
                                        • rmtuckerR Offline
                                          rmtuckerR Offline
                                          rmtucker
                                          wrote on last edited by
                                          #101

                                          I have been thinking about giving this a try But:-
                                          The Raspberry port is using protocol version 1.4.
                                          Do the sensors also have to use version 1.4?

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


                                          7

                                          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