šŸ’¬ Building a Orange Pi Gateway

  • Admin

    This thread contains comments for the article "Building a Orange Pi Gateway" posted on MySensors.org.

  • Hi!,

    Found a typo: ./condigure --spi-spidev-device=/dev/spidev1.0 ,should be configure

    Great work!! šŸ‘

  • @marceloaqno: I'm in the process of enabling SPI1 (and nrf24 subsequently) on the OPI Plus2e and it seems there are some hardware modifications necessary...I'd like to document on the way and when I am finished submit it somehow so it can be included here. Any suggestions for that?

  • Code Contributor

    @pansen You could document your steps here and I'll update the building guide. If changes to the code are required, please send a PR to the development branch.

  • @marceloaqno: ok so here are my conclusions:
    After going through the schematics of the OPi Plus2e I realized that the H3 has dedicated pins for NAND/eMMC, which is probably not the case for the H2+ in the OPi zero. They used the pins of SPI1 for a status LED and a "MUTE" net, which is not connected anywhere so at first I was like "wtf?"...
    So, the SPI0 is free for usage out of the box and the .fex does not need to be modified. Summed up:

    If the OPi to be used has "SPI0" in the GPIO header, no .fex modifications are necessary. CE and CN/CS/CSN pin can be chosen freely (?), I picked it like this:
    ce - gray - pa13 - PHYSICAL pin8 - LOGICAL pin13 (1-1)*32 + 13
    cn - blue - pa14 - PHYSICAL pin10 - LOGICAL pin14 (1-1)*32 + 14
    If another pin is chosen, the pin number can be calculated with that formula: (position of letter in alphabet - 1) * 32 + pin number (from: https://linux-sunxi.org/GPIO)
    The pinout of the connector can be found here: https://linux-sunxi.org/Xunlong_Orange_Pi_Plus_2E#Expansion_Port (SPI0 pins are PC0-PC2 or 19,21,23)
    After connecting the physical pins 8,10,19,21 and 23 to the nrf24 (and pin 1 for 3.3v), following command was sufficient to set up mysgw and get the nrf24 to respond:
    ./configure --spi-spidev-device=/dev/spidev0.0 --my-transport=nrf24 --my-rf24-ce-pin=13 --my-rf24-cs-pin=14

  • hello
    I build this and work great for my OrangePI PC+ but I do not know how to integrate it in domoticz???
    Can you help me please
    thank's for you good work

  • @lecintre: I just installed domoticz and I could enable my gateway by clicking on "please setup your Hardware" in the start screen, then selecting "mysensors gateway with lan interface" with the lan ip of my orange pi (but i guess would also work) and port 5003.
    this should appear then:
    mysensors_lan_gw Yes MySensors Gateway with LAN interface
    Version: 2.2.0-beta Setup 5003 Disabled

    clicking on "Setup" then leads to a menu where i see my first test node:

    Sketch Name
    Last Seen
    0 Unknown Unknown 1.0 1 2017-01-29 20:27:28
    1 Unknown nrf24LEDtest 1.0 2 2017-01-29 20:28:27

    let me know if that works out for you

  • @pansen: Thank you very much it works very well.
    Cool for your help
    thank you so much
    For you which is the best domoticz or jeedom ?? With mysensors protocol

  • @lecintre: avec plaisir šŸ™‚ I only compared OpenHAB and domoticz so far. Domoticz worked out of the box with the nrf24 but does not have support for my 5.1 receiver (which OpenHAB does). Jeedom looks to commercial (for example no free app+controller) for my taste and there seems to be no community. A good starting point for me was the popularity of each controller in this forum: https://forum.mysensors.org/category/3/controllers

    I guess it really depends on your application, if you only have DYI sensors and actuators, domoticz is probably enough.

  • Mod

    @marceloaqno Great job man!
    Looking at the radio connection, there is a 5V -> 3V3 conversion layed out.
    The Pi Zero Schematics sheet 7-D1, 7-B5 and 11-D4 indicate VCC3V3-EXT is present on pin 1 of the IO connector and internally connected to VCC-IO, which can supply 1A @ 3V3.
    Don't you think there is enough margin to supply the nRF24 directly from VCC3V3-EXT?

  • Code Contributor

    @Yveaux Yes, more than enough šŸ˜„ . Thanks and thanks for pointing that out.

  • Hardware Contributor

    i've not checked yet, i miss time for trying the linux port šŸ˜Š but i'm curious to know if this power supply would be noisy..which may need a ferrite and capas, else radio could have a bad snr and less range/sensitiviy. Maybe i'm wrong.. i'll try to scope when i'll have some time, or if i remember about it lol!

  • @pansen Hi, Please could you confirm your pin connection beetween NRF24L01 and the Opi Plus2E, il followed your setup inctruction (no .fex modification and your specific ./configure), but mine don't work, i got this error "mysgw: Could not open /sys/class/gpio/gpio13/direction".

    I connected my NRF24L01 on OPI P2E like this :

    • NRF Port Name / (NĀ°) ------- OPI Port (NĀ°) / Name
      • GND (1) <------------> (6) GND
      • VCC (2) <------------> (17) 3.3V PWR
      • CE (3) <---------------> (8)
      • CSN (4) <------------> (10)
      • SCK (5) <-------------> (23)
      • MOSI (6) <-----------> (19) MOSI
      • MISO (7) <-----------> (21) MISO
      • IRQ (8) <---------------> NC


  • Hi @SdeWeb header pins 8 and 10 are used by some other hardware (SPI1, UART3) which might need to be deactivated in the .fex in your system, for me it worked straight away so that would be weird..just check the .fex if SPI1 and UART3 are indeed disabled.

    It looks like the definitions for the GPIO are faulty, you could try a LED test to see if they work at all. If the problem persists rather open a topic in the Development sub forum šŸ˜Ž Or, pick another GPIO, for example header pins 14 and 16.

  • Hello,
    would it be possible to add the wiring for the RS485-Modules, please?
    will it be similar to the Raspberry Pi?
    Thank you. Waschtl.

  • Hi,
    Well done finally i used the dedicated .fex file for Orange Pi Plus 2E here :

    at this point :

    Read the .fex file in a text editor, u'll see important things about "gpio_config" for H3 cpu :

    ; NOTE: This section is necessary only for "gpio_sunxi" driver
    ; which is obsolete for H3 boards
    gpio_used = 0
    gpio_num = 0

    I connected my NRF24L01 on OPI P2E like this :

    NRF24L01 Port Name / (Pin NĀ°) ----- OPI Port (Pin NĀ°) / Name
                          GND (1)  <-----------> (20) / GND
                          VCC (2)  <-----------> (17) / 3.3V PWR
                          CE (3)   <-----------> (22) / (PA2 / GPIO2)
                          CSN (4)  <-----------> (24) / (PC3 / GPIO67)
                          SCK (5)  <-----------> (23)
                          MOSI (6) <-----------> (19) MOSI
                          MISO (7) <-----------> (21) MISO
                          IRQ (8)  <-----------> NC

    So "MySensors" setup is :

    ./configure --spi-spidev-device=/dev/spidev0.0 --my-transport=nrf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=67


    ./bin/mysgw -d

    Return :

    root@orangepiplus2e:~/MySensors# ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.2.0-beta
    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: Listening for connections on
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1


  • @Wascht'l Hi,
    Take a look here, to get some idea :



  • i have problem šŸ˜•
    what about this :

    root@orangepione:~/MySensors# ./configure --spi-spidev-device=/dev/spidev0.0 --my-transport=nrf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=13                       
     -bash: ./configure: Permission denied

  • @Reza
    Seems your ./configure script is not executable... try:

    chmod 755 ./configure

  • @Tag

    root@orangepione:~/MySensors# chmod 755 ./configure
    root@orangepione:~/MySensors# chmod 755 ./configure --spi-spidev-device=/dev/spidev1.0 --my-transport=nrf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=13
    chmod: unrecognized option '--spi-spidev-device=/dev/spidev1.0'
    Try 'chmod --help' for more information.


Suggested Topics