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.
  • martinhjelmareM Offline
    martinhjelmareM Offline
    martinhjelmare
    Plugin Developer
    wrote on last edited by martinhjelmare
    #72

    Jessie uses a different init system than Wheezy. Systemd should be able to handle most old init scripts, but this case might be an exception.

    Has anyone successfully installed this on Jessie?

    A unit file for systemd would be a good addition, in any case, in my opinion.

    GertSandersG 1 Reply Last reply
    0
    • martinhjelmareM martinhjelmare

      Jessie uses a different init system than Wheezy. Systemd should be able to handle most old init scripts, but this case might be an exception.

      Has anyone successfully installed this on Jessie?

      A unit file for systemd would be a good addition, in any case, in my opinion.

      GertSandersG Offline
      GertSandersG Offline
      GertSanders
      Hardware Contributor
      wrote on last edited by
      #73

      @martinhjelmare

      I'm on the latest Jessie version. Prior to that I also used DietPi as a platform for Domoticz and Mysensors. I have not done an apt-get update or apt-upgrade since the install (I used the Jessie image from the Raspberry Org site).

      As for load, here is the image of Domoticz CPU load of the last year:

      0_1458749110546_upload-1e3bf645-1595-4d9d-9635-52cf04407556

      As you can see, combining the Gateway function with the Controller function on the Raspberry 2 gives virtually no load. I could probably add the Plex Media Player software to this and still have room for some more cron jobs.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shabba
        wrote on last edited by
        #74

        Hi - I saw enquires months ago about getting RF69 working - has anyone done so? thanks!

        mfalkviddM 1 Reply Last reply
        0
        • S shabba

          Hi - I saw enquires months ago about getting RF69 working - has anyone done so? thanks!

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

          @shabba the best discussion I've seen so far is http://forum.mysensors.org/topic/1918/what-radio-to-use-nrf24l01-rfm69-rfm73/

          1 Reply Last reply
          0
          • S Offline
            S Offline
            shabba
            wrote on last edited by
            #76

            Thanks @mfalkvidd - will check it out.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              shabba
              wrote on last edited by
              #77

              Ps. I followed https://github.com/abouillot/HomeAutomation/tree/master/piGateway and now have a MQTT service running. But I do not know how to connect this to domoticz or even debug that it can actually see my test sensor etc.

              1 Reply Last reply
              0
              • haydukeH hayduke

                @mfalkvidd said:

                @Justinian looks like you forgot to run "sudo make install" after "make all"

                I took a little break from this project, but I worked on it again this weekend. I decided to start from scratch and rebuild the gateway completely. I put a fresh Domoticz image onto the SD card, updated and upgraded, cloned, compiled, and installed the RF24 and Raspberry code.

                Now I have the exact same symptom as Justinian :(

                Since this used to work for me at some point, next I will try using an older Dmoticz image. I read somewhere that people had better success by NOT using apt-get update. Perhaps it's a problem with Jessie vs Wheezy? Domoticz switched kernels during on of the version upgrades.

                Winter is over, so I can live without getting my furnace controls working right now. I know relays have an issue, but now I'm just needing to monitor the temperature in an egg incubator.

                I'm surprised that using a rpi with this radio module directly attached is not a more popular platform. Is it just not a reliable platform? With the rpi3 out now, there shouldn't be a CPU load issue trying to act as an HA controller even with a large installation. I've got lots of ideas I want to implement if I can ever get a stable backend.

                strangerS Offline
                strangerS Offline
                stranger
                wrote on last edited by
                #78

                This thread has been great - thanks @mfalkvidd!

                @hayduke I had a similar problem earlier. I haven't fixed it yet, but here's where I'm at:

                Clean install (Jessie, RF24, Raspberry) March 25th 2016 has the problem where it works for a few minutes, then stops (/dev/pts/0 dissapears, which breaks the symbolic links - ttyMySensorsGateway and ttyUSB20). This is at home where I have a bunch of nodes around and a Vera with serial gateway, so there are lots of different signals coming in.

                But when I move to another location with just one node (that just sends a light status update regularly), it works fine - at least, I've been sitting here with it running for 30 minutes so far.

                I know this might not help much, I'm new to all this and still getting my head around everything. I would probably agree with what you suggested earlier: something in one of the messages that causes a problem with the gateway (possibly to do with already having another serial gateway nearby).

                I'll try to do some more testing by changing this gateway to a different channel to my other one, and gradually bringing nodes across to see when it breaks.

                1 Reply Last reply
                1
                • alexsh1A Offline
                  alexsh1A Offline
                  alexsh1
                  wrote on last edited by
                  #79

                  @stranger just to make sure - you said you have two gateways at home. Did you change the channel so that they do not interfere with each other?

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

                    Hello, im just starting to set up some mysensors nodes and have already set up a gateway with nodemcu (esp).
                    But to eliminate the number of devices i am thinking about moving the gateway directly to the Raspberry pi as mentioned in this thread. Is there any downsides (or upsides) by connecting the nrf24 chip directly to the RPI?

                    And btw:
                    "The radio module NRF24L01+ is cheap and power efficient, but it is unable to communicate with regular wifi."
                    That is not entirely correct, the nrf24 can connecct to wifi and send TCP/IP packets with an arduino.

                    1 Reply Last reply
                    0
                    • alexsh1A alexsh1

                      @stranger just to make sure - you said you have two gateways at home. Did you change the channel so that they do not interfere with each other?

                      strangerS Offline
                      strangerS Offline
                      stranger
                      wrote on last edited by
                      #81

                      @alexsh1 No actually. I didn't want to go around and reprogram all my nodes, and I forgot to turn off my other gateway. That is what I was going to do next, but I've just been running it for a few hours with no problems (with a heap of nodes and another gateway a few metres away, all on the same channel).

                      I then Home Assistant and tested out a few nodes, and now it sometimes breaks, but mostly works fine.

                      All that being said, I've realised I need signing (I have a few electronic locks), so I'm going back to a hardware serial gateway. If anyone has got signing working I'd love to hear how - I had a look but couldn't figure it out and don't have much time to spare on it.

                      1 Reply Last reply
                      0
                      • 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
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          9

                                          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