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. Announcements
  3. 💬 Building a Raspberry Pi Gateway

💬 Building a Raspberry Pi Gateway

Scheduled Pinned Locked Moved Announcements
1.1k Posts 173 Posters 422.9k 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.
  • gohanG gohan

    I got the same, domoticz and pi hole, but the load of the gateway is minimal

    K Offline
    K Offline
    kted
    wrote on last edited by
    #991

    @gohan I meant multiple gateways on the same raspberry.
    Right now, I have an NRF24L01 gateway, Domoticz, pi-hole, and a VPN server running, with 2 more gateways connected, one local and one remote RFM69 on ESP8266.
    It would be nice if I could combine the two local gateways, the RFM and the NRF on the same Raspberry's GPIO...

    1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #992

      Yes, I have both radios on the same raspberry.

      1 Reply Last reply
      0
      • MasMatM Offline
        MasMatM Offline
        MasMat
        wrote on last edited by MasMat
        #993

        More problems when I try to "make" after configuring. Tried with and without sudo...

        dietpi@Domoticz:~/MySensors$ sudo make
        gcc -MT build/hal/architecture/Linux/drivers/core/log.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_SIGNING_SIMPLE_PASSWD=\"ZZZZZZZ\" -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_CONFIG_FILE=\"/etc/mysensors.conf\" -DMY_DEFAULT_TX_LED_PIN=18 -DMY_DEFAULT_RX_LED_PIN=16 -DMY_DEFAULT_ERR_LED_PIN=12 -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_MQTT_PASSWORD=\"YYYYY\" -DMY_MQTT_USER=\"XXXX\" -DMY_CONTROLLER_IP_ADDRESS=127,0,0,1 -DMY_DEBUG_VERBOSE_SIGNING -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15  -Ofast -g -Wall -Wextra  -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/log.c -o build/hal/architecture/Linux/drivers/core/log.o
        In file included from hal/architecture/Linux/drivers/core/log.c:20:0:
        hal/architecture/Linux/drivers/core/log.h:24:19: fatal error: stdio.h: File not found
         #include <stdio.h>
                           ^
        compilation terminated.
        Makefile:102: recipe for target 'build/hal/architecture/Linux/drivers/core/log.o' failed
        make: *** [build/hal/architecture/Linux/drivers/core/log.o] Error 1
        

        EDIT: ...and here's the fix: "sudo apt-get install g++" (I'm using DietPi now to make it lighter for Pi Zero W).

        1 Reply Last reply
        0
        • cozaC Offline
          cozaC Offline
          coza
          wrote on last edited by coza
          #994

          Running Version 2.3.2-beta just cloned today. On a raspberry pi B rev2.
          A little bug/problem I have discovered with the MQTT gateway.

          When you run the gateway with command and switch:-

          mysgw -c /etc/mysensors.conf
          

          It segfaults.

          When its run with the command and switch :-

          mysgw --config-file /etc/mysensors.conf
          

          It works fine

          I was playing with the ethernet gateway compile and the -c worked fine.

          1 Reply Last reply
          1
          • cozaC Offline
            cozaC Offline
            coza
            wrote on last edited by coza
            #995

            Another thing I have found is I cannot get any logging working with the mqqt gateway compile.

            It worked fine (named pipe) with the ethernet gateway compile.

            Edit
            It seems logging with the mqtt is not instant. It seem to dump the log out of memory periodically, is this expected? Makes it a bit hard to debug real-time.

            mfalkviddM 1 Reply Last reply
            0
            • gohanG Offline
              gohanG Offline
              gohan
              Mod
              wrote on last edited by
              #996

              Just use mqtt client

              1 Reply Last reply
              0
              • cozaC coza

                Another thing I have found is I cannot get any logging working with the mqqt gateway compile.

                It worked fine (named pipe) with the ethernet gateway compile.

                Edit
                It seems logging with the mqtt is not instant. It seem to dump the log out of memory periodically, is this expected? Makes it a bit hard to debug real-time.

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

                @coza I have experienced that the raspberry pigateway does not flush the logs immediately when logging to file. Syslog logs immediately though. See if switching to syslog helps.

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

                  @gohan Sorry I miss your answer a few days ago
                  I don't want to a gateway with both rfm69 and nrf24..

                  I'm planning to change my nrf24 sensors with rfm69, to have a better transmission distance. My two nodes are outside, and i have communication trouble if i put them where i wanted, specially for my rain gauge.
                  So I wanted to use those adaptors https://www.openhardware.io/view/16/NRF2RFM69.
                  I received them, and I'm still waiting RFM69 board to test it.

                  But as the pinout is not the same between nrf24 and rfm69 on raspberry gateway, I could not use the adaptor on the gateway. So before making a new board for my raspberry, I wanted to know if it's possible to change the default pin configuration, to have exactly the same as nrf24, and use an adaptor on the gateway too.
                  For that, I "just" need to redefine DIO0 on pin 15 (default is 22). So I wonder if it's possible to do it.

                  And "bonus question", I'd like to know why pin configuration is not the same between arduino and raspberry. Why pin 15 is not used for DIO0 on raspberry (equivalent to pin 2 on arduino). I'm telling myself it should be a good reason, but I don't get it.

                  mfalkviddM 1 Reply Last reply
                  0
                  • B barrydou

                    @gohan Sorry I miss your answer a few days ago
                    I don't want to a gateway with both rfm69 and nrf24..

                    I'm planning to change my nrf24 sensors with rfm69, to have a better transmission distance. My two nodes are outside, and i have communication trouble if i put them where i wanted, specially for my rain gauge.
                    So I wanted to use those adaptors https://www.openhardware.io/view/16/NRF2RFM69.
                    I received them, and I'm still waiting RFM69 board to test it.

                    But as the pinout is not the same between nrf24 and rfm69 on raspberry gateway, I could not use the adaptor on the gateway. So before making a new board for my raspberry, I wanted to know if it's possible to change the default pin configuration, to have exactly the same as nrf24, and use an adaptor on the gateway too.
                    For that, I "just" need to redefine DIO0 on pin 15 (default is 22). So I wonder if it's possible to do it.

                    And "bonus question", I'd like to know why pin configuration is not the same between arduino and raspberry. Why pin 15 is not used for DIO0 on raspberry (equivalent to pin 2 on arduino). I'm telling myself it should be a good reason, but I don't get it.

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

                    @barrydou is this what you need (from the documentation and ./configure--help)

                    --my-rfm69-irq-pin=<PIN>    Pin number connected to RFM69 IRQ pin.
                    

                    For the bonus question: I wasn't aware that there was a mapping between Raspberry Pi gpio and Arduino pins. Could you share he rest of the list?

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

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


                                          6

                                          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