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 Orange Pi Gateway

💬 Building a Orange Pi Gateway

Scheduled Pinned Locked Moved Announcements
110 Posts 24 Posters 31.6k Views 21 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.
  • S Offline
    S Offline
    SdeWeb
    wrote on last edited by SdeWeb
    #88

    Hi,
    You should set your gateway as a ethernet / network gateway. By default, it run on port 5003 (ex : [gwipadresse]:5003.
    If you controler is hosted on the same machine that the gateway, then you can call the ip adresse : 127.0.0.1:5003. (the localhost adress) whatever the real IP adresse of your PI.
    if you got a good router on u'r network, that it running DHCP server and give IP adresses of your devices on the network, then you can define static IP adresse for the MAC adresse of your PI.

    Regards.

    1 Reply Last reply
    0
    • Ricardo RibeiroR Offline
      Ricardo RibeiroR Offline
      Ricardo Ribeiro
      wrote on last edited by
      #89

      I had to use spidev0.0 and not spidev1.0:
      +++
      opilite@orangepilite:~/MySensors$ sudo ./bin/mysgw -d
      mysgw: Starting gateway...
      mysgw: Protocol version - 2.2.0-beta
      mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-beta
      mysgw: TSF:LRT:OK
      mysgw: TSM:INIT
      mysgw: TSF:WUR:MS=0
      mysgw: TSM:INIT:TSP OK
      mysgw: TSM:INIT:GW MODE
      mysgw: TSM:READY:ID=0,PAR=0,DIS=0
      mysgw: MCO:REG:NOT NEEDED
      mysgw: MCO:BGN:STP
      mysgw: MCO:BGN:INIT OK,TSP=1
      +++
      opilite@orangepilite:~/MySensors$ ./configure --spi-spidev-device=/dev/spidev0.0 --my-transport=nrf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=67 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway

      1 Reply Last reply
      0
      • Ricardo RibeiroR Offline
        Ricardo RibeiroR Offline
        Ricardo Ribeiro
        wrote on last edited by
        #90

        With mqtt gateway I got further ahead:
        +++
        opilite@orangepilite:~/MySensors$ ./configure --spi-spidev-device=/dev/spidev0.0 --my-transport=nrf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=67 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=my_mqtt_gateway
        +++
        opilite@orangepilite:~/MySensors$ sudo ./bin/mysgw -d
        mysgw: Starting gateway...
        mysgw: Protocol version - 2.2.0-beta
        mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-beta
        mysgw: TSF:LRT:OK
        mysgw: TSM:INIT
        mysgw: TSF:WUR:MS=0
        mysgw: TSM:INIT:TSP OK
        mysgw: TSM:INIT:GW MODE
        mysgw: TSM:READY:ID=0,PAR=0,DIS=0
        mysgw: MCO:REG:NOT NEEDED
        mysgw: MCO:BGN:STP
        mysgw: MCO:BGN:INIT OK,TSP=1
        mysgw: Attempting MQTT connection...
        mysgw: connected to 127.0.0.1
        mysgw: MQTT connected
        mysgw: Sending message on topic: mysensors-out/0/255/0/0/18
        +++
        mysensors-out/0/255/0/0/18 : msg.payload : string[10]
        "2.2.0-beta"

        1 Reply Last reply
        0
        • Ricardo RibeiroR Offline
          Ricardo RibeiroR Offline
          Ricardo Ribeiro
          wrote on last edited by
          #91

          Ok, now I load a sketch into an arduino nanowith nrf24l01+ and this is all I got:
          +++
          opilite@orangepilite:~/MySensors$ sudo ./bin/mysgw -d
          mysgw: Starting gateway...
          mysgw: Protocol version - 2.2.0-beta
          mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-beta
          mysgw: TSF:LRT:OK
          mysgw: TSM:INIT
          mysgw: TSF:WUR:MS=0
          mysgw: TSM:INIT:TSP OK
          mysgw: TSM:INIT:GW MODE
          mysgw: TSM:READY:ID=0,PAR=0,DIS=0
          mysgw: MCO:REG:NOT NEEDED
          mysgw: MCO:BGN:STP
          mysgw: MCO:BGN:INIT OK,TSP=1
          mysgw: Attempting MQTT connection...
          mysgw: connected to 127.0.0.1
          mysgw: MQTT connected
          mysgw: Sending message on topic: mysensors-out/0/255/0/0/18
          mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          mysgw: TSF:MSG:BC
          mysgw: TSF:MSG:FPAR REQ,ID=255
          mysgw: TSF:CKU:OK,FCTRL
          mysgw: TSF:MSG:GWL OK
          mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
          mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
          mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
          mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
          mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
          mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
          mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
          mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
          mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
          mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          mysgw: TSF:MSG:BC
          mysgw: TSF:MSG:FPAR REQ,ID=255
          mysgw: TSF:PNG:SEND,TO=0
          mysgw: TSF:CKU:OK
          mysgw: TSF:MSG:GWL OK
          (...)
          +++

          Stuck again.

          mfalkviddM 1 Reply Last reply
          0
          • Ricardo RibeiroR Ricardo Ribeiro

            Ok, now I load a sketch into an arduino nanowith nrf24l01+ and this is all I got:
            +++
            opilite@orangepilite:~/MySensors$ sudo ./bin/mysgw -d
            mysgw: Starting gateway...
            mysgw: Protocol version - 2.2.0-beta
            mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-beta
            mysgw: TSF:LRT:OK
            mysgw: TSM:INIT
            mysgw: TSF:WUR:MS=0
            mysgw: TSM:INIT:TSP OK
            mysgw: TSM:INIT:GW MODE
            mysgw: TSM:READY:ID=0,PAR=0,DIS=0
            mysgw: MCO:REG:NOT NEEDED
            mysgw: MCO:BGN:STP
            mysgw: MCO:BGN:INIT OK,TSP=1
            mysgw: Attempting MQTT connection...
            mysgw: connected to 127.0.0.1
            mysgw: MQTT connected
            mysgw: Sending message on topic: mysensors-out/0/255/0/0/18
            mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
            mysgw: TSF:MSG:BC
            mysgw: TSF:MSG:FPAR REQ,ID=255
            mysgw: TSF:CKU:OK,FCTRL
            mysgw: TSF:MSG:GWL OK
            mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
            mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
            mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
            mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
            mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
            mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
            mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
            mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
            mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
            mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
            mysgw: TSF:MSG:BC
            mysgw: TSF:MSG:FPAR REQ,ID=255
            mysgw: TSF:PNG:SEND,TO=0
            mysgw: TSF:CKU:OK
            mysgw: TSF:MSG:GWL OK
            (...)
            +++

            Stuck again.

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

            @Ricardo-Ribeiro that looks normal. Is this different from what you expected? If so, how does it differ?

            1 Reply Last reply
            0
            • 8 Offline
              8 Offline
              8667
              wrote on last edited by
              #93

              Had anyone succeeded using signing+encryption on OrangePi MQTT gateway? I managed to make Arduino gateway and it worked but I can not replicate the same thing with Pi. What file should be edited to enter the keys? and the whitelist?

              1 Reply Last reply
              0
              • P Offline
                P Offline
                pii
                wrote on last edited by mfalkvidd
                #94

                Am getting this error:
                ERROR Could not open /sys/class/gpio/gpio24/direction
                My config is:

                ./configure --spi-spidev-device=/dev/spidev1.0 --my-node-id=1 --my-transport=rfm95 --my-rfm95-cs-pin=13 --my-rfm95-irq-pin=10 --my-rfm69-frequency=915E6
                

                Whole output is:

                root@ttn-gateway:~/MySensors# sudo ./bin/mysgw
                May 23 09:37:31 INFO  Starting gateway...
                May 23 09:37:31 INFO  Protocol version - 2.3.0-alpha
                
                 __  __       ____
                |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
                | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
                | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
                |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
                        |___/                      2.3.0-alpha
                
                May 23 09:37:31 DEBUG MCO:BGN:INIT NODE,CP=RLNNL---,VER=2.3.0-alpha
                May 23 09:37:31 DEBUG TSM:INIT
                May 23 09:37:31 DEBUG TSF:WUR:MS=0
                May 23 09:37:42 ERROR Could not open /sys/class/gpio/gpio24/direction
                
                pansenP 1 Reply Last reply
                0
                • P pii

                  Am getting this error:
                  ERROR Could not open /sys/class/gpio/gpio24/direction
                  My config is:

                  ./configure --spi-spidev-device=/dev/spidev1.0 --my-node-id=1 --my-transport=rfm95 --my-rfm95-cs-pin=13 --my-rfm95-irq-pin=10 --my-rfm69-frequency=915E6
                  

                  Whole output is:

                  root@ttn-gateway:~/MySensors# sudo ./bin/mysgw
                  May 23 09:37:31 INFO  Starting gateway...
                  May 23 09:37:31 INFO  Protocol version - 2.3.0-alpha
                  
                   __  __       ____
                  |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
                  | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
                  | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
                  |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
                          |___/                      2.3.0-alpha
                  
                  May 23 09:37:31 DEBUG MCO:BGN:INIT NODE,CP=RLNNL---,VER=2.3.0-alpha
                  May 23 09:37:31 DEBUG TSM:INIT
                  May 23 09:37:31 DEBUG TSF:WUR:MS=0
                  May 23 09:37:42 ERROR Could not open /sys/class/gpio/gpio24/direction
                  
                  pansenP Offline
                  pansenP Offline
                  pansen
                  wrote on last edited by
                  #95

                  @pii

                  • Does /sys/class/gpio/gpio24/direction exists?
                  • Does /sys/class/gpio/gpio24 exists?
                  • Can you write to them using echo?

                  Orange Pi Plus 2e connected to nrf24 PA via SPI running git-development MySensors gateway, OpenHAB2, mosquitto and MySQL persistence.

                  P 2 Replies Last reply
                  0
                  • pansenP pansen

                    @pii

                    • Does /sys/class/gpio/gpio24/direction exists?
                    • Does /sys/class/gpio/gpio24 exists?
                    • Can you write to them using echo?
                    P Offline
                    P Offline
                    pii
                    wrote on last edited by
                    #96

                    @pansen No.... nothing... /sys/class/gpio/gpio24doesn't exist.
                    even "echo "24" > /sys/class/gpio/export doesn't work.
                    But, yes otherwise if I try the same with 13 i.e "echo "13" > /sys/class/gpio/export Then a directory is created and then /sys/class/gpio/gpio24/direction do exist.

                    1 Reply Last reply
                    0
                    • pansenP pansen

                      @pii

                      • Does /sys/class/gpio/gpio24/direction exists?
                      • Does /sys/class/gpio/gpio24 exists?
                      • Can you write to them using echo?
                      P Offline
                      P Offline
                      pii
                      wrote on last edited by
                      #97

                      @pansen Thank you sooooooo much for your reply.!!! By the way, What I actually have to do is "Make an MQTT based LoRa(RA-02) receiver gateway on OrangePi Zero". And I'm stuck since whole week :'( of course spent time trying code without solid base. :/
                      Yes, yet I'm trying to first set up a LoRa receiver(not MQTT, not gateway)

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        marceloaqno
                        Code Contributor
                        wrote on last edited by
                        #98

                        @pii --my-rfm95-cs-pin and --my-rfm95-irq-pin options are not currently supported by the configure script.
                        Until we fix this, could you please try adding the following to your examples_linux/mysgw.cpp (before the #include <MySensors.h>)

                        #define MY_RFM95_CS_PIN 13
                        #define MY_RFM95_IRQ_PIN 10
                        #define MY_RFM95_FREQUENCY RFM95_915MHZ
                        

                        and run the make command again.

                        P 1 Reply Last reply
                        0
                        • M marceloaqno

                          @pii --my-rfm95-cs-pin and --my-rfm95-irq-pin options are not currently supported by the configure script.
                          Until we fix this, could you please try adding the following to your examples_linux/mysgw.cpp (before the #include <MySensors.h>)

                          #define MY_RFM95_CS_PIN 13
                          #define MY_RFM95_IRQ_PIN 10
                          #define MY_RFM95_FREQUENCY RFM95_915MHZ
                          

                          and run the make command again.

                          P Offline
                          P Offline
                          pii
                          wrote on last edited by
                          #99

                          @marceloaqno said in 💬 Building a Orange Pi Gateway:

                          #define MY_RFM95_CS_PIN 13
                          #define MY_RFM95_IRQ_PIN 10
                          #define MY_RFM95_FREQUENCY RFM95_915MHZ

                          Thank you sooo much. I just did this. But, Now got a new error.

                           ERROR Could not open /sys/class/gpio/gpio10/direction
                          

                          and when I tried to export pin 10 it says:

                          :/sys/class/gpio# echo '10' > export
                          -bash: echo: write error: Device or resource busy
                          

                          Though yes still I'm able to export/unexport pin 13(just for testing)

                          M 1 Reply Last reply
                          0
                          • vladikomsV Offline
                            vladikomsV Offline
                            vladikoms
                            wrote on last edited by
                            #100

                            @pii Try my library for Orange Pi Zero and Semtech SX1278 radio (RA-02 module)

                            1 Reply Last reply
                            0
                            • P pii

                              @marceloaqno said in 💬 Building a Orange Pi Gateway:

                              #define MY_RFM95_CS_PIN 13
                              #define MY_RFM95_IRQ_PIN 10
                              #define MY_RFM95_FREQUENCY RFM95_915MHZ

                              Thank you sooo much. I just did this. But, Now got a new error.

                               ERROR Could not open /sys/class/gpio/gpio10/direction
                              

                              and when I tried to export pin 10 it says:

                              :/sys/class/gpio# echo '10' > export
                              -bash: echo: write error: Device or resource busy
                              

                              Though yes still I'm able to export/unexport pin 13(just for testing)

                              M Offline
                              M Offline
                              marceloaqno
                              Code Contributor
                              wrote on last edited by
                              #101

                              @pii Try to connect the IRQ pin from the radio to another GPIO on your Orange Pi, for example the GPIO2.

                              #define MY_RFM95_IRQ_PIN 2
                              
                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                ghck
                                wrote on last edited by
                                #102

                                There is an issue now with spi interfaces. With the current armbian image we are stuck at the prepare the system part, no /dev/spidev* available, the old method does not work. (There is no /boot/script.bin file, for example.) Does anyone know the solution, could this guide be updated, please?

                                1 Reply Last reply
                                0
                                • G Offline
                                  G Offline
                                  ghck
                                  wrote on last edited by
                                  #103

                                  More info: https://docs.armbian.com/User-Guide_Allwinner_overlays/

                                  1 Reply Last reply
                                  0
                                  • R Offline
                                    R Offline
                                    Roman
                                    wrote on last edited by
                                    #104

                                    Hi!

                                    Installation instructions will be adjusted for Armbian Stretch?

                                    1 Reply Last reply
                                    0
                                    • G Offline
                                      G Offline
                                      giaco456
                                      wrote on last edited by
                                      #105

                                      I have Mysensors running with nrf24 , I wanted to upgrade Armbian to the latest Stretch. I configured DT overlays by adding

                                      verbosity=1
                                      console=serial
                                      overlay_prefix=sun8i-h3
                                      rootdev=UUID=bd0ded76-1188-4b52-a20a-64f326c1f193
                                      rootfstype=ext4
                                      overlays=w1-gpio uart1 i2c0 spi-spidev
                                      param_w1_pin=PA20
                                      param_w1_pin_int_pullup=1
                                      param_uart1_rtscts=1
                                      param_spidev_spi_bus=0

                                      to /boot/armbianEnv.txt. I had spidev working, but not the mysgw. It doidn't give me errors, but i was stuck at !TSM:INIT:TSP FAIL.
                                      Maybe the problem is that there is no gpio-sunxi in Stretch... I have no idea.

                                      By the way, i noticed that the new version of Mysensors calls nrf24 transport differently, it is now called --my-transport=rf24.
                                      Please update the guide for Armbian Stretch.

                                      1 Reply Last reply
                                      0
                                      • R Offline
                                        R Offline
                                        Roman
                                        wrote on last edited by
                                        #106

                                        Made fix for Armbian Stretch https://github.com/mysensors/MySensors/pull/1200.
                                        my settings: /boot/armbianEnv.txt
                                        overlays=w1-gpio uart1 spi-spidev spi-add-cs1
                                        param_spidev_spi_bus=1
                                        param_spidev_spi_cs=0

                                        git clone https://github.com/mysensors/MySensors.git --branch development
                                        cd MySensors
                                        and further on the instructions

                                        1 Reply Last reply
                                        0
                                        • pansenP Offline
                                          pansenP Offline
                                          pansen
                                          wrote on last edited by pansen
                                          #107

                                          Hi,

                                          for anyone creating a gateway on an Orange Pi PC using armbian mainline (4.x Kernel): The fex modifications are not necessary any more. As noted before by @Roman, the device tree needs to be modified.

                                          If you use the exact same pins as in this guide for the Orange Pi PC, SPI0 needs to be activated instead of SPI1. (Pi Zero and PC are kind of pin compatible, but Zero only has SPI1 routed to the header, whereas the same pins on the PC have SPI0. On top, the Orange Pi PC also has SPI1 but on other pins):

                                          verbosity=1
                                          logo=disabled
                                          console=both
                                          disp_mode=1920x1080p60
                                          overlay_prefix=sun8i-h3
                                          overlays=w1-gpio uart1 spi-spidev spi-add-cs1
                                          param_spidev_spi_bus=0
                                          param_spidev_spi_cs=0
                                          rootdev=<removed>
                                          rootfstype=ext4
                                          usbstoragequirks=<removed>
                                          

                                          Attention: Header pin 26 is different between Pi PC and Pi Zero. On the zero it is PA10 but on the PC it is PA21. I connected the interrupt pin of the nrf24 like in the guide (header pin 26) and changed the configure command accordingly.

                                          So the full command to use SPI0 and the interrupt connected to header pin 26 of the Orange Pi PC is:

                                          ./configure --spi-spidev-device=/dev/spidev0.0 --my-transport=rf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=13 --my-rf24-irq-pin=21 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mysensors
                                          

                                          The rest of the guide is still valid, except that the transport is now called "rf24" instead of "nrf24". @mfalkvidd can you correct this maybe? Also, the -d switch seems to be not existing any more.

                                          Orange Pi Plus 2e connected to nrf24 PA via SPI running git-development MySensors gateway, OpenHAB2, mosquitto and MySQL persistence.

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


                                          19

                                          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