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.
  • W wergeld

    @GertSanders What? I was under the impression that some features (like sending messages to nodes from domitcz wouldn't work).

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

    @wergeld
    Did not notice that, I can send values and "switch on" messages to nodes. The only thing I miss is the signing via ATSHA204. Even V_TEXT sending to and from nodes works.

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

      I have some trouble with the gateway not storing the network map, if i restart the gateway my non-sensor nodes need to send some kind of heartbeat to reconnect to the gateway.

      Is this a known problem or is it something wrong with my setup?

      1 Reply Last reply
      0
      • hekH Offline
        hekH Offline
        hek
        Admin
        wrote on last edited by
        #116

        Yes, known problem.

        I had some hopes on @marceloaqno and @aaron832 providing a PR into development branch (so we can scrap the old RPI code). But there hasn't been any activity in a while.
        https://forum.mysensors.org/topic/2759/mysensors-raspberry-port-suggestions/12

        Tore André RosanderT 1 Reply Last reply
        0
        • hekH hek

          Yes, known problem.

          I had some hopes on @marceloaqno and @aaron832 providing a PR into development branch (so we can scrap the old RPI code). But there hasn't been any activity in a while.
          https://forum.mysensors.org/topic/2759/mysensors-raspberry-port-suggestions/12

          Tore André RosanderT Offline
          Tore André RosanderT Offline
          Tore André Rosander
          wrote on last edited by
          #117

          @hek But insted of including heartbeats from every non sensor node (trying to keep 2.4 ghz traffic to a minimum), can i solve this by using an arduino repeater node? So the repeater knows the network map and sends heartbeat to the gateway.

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #118

            @Tore-André-Rosander

            No, not possible. The repeater won't propagate it's knowledge about all sub-nodes.

            1 Reply 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:~$
              
              J Offline
              J Offline
              jpbabou
              wrote on last edited by
              #119

              @Sander-Stolk hi
              how do you achieve to have a nice 'logon' screen ou your PI: Domotics Logo, @ip,memory,date... etc etc..
              Im' newbee on raspberry from france
              HAve a nice day
              JP
              i really want to have the same or any available sample like yours


              | _ \ | | ()
              | | | |
              __ _ __ ___ ___ | |_ _ ___ ____
              | | | / _ | '_ ` _ \ / _ | | |/ | /
              | |/ / () | | | | | | () | |_| | (
              / /
              |
              / _/|| || ||___/ _||_/|

              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

              Tore André RosanderT 1 Reply Last reply
              0
              • J jpbabou

                @Sander-Stolk hi
                how do you achieve to have a nice 'logon' screen ou your PI: Domotics Logo, @ip,memory,date... etc etc..
                Im' newbee on raspberry from france
                HAve a nice day
                JP
                i really want to have the same or any available sample like yours


                | _ \ | | ()
                | | | |
                __ _ __ ___ ___ | |_ _ ___ ____
                | | | / _ | '_ ` _ \ / _ | | |/ | /
                | |/ / () | | | | | | () | |_| | (
                / /
                |
                / _/|| || ||___/ _||_/|

                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

                Tore André RosanderT Offline
                Tore André RosanderT Offline
                Tore André Rosander
                wrote on last edited by
                #120

                @jpbabou That is the Message of the day (motd) and you can edit it to fit your needs.
                This guide should work on debian weezy and jessie
                https://oitibs.com/debian-wheezy-dynamic-motd/

                J 2 Replies Last reply
                0
                • Tore André RosanderT Tore André Rosander

                  @jpbabou That is the Message of the day (motd) and you can edit it to fit your needs.
                  This guide should work on debian weezy and jessie
                  https://oitibs.com/debian-wheezy-dynamic-motd/

                  J Offline
                  J Offline
                  jpbabou
                  wrote on last edited by
                  #121

                  @Tore-André-Rosander
                  Tks a lot for your answer.. It seems to look like what i want at logon..Iwill test it.
                  I keep you in touch!

                  1 Reply Last reply
                  0
                  • Tore André RosanderT Tore André Rosander

                    @jpbabou That is the Message of the day (motd) and you can edit it to fit your needs.
                    This guide should work on debian weezy and jessie
                    https://oitibs.com/debian-wheezy-dynamic-motd/

                    J Offline
                    J Offline
                    jpbabou
                    wrote on last edited by
                    #122

                    @Tore-André-Rosander
                    Tks a lot
                    It works's fine!!
                    pi@JpPi2 ~ $ ssh JpPi3
                    _ ____ _ _____
                    | |_ __ | _ ()__ /
                    _ | | '_ | |) | | |
                    | || | |) | /| |) |
                    _
                    /| ._/|| ||___/
                    |
                    |

                    Welcome to Raspbian GNU/Linux 8.0 (jessie) (4.4.7-v7+).

                    System information as of: Wed Jun 1 09:10:09 CEST 2016

                    System load: 0.01 IP Address:
                    Memory usage: 17.9% System uptime: 1 day
                    Usage on /: 27% Swap usage: 0.0%
                    Local Users: 1 Processes: 126

                    Last login: Wed Jun 1 09:03:53 2016 from raspberryjp

                    1 Reply Last reply
                    1
                    • A Offline
                      A Offline
                      Atman
                      wrote on last edited by
                      #123

                      I have been struggeling with this for some time now. It seems my compiler is not the standard for raspberry pi? (I have a pi 2). I have used the domoticz sdcard as ground for my system and it works (a bit sketchy with random freezes and I cannot access the domotics webserver from chrome) but still. Anyway, I get stuck on making the RF24 package. Any ideas?

                      pi@raspberrypi ~/RF24 $ make all && sudo make install
                      arm-linux-gnueabihf-g++ -fPIC -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -Ofast -Wall -pthread  -c RF24.cpp
                      cc1plus: error: bad value (cortex-a7) for -mtune switch
                      Makefile:40: recipe for target 'RF24.o' failed
                      make: *** [RF24.o] Error 1
                      
                      1 Reply Last reply
                      0
                      • alexsh1A Offline
                        alexsh1A Offline
                        alexsh1
                        wrote on last edited by
                        #124

                        Did anyone setup rfm69 successfully on the raspberry pi

                        1 Reply Last reply
                        0
                        • GertSandersG Offline
                          GertSandersG Offline
                          GertSanders
                          Hardware Contributor
                          wrote on last edited by
                          #125

                          Has anyone used the Raspberry GW software in combination with nodes that run the new 2.0.0 MySensors code ?

                          1 Reply Last reply
                          0
                          • tbowmoT Offline
                            tbowmoT Offline
                            tbowmo
                            Admin
                            wrote on last edited by
                            #126

                            @GertSanders

                            It's not supported, 2.0.0 nodes require a 2.0.0 GW. And the raspberry pi port is not updated to 2.0.0 (and unfortunately there is currently no one in the core group that uses the rpi gw.. We all use serial / ethernet gw's of some sort)

                            GertSandersG W 2 Replies Last reply
                            0
                            • tbowmoT tbowmo

                              @GertSanders

                              It's not supported, 2.0.0 nodes require a 2.0.0 GW. And the raspberry pi port is not updated to 2.0.0 (and unfortunately there is currently no one in the core group that uses the rpi gw.. We all use serial / ethernet gw's of some sort)

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

                              @tbowmo
                              I was afraid of that. In my enthusiasm I updated to 2.0.0, but now my new nodes play dead.
                              At least I know why.
                              Time to make that old ethernet gateway functional again.
                              Since Breda meetup is this weekend, I will have no more time to figure this out (if I could ever, this is UNIX). Maybe after I can try something.

                              GertSandersG 1 Reply Last reply
                              0
                              • tbowmoT tbowmo

                                @GertSanders

                                It's not supported, 2.0.0 nodes require a 2.0.0 GW. And the raspberry pi port is not updated to 2.0.0 (and unfortunately there is currently no one in the core group that uses the rpi gw.. We all use serial / ethernet gw's of some sort)

                                W Offline
                                W Offline
                                wergeld
                                wrote on last edited by
                                #128

                                @tbowmo

                                What would be required to get the RPi gateway up and running? Having single controller/gateway is great.

                                GertSandersG 1 Reply Last reply
                                0
                                • GertSandersG Offline
                                  GertSandersG Offline
                                  GertSanders
                                  Hardware Contributor
                                  wrote on last edited by
                                  #129

                                  @tbowmo
                                  Is a 2.0.0 based gateway backward compatible with nodes in an older version ?

                                  1 Reply Last reply
                                  0
                                  • W wergeld

                                    @tbowmo

                                    What would be required to get the RPi gateway up and running? Having single controller/gateway is great.

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

                                    @wergeld
                                    Probably porting the Arduino lib to Raspberry and compiling again ?

                                    W 1 Reply Last reply
                                    0
                                    • GertSandersG GertSanders

                                      @tbowmo
                                      I was afraid of that. In my enthusiasm I updated to 2.0.0, but now my new nodes play dead.
                                      At least I know why.
                                      Time to make that old ethernet gateway functional again.
                                      Since Breda meetup is this weekend, I will have no more time to figure this out (if I could ever, this is UNIX). Maybe after I can try something.

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

                                      @tbowmo
                                      Is the last 2.0.0-dev version (before the new 2.0.0 official release) still available somewhere ?
                                      That DEV version seemed to still work with my Raspi GW.

                                      1 Reply Last reply
                                      0
                                      • GertSandersG GertSanders

                                        @wergeld
                                        Probably porting the Arduino lib to Raspberry and compiling again ?

                                        W Offline
                                        W Offline
                                        wergeld
                                        wrote on last edited by
                                        #132

                                        @GertSanders

                                        Time to start reading up on converting the lib! Might have a go at it in week or so. Work is holding me hostage at the moment.

                                        1 Reply Last reply
                                        0
                                        • GertSandersG Offline
                                          GertSandersG Offline
                                          GertSanders
                                          Hardware Contributor
                                          wrote on last edited by
                                          #133

                                          Praise Apple for making TimeMachine. I was able to set back the last version of MySensors lib I know was working with my gateway in a bout 1 minute.

                                          Back in business now. Upgrading the gateway and nodes to full 2.0.0 is for later.

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


                                          10

                                          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