Skip to content
  • 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. Controllers
  3. [Tutorial] Raspberry Pi NRF24l01 direct connection
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

[Tutorial] Raspberry Pi NRF24l01 direct connection

Scheduled Pinned Locked Moved Controllers
raspberry pinrf24l01
56 Posts 32 Posters 85.9k Views 24 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.
  • Daniel OliveiraD Offline
    Daniel OliveiraD Offline
    Daniel Oliveira
    wrote on last edited by
    #41

    Hi @hek

    I know that a lot if going on regarding the MySensors 1.6 but I would like to know the plans for the repo mysensors/Raspberry?

    Is there any plans to keep developing it of merging it with the main libraries?

    I would like to be able to run the latest version on my Pi and I'm more than willing to help making it possible :)

    Cheers

    MySensors rules my home :)

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

      Hi @Daniel-Oliveira,

      I've talked with @Anticimex and @thozza about it... We think it would be best to move the RPi build file and any eventual support libs into the main MySensors repo to keep it in sync with the rest .

      Not sure if @thozza has begun working on some autoconf script or not (did you?). But I imagine he'd appreciate any help you can contribute with.

      1 Reply Last reply
      0
      • J jelluz

        (solved)
        Hi. Thanks a lot for this implentation and the helpful posts here!

        I've got the gateway working with a tmp75 temperature sensor on an arduino. The nrf24 is sitting on the raspberry directly (CE pin 22), as a controller i'm using PiMatic. It works very nicely!

        There is one small problem however. The PiGatewaySerial will only work if i have called PiGateway before (and closed it again). With working I mean picking up radio transmissions from my sensor node. Everything else seems normal (/dev/ttyPiGatewaySerial and radio details printout).

        The details of both configurations might give a clue:

        pi@raspberrypi ~/mysensors_rpi $ sudo ./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: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
        [CALLBACK]4;0;1;0;0;22.9
        read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
        

        after closing PiGateway and opening PiGatewaySerial i get this:

        pi@raspberrypi ~/mysensors_rpi $ sudo ./PiGatewaySerial
        Starting PiGatewaySerial...
        Protocol version - 1.4
        Created PTY '/dev/pts/3'
        Gateway tty: /dev/ttyMySensorsGateway
        ================ SPI Configuration ================
        CSN Pin          = CE0 (PI Hardware Driven)
        CE Pin           = Custom GPIO22
        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: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
        read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
        read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
        read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
        read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
        read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
        read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.9
        read: 4-4-0 s=0,c=1,t=0,pt=7,l=5:22.8
        

        Notice how the CE pins of both SPI configurations are different!

        I'm at the point that i want to daemonize the gateway. Which in fact i did, but the same problem persists. Before i hack the startup script to first run and close PiGateway before PiGatewaySerial, i was hoping that someone has an idea what i'm doing wrong.

        Thanks in advance!

        solved!
        I have two RPIs (a Pi 2 B and a Pi B+), which both worked with the pyRF24 lib of TMRh20, so when i had a look in the source of the radio initialization of PiGatewaySerial and found this:

        #ifdef __PI_BPLUS
        	gw = new MyGateway(RPI_BPLUS_GPIO_J8_15, RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ, 1);
        #else
        	gw = new MyGateway(RPI_V2_GPIO_P1_22, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ, 1);
        #endif	
        

        When i changed it to:

        #ifdef __PI_BPLUS
        	gw = new MyGateway(RPI_V2_GPIO_P1_22, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ, 1);
        #else
        	gw = new MyGateway(RPI_V2_GPIO_P1_22, BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ, 1);
        #endif	
        

        and recompiled the gateways,it all started to work. After powerup everything runs :).

        The Rpi that is connected now is the Pi 2 B. So i guess either i have my nrf25 wired differently then defined in this lib, or the precompiler was thinking i have a B+ connected. Or both.
        I will find out when i get this also working on my B+.

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

        @jelluz
        I have got he sme configuration between Arduiono et a PIGATEWAYSERIAL ?
        How do you declare it into a controler like Pimatic (you says that it works fine)
        Tkd for your advice

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mediacj
          wrote on last edited by
          #44

          I'am trying to get this working on my Raspberry Pi 2 B with Raspbian but when using the setup.sh command I get this error:

          bcm2835.c: In function ‘bcm2835_init’:
          bcm2835.c:1207:28: error: invalid suffix "x" on integer constant
          bcm2835.c:1208:28: error: invalid suffix "x" on integer constant
          bcm2835.c:1209:28: error: invalid suffix "x" on integer constant
          bcm2835.c:1210:28: error: invalid suffix "x" on integer constant
          bcm2835.c:1211:28: error: invalid suffix "x" on integer constant
          bcm2835.c:1212:28: error: invalid suffix "x" on integer constant
          bcm2835.c:1213:28: error: invalid suffix "x" on integer constant
          bcm2835.c:1214:28: error: invalid suffix "x" on integer constant
          bcm2835.c:1228:83: error: invalid suffix "x" on integer constant
          bcm2835.c:1232:81: error: invalid suffix "x" on integer constant
          bcm2835.c:1236:81: error: invalid suffix "x" on integer constant
          bcm2835.c:1239:83: error: invalid suffix "x" on integer constant
          bcm2835.c:1242:83: error: invalid suffix "x" on integer constant
          bcm2835.c:1246:83: error: invalid suffix "x" on integer constant
          bcm2835.c:1249:83: error: invalid suffix "x" on integer constant
          bcm2835.c:1253:79: error: invalid suffix "x" on integer constant
          Makefile:52: recipe for target 'bcm2835.o' failed
          make: *** [bcm2835.o] Error 1

          Any idea what is going wrong? Thanks in advance!

          W 1 Reply Last reply
          0
          • M Mediacj

            I'am trying to get this working on my Raspberry Pi 2 B with Raspbian but when using the setup.sh command I get this error:

            bcm2835.c: In function ‘bcm2835_init’:
            bcm2835.c:1207:28: error: invalid suffix "x" on integer constant
            bcm2835.c:1208:28: error: invalid suffix "x" on integer constant
            bcm2835.c:1209:28: error: invalid suffix "x" on integer constant
            bcm2835.c:1210:28: error: invalid suffix "x" on integer constant
            bcm2835.c:1211:28: error: invalid suffix "x" on integer constant
            bcm2835.c:1212:28: error: invalid suffix "x" on integer constant
            bcm2835.c:1213:28: error: invalid suffix "x" on integer constant
            bcm2835.c:1214:28: error: invalid suffix "x" on integer constant
            bcm2835.c:1228:83: error: invalid suffix "x" on integer constant
            bcm2835.c:1232:81: error: invalid suffix "x" on integer constant
            bcm2835.c:1236:81: error: invalid suffix "x" on integer constant
            bcm2835.c:1239:83: error: invalid suffix "x" on integer constant
            bcm2835.c:1242:83: error: invalid suffix "x" on integer constant
            bcm2835.c:1246:83: error: invalid suffix "x" on integer constant
            bcm2835.c:1249:83: error: invalid suffix "x" on integer constant
            bcm2835.c:1253:79: error: invalid suffix "x" on integer constant
            Makefile:52: recipe for target 'bcm2835.o' failed
            make: *** [bcm2835.o] Error 1

            Any idea what is going wrong? Thanks in advance!

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

            @Mediacj I too had this error. The only way I was ever to solve this was to take a fresh image of Wheezy and start from scratch there. No sudo apt-get updated/upgrade until after I built the lib.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Mediacj
              wrote on last edited by
              #46

              Thanks for your answer, I am going to try that this weekend.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tbully
                wrote on last edited by
                #47

                Hello everyone! Great work here! I see this is still running the 1.4 protocol, is that right? I was able to get this working but only my temp sensors would respond. Anything where I had to send data wouldn't work.

                Any chance of moving to 1.5 in the near future?

                Thanks!

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  ArieKanarie
                  wrote on last edited by
                  #48

                  It might be a stupid question, but I've been staring at my screen for hours now, and can't find the solution.
                  How do i install/ connect this gatewatay in domoticz?

                  I have a Raberry Pi (2) with domoticz installed, followd this tutorial and connected the NRF24l01 directly to the gpio, and according to the printout everything works.

                  So took a Arduino Uno, connected a magnetic doorsensor and a NRF24l01 and uploaded the right sketch, all ok and it even seems that the Raspberry is receiveing the data
                  pigateway.png

                  But what kind of gateway do I select in Domoticz?
                  When I select Mysensors USB gateway I can't choose a serial port (seem legit since there is no usb connected), what hardware do I select??

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

                    @ArieKanarie Mysensors USB gateway is correct. I think you need to perform the steps mentioned in section "Enable the gateway for use with Domoticz" at http://forum.mysensors.org/topic/2437/step-by-step-procedure-to-connect-the-nrf24l01-to-the-gpio-pins-and-use-the-raspberry-as-a-serial-gateway?page=1

                    T A 2 Replies Last reply
                    1
                    • mfalkviddM mfalkvidd

                      @ArieKanarie Mysensors USB gateway is correct. I think you need to perform the steps mentioned in section "Enable the gateway for use with Domoticz" at http://forum.mysensors.org/topic/2437/step-by-step-procedure-to-connect-the-nrf24l01-to-the-gpio-pins-and-use-the-raspberry-as-a-serial-gateway?page=1

                      T Offline
                      T Offline
                      tbully
                      wrote on last edited by
                      #50

                      @mfalkvidd said in Step-by-step procedure to connect the NRF24L01 to the GPIO pins and use the Raspberry as a Serial Gateway.:

                      @Eawo Yes, it should work. I ran Domoticz and MySensors Gateway on my Raspberry Pi 1 when I first tried MySensors. If I remember correctly I had to connect CE to pin 15 instead of 22 but I am not sure why. Try using the same connections as on your Raspberry Pi 2 first, and switch CE pin if you get "check wires". Please report back here how it goes, so I can add the necessary information to the original post.

                      For what it's worth, this is correct. I'm currently running on a Pi 1 and put CE on 15.

                      I followed these instructions and it worked perfectly with no fuss: http://forum.mysensors.org/topic/1151/tutorial-raspberry-pi-nrf24l01-direct-connection

                      1 Reply Last reply
                      1
                      • mfalkviddM mfalkvidd

                        @ArieKanarie Mysensors USB gateway is correct. I think you need to perform the steps mentioned in section "Enable the gateway for use with Domoticz" at http://forum.mysensors.org/topic/2437/step-by-step-procedure-to-connect-the-nrf24l01-to-the-gpio-pins-and-use-the-raspberry-as-a-serial-gateway?page=1

                        A Offline
                        A Offline
                        ArieKanarie
                        wrote on last edited by
                        #51

                        @mfalkvidd Thanks you very much sir!

                        1 Reply Last reply
                        1
                        • jerseyguy1996J Offline
                          jerseyguy1996J Offline
                          jerseyguy1996
                          wrote on last edited by
                          #52

                          make file has changes and there is no more librf24-bcm. Refer to the readme on the git and follow them

                          1 Reply Last reply
                          0
                          • t481T Offline
                            t481T Offline
                            t481
                            wrote on last edited by
                            #53

                            Hello all,
                            I hope someone can help with this.

                            Is there any way to run the generated ./PiGatewaySerial application in the background? I've got mine to work perfectly but only if I SSH into my Pi and execute the app using "sudo ./PiGatewaySerial". I'm looking to run this as a background service/application. Whichever is easier.

                            Thanks in advance

                            1 Reply Last reply
                            0
                            • L Offline
                              L Offline
                              lasicmk2
                              wrote on last edited by
                              #54

                              Hi

                              the easiest way is to run directly in background:

                              nohup sudo python script.py &
                              

                              or - run script as a service and use it as other services, but above is the easiest.

                              Adam

                              1 Reply Last reply
                              0
                              • Fat FlyF Offline
                                Fat FlyF Offline
                                Fat Fly
                                wrote on last edited by
                                #55

                                This is working with latest mysensors library ?

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

                                  @Fat-Fly
                                  MySensors is now natively supported to run on Raspberry. See here for instruction on how to build:
                                  https://www.mysensors.org/build/raspberry

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


                                  14

                                  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
                                  • OpenHardware.io
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular