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. Announcements
  3. 💬 Building a Raspberry Pi Gateway
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

💬 Building a Raspberry Pi Gateway

Scheduled Pinned Locked Moved Announcements
1.1k Posts 173 Posters 422.5k Views 131 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B barrydou

    @mfalkvidd I don't know what DI00 is, and if it's equivalent to IRQ ? If Yes, it's exactly what I need ! Thank you !!! :) I will test it as soon as I get my RFM69

    Here is the pin mapping between RFM69W/NRF24 and Arduino/Raspberry

    Arduino mini - NRF24  - RFM69 - Raspberry GW NRF - Raspberry GW RFM 
    9            - CE     - N/A   - 22               - N/A
    10           - CSN/CS - NSS   - 24               - 24
    13           - SCK    - SCK   - 23               - 23
    11           - MOSI   - MOSI  - 19               - 19
    12           - MISO   - MISO  - 21               - 21
    2            - IRQ    - DI00  - 15               - 22
    

    So, the only mismatch breaking pin compatibility (and preventing to use adaptors on the raspberry pi gateway) is on IRQ/DI00. Adaptors wire RFM69 DI00 on NRF24 IRQ pin, but they don't use, by default, the same pin on raspberry, depending the radio type.

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

    @barrydou I don't know what dio0 is either, but https://learn.sparkfun.com/tutorials/rfm69hcw-hookup-guide/all describes it like this:

    Digital I/O 0
    RX interrupt Received data ready interrupt signal from RFM69HCW to microcontroller

    which sounds like it could be interrupt. It might be worth a try at least.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      barrydou
      wrote on last edited by
      #1002

      @mfalkvidd Thank you.
      I've found that too https://www.mysensors.org/apidocs/RFM69_8h_source.html
      It's clearly indicated that DIO0 is IRQ.

      So I think with "--my-rfm69-irq-pin=" it will do the job.

      I'll test it as soon as i'll receive RFM69.

      Thank you again

      1 Reply Last reply
      1
      • M marceloaqno

        @jerseyguy1996 Are you using a decoupling capacitor?

        R Offline
        R Offline
        rolandow
        wrote on last edited by
        #1003

        @marceloaqno Sorry to kick this old topic, but I will soon be trying to build my gateway with a Raspberry pi. I was wondering if the capacitor is also required for the gateway, or just for the nodes?

        Because at the instruction page on how to wire and build a Raspberry Pi gateway, the capacitor isn't mentioned.

        I'll be using a RPI 1 and NRF24L01+

        mfalkviddM 1 Reply Last reply
        0
        • R rolandow

          @marceloaqno Sorry to kick this old topic, but I will soon be trying to build my gateway with a Raspberry pi. I was wondering if the capacitor is also required for the gateway, or just for the nodes?

          Because at the instruction page on how to wire and build a Raspberry Pi gateway, the capacitor isn't mentioned.

          I'll be using a RPI 1 and NRF24L01+

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

          @rolandow yes the capacitor is needed. I'll add that info to the page. Thanks for noticing.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rolandow
            wrote on last edited by
            #1005

            Ok, one more question. I thought I read somewhere that the wiring between the RPI and de radio should be as short as possible, but I can't find exactly where I read that anymore.

            At another project (zigbee2mqtt) I read that users had better reception when they placed the transceiver further away from the controller, because there was less inteference. So if possible, I would like to use a piece of UTP cable to wire the radio to the raspberry pi. That way I can put the rpi inside a closet, but the radio outside.

            So I am not sure if longer wires (say 2, 3 meters) is going to be a problem?

            mfalkviddM 1 Reply Last reply
            0
            • R rolandow

              Ok, one more question. I thought I read somewhere that the wiring between the RPI and de radio should be as short as possible, but I can't find exactly where I read that anymore.

              At another project (zigbee2mqtt) I read that users had better reception when they placed the transceiver further away from the controller, because there was less inteference. So if possible, I would like to use a piece of UTP cable to wire the radio to the raspberry pi. That way I can put the rpi inside a closet, but the radio outside.

              So I am not sure if longer wires (say 2, 3 meters) is going to be a problem?

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

              @rolandow there could be a problem.

              There are two things to consider.

              1. Power drop due to resistance in the cable. See https://electronics.stackexchange.com/questions/113253/voltage-drop-and-safe-current-load-on-cat5-cable for details but use the current used by the radio (provided in the datasheet) instead of the 2.5A used in that question.

              2. SPI communication problems due to capacitance in the cable. See https://electronics.stackexchange.com/questions/163468/spi-max-distance for details. See also my post at https://forum.mysensors.org/post/92967 for oscilloscope pictures of what an i2c signal can look like through a long cable. SPI can handle longer cable lengts than i2c though.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                rolandow
                wrote on last edited by
                #1007
                1. For me, my electronics is not as good as my development skills ;-). But I gave it a try. According to the datasheet the NRF24 will consume about 14 mA max. My cable is 2 m max, so then the resistance is 0,16ohms. So if I understand correctly the voltage drop would be 0,00224 volt. Sounds neglegtable to me? Also; can't I just measure the voltage at the end of the cable once it's connected to the RPI?

                2. At the stackoverflow page somebody says: "In an answer on a Microchip forum, Jan Axelson, author of 'Serial Port Complete', claims a maximum cable length of 10' for the SPI bus. Other posts have mentioned the same figure.". So 10" is about 3 metres, so I am within that range. I do understand though that this isn't a preferred thing to do.

                Which makes me wonder how other people handle this. I mean; I think ideally you'd want the radio that is connected to the controller in the most 'center' way of the home, right? So do people just hange the Pi and the whole shebang to the ceiling? ;-) I'd rather put the controller in the closet where my modem and router are, and then only wire the receiver to outside the closet. Isn't there a better way to do this?

                mfalkviddM 1 Reply Last reply
                1
                • R rolandow
                  1. For me, my electronics is not as good as my development skills ;-). But I gave it a try. According to the datasheet the NRF24 will consume about 14 mA max. My cable is 2 m max, so then the resistance is 0,16ohms. So if I understand correctly the voltage drop would be 0,00224 volt. Sounds neglegtable to me? Also; can't I just measure the voltage at the end of the cable once it's connected to the RPI?

                  2. At the stackoverflow page somebody says: "In an answer on a Microchip forum, Jan Axelson, author of 'Serial Port Complete', claims a maximum cable length of 10' for the SPI bus. Other posts have mentioned the same figure.". So 10" is about 3 metres, so I am within that range. I do understand though that this isn't a preferred thing to do.

                  Which makes me wonder how other people handle this. I mean; I think ideally you'd want the radio that is connected to the controller in the most 'center' way of the home, right? So do people just hange the Pi and the whole shebang to the ceiling? ;-) I'd rather put the controller in the closet where my modem and router are, and then only wire the receiver to outside the closet. Isn't there a better way to do this?

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

                  Nice work @rolandow
                  You can measure the voltage drop, if you put a load of 14mA on the cable. But without load, there will be no voltage drop.

                  One small adjustment on your calculation: there will be 4m cable (2m to the radio and 2m back). But the drop will still be negligable for a normal nrf24.

                  1 Reply Last reply
                  1
                  • monteM Offline
                    monteM Offline
                    monte
                    wrote on last edited by monte
                    #1009

                    Please edit the image used in this tutorial:
                    alt text
                    It is wrong and misleading, as it says that pin36 is SPI1 CS0. In fact SPI1 CS0 by default is pin12. To be able to use pin36 as SPI1 CS0 one have to follow implicit steps which can be found on this forum thread: https://www.raspberrypi.org/forums/viewtopic.php?t=203776.
                    Also it would be useful to add instructions to enable SPI1 in /boot/config.txt to the tutorial.

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      Rolo6442u
                      wrote on last edited by
                      #1010

                      I want to run this gateway with another networkid (RFM69) but can't find how to do this. The option --my-rfm69-networkid=105 in the config line is ignored. So maybe it should go in the mysensnsors.conf file, but what is the syntax of this option?
                      Thanks.

                      mfalkviddM 1 Reply Last reply
                      0
                      • R Rolo6442u

                        I want to run this gateway with another networkid (RFM69) but can't find how to do this. The option --my-rfm69-networkid=105 in the config line is ignored. So maybe it should go in the mysensnsors.conf file, but what is the syntax of this option?
                        Thanks.

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

                        @rolo6442u where did you find my-rfm69-networkid? I don't think such an option has ever existed. If you found it somewhere we probably need to update that documentation.

                        Follow the instructions at https://www.mysensors.org/build/raspberry#advanced to set defines.

                        R 1 Reply Last reply
                        0
                        • mfalkviddM mfalkvidd

                          @rolo6442u where did you find my-rfm69-networkid? I don't think such an option has ever existed. If you found it somewhere we probably need to update that documentation.

                          Follow the instructions at https://www.mysensors.org/build/raspberry#advanced to set defines.

                          R Offline
                          R Offline
                          Rolo6442u
                          wrote on last edited by
                          #1012

                          @mfalkvidd
                          I did not found it, I kind of made it up, following the syntax of other options.
                          Looks like there is no way of changing the ID at this moment for the PI gateway.

                          mfalkviddM 1 Reply Last reply
                          0
                          • R Rolo6442u

                            @mfalkvidd
                            I did not found it, I kind of made it up, following the syntax of other options.
                            Looks like there is no way of changing the ID at this moment for the PI gateway.

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

                            @rolo6442u ok. Well, making things up will usually not add them to the code ;-)

                            There is a way. Two actually. Set the define in one of the two ways described on the link I provided.

                            R 1 Reply Last reply
                            0
                            • mfalkviddM mfalkvidd

                              @rolo6442u ok. Well, making things up will usually not add them to the code ;-)

                              There is a way. Two actually. Set the define in one of the two ways described on the link I provided.

                              R Offline
                              R Offline
                              Rolo6442u
                              wrote on last edited by
                              #1014

                              @mfalkvidd
                              Thanks, will take a look at that.

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mafe
                                wrote on last edited by
                                #1015

                                Is it also possible to read a sensor directly at the Raspberry Pi MQTT Gateway? I only want to send the status of a GPIO via MQTT. Is there an example code for this combination?

                                1 Reply Last reply
                                0
                                • alowhumA Offline
                                  alowhumA Offline
                                  alowhum
                                  Plugin Developer
                                  wrote on last edited by alowhum
                                  #1016

                                  Might be nice to know it compilation still seems to works fine on Raspbian Buster on a Raspberry Pi 4.

                                  // Update: unlike on the Pi 3 I now had to activate SPI. Might be good to make that more prominent in the explanation now.

                                  mfalkviddM 1 Reply Last reply
                                  0
                                  • alowhumA alowhum

                                    Might be nice to know it compilation still seems to works fine on Raspbian Buster on a Raspberry Pi 4.

                                    // Update: unlike on the Pi 3 I now had to activate SPI. Might be good to make that more prominent in the explanation now.

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

                                    @alowhum to my knowledge, activating SPI has always been required, unless the user has already activated SPI by some other means.

                                    Do you have a suggestion on how to make it more prominent that what it is now? Preferably without contributing too much to the pileup of notices that scare users - everything is super-important to at least 1 person.

                                    alowhumA 1 Reply Last reply
                                    0
                                    • mfalkviddM mfalkvidd

                                      @alowhum to my knowledge, activating SPI has always been required, unless the user has already activated SPI by some other means.

                                      Do you have a suggestion on how to make it more prominent that what it is now? Preferably without contributing too much to the pileup of notices that scare users - everything is super-important to at least 1 person.

                                      alowhumA Offline
                                      alowhumA Offline
                                      alowhum
                                      Plugin Developer
                                      wrote on last edited by alowhum
                                      #1018

                                      @mfalkvidd I don't know, perhaps mention it as something that has to be done upfront instead of something that might need to be done if there is an error?

                                      I'm not having any luck actually getting the radio to work. I now noticed this warning during compilation:

                                      g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=127,0,0,1  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o
                                      drivers/Linux/GPIO.cpp: In constructor ‘GPIOClass::GPIOClass()’:
                                      drivers/Linux/GPIO.cpp:53:18: warning: ‘%s’ directive writing up to 255 bytes into a region of size 48 [-Wformat-overflow=]
                                          sprintf(file, "/sys/class/gpio/%s/base", de->d_name);
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
                                      drivers/Linux/GPIO.cpp:53:11: note: ‘sprintf’ output between 22 and 277 bytes into a destination of size 64
                                          sprintf(file, "/sys/class/gpio/%s/base", de->d_name);
                                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      drivers/Linux/GPIO.cpp:62:18: warning: ‘%s’ directive writing up to 255 bytes into a region of size 48 [-Wformat-overflow=]
                                          sprintf(file, "/sys/class/gpio/%s/ngpio", de->d_name);
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                      drivers/Linux/GPIO.cpp:62:11: note: ‘sprintf’ output between 23 and 278 bytes into a destination of size 64
                                          sprintf(file, "/sys/class/gpio/%s/ngpio", de->d_name);
                                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      
                                      1 Reply Last reply
                                      1
                                      • alowhumA Offline
                                        alowhumA Offline
                                        alowhum
                                        Plugin Developer
                                        wrote on last edited by alowhum
                                        #1019

                                        Could this be an issue?

                                        ./configure without any additional parameters gives:

                                        [SECTION] Detecting target machine.
                                          [OK] machine detected: SoC=unknown, Type=unknown, CPU=armv7l.
                                        

                                        The rest looks fine:

                                        [SECTION] Checking GPIO Sysfs.
                                          [OK] /sys/class/gpio/export found.
                                        [SECTION] Detecting SPI driver.
                                          [OK] SPI driver detected:SPIDEV.
                                        [SECTION] Gateway configuration.
                                          [OK] Type: ethernet.
                                          [OK] Transport: rf24.
                                          [OK] Signing: Disabled.
                                          [OK] Encryption: Disabled.
                                          [OK] CPPFLAGS: -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_SPIDEV 
                                        [SECTION] Detecting init system.
                                          [OK] Init system detected: systemd.
                                        [SECTION] Saving configuration.
                                          [OK] Saved.
                                        [SECTION] Cleaning previous builds.
                                          [OK] Finished.
                                        

                                        Same thing happens with the dev version

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

                                          Yes, if the configure script cannot detect which hardware to use, compilation failure could very well be the result.

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


                                          3

                                          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