πŸ’¬ Building a Raspberry Pi Gateway



  • Hi
    Is anyone else having this same problem on Rpi3?: Gateway works ok after "sudo make install" with openHAB. With "sudo ./bin/mysgw -d" I can get debug log visible and log works ok.
    But if I run "sudo systemctl enable mysgw.service" after "sudo make install", debug log start showing endlessly "mysgw: accept: Bad file descriptor". So debug log function gets destroyed and it can't be used anymore. I have made several clean installations and every time this same happens.
    Br
    Tommi


  • Code Contributor

    @TommiP What I think is happening is that you are running two instances of the gateway.
    If you need to get the debug logs, first stop the mysgw service:

    sudo systemctl stop mysgw.service
    


  • @marceloaqno
    Ok, now I understand what happened, thanks.



  • Re: πŸ’¬ Building a Raspberry Pi Gateway

    Silly questions, I'm a little bit confuse.
    I have a serial Gateway running with arduino nano + nrf24 and a raspberry pi with domoticz on board. The link between domoticz & Gateway is done via USB <=> serial port (/dev/ttyUSB0). This setup runs like a charm.

    Now, I would like to access to my Gateway via the network because I would like to use "Over The Air " functionnality with MYSController.

    Can I install MySensors Gateway on the raspberry and keep the arduino + nrf24 connected via usb ?? For the moment, I can not use GPIO port.

    If for some reason you can't use the GPIO pins of the Raspberry Pi, you could connect the radio to a arduino with the GatewaySerial sketch and feed the pi through a serial port:

    ./configure --my-gateway=serial --my-serial-port=/dev/ttyUSB0 --my-serial-baudrate=115200
    

    [SECTION] Detecting target machine.
    [OK] machine detected: SoC=BCM2836, Type=RPi3, CPU=armv7l.
    [SECTION] Detecting SPI driver.
    [OK] SPI driver detected:BCM.
    [SECTION] Detecting init system.
    [OK] init system detected: systemd.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.

    make
    
    ./bin/mysgw -d
    

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:PDT
    mysgw: TSM:FAIL:RE-INIT
    mysgw: TSM:INIT
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=2
    mysgw: TSM:FAIL:PDT

    Where is my mistake ??
    Again, Can I install MySensors Gateway on the raspberry and keep the arduino + nrf24 connected via usb or I must connected the nrf24 directly with GPIO on the Rasp ??

    Thanks in advance for your reply.
    Romeo


  • Mod

    @romeo01 I think that connecting nrf24 directly to arduino and compile mysgw as ethernet gateway is the cleanest solution (I have it as MQTT and it is working fine, but ethernet is the same). Keep in mind that you'd better use one of those adapters 5v-3.3v for nrf24 chips + capacitor because the 3v output of raspberry isn't very suited for the task.



  • Thanks gohan for fast answer.

    Arduino nano + nrf24 are already connected together. Hardware is already built.

    How access to the gatway installed on the raspberry via the network and use my arduino + nrf24 connected via usb/serial to the raspberry ??

    Sorry but I do not understand what you mean
    ...compile mysgw as ethernet gateway is the cleanest solution...

    If I configure on this way
    ./configure --my-gateway=ethernet --my-port=5003

    I could access to my Gateway via network an the Gateway will use the arduino + nrf24l via usb/serial ??

    That's why I say I'm confuse.

    --my-gateway=serial 
    

    What is this option ? The link between gateway and nrf24 or the way to access to the Gateway ??



  • In summary,

    Is the Gateway (software) installed on the raspberry, is able to manage the nrf24 connected on arduino via USB/Serial port ??


  • Mod

    no, I don't think so. If you want to manage nodes over network you need to make an ethernet gateway (could be a UNO with w5100 shield, an esp8266 or mysgw compiled on raspberry)



  • nrf24 connected to a arduino nano and plugged to the raspberry over the usb/serial cable is not considered as a serial device ?

    What is this option ?

    --my-gateway=serial
    

    If for some reason you can't use the GPIO pins of the Raspberry Pi, you could connect the radio to a arduino with the GatewaySerial sketch and feed the pi through a serial port:

    That's exactly what I need, but how to do ??

    ./configure --my-gateway=serial --my-serial-port=/dev/ttyUSB0 --my-serial-baudrate=115200
    

    Serial port /dev/ttyUSB0 is ok, because I use this with domoticz and it'running good.

    My initial question is how to use my old gatway (arduino + nrf24) with the gateway compiled on the raspberry over the usb/serial cable ?
    I can not use GPIO port.


  • Mod

    The serial gateway on the raspberry does what your nano is doing and you can't have gateways talking to each other. Maybe you could look at mycontroller and see if can manage nodes the way you want.



  • When talking about this Raspberry Pi Gateway, I suppose, that its just connecting the NFR24L01+ to the Raspberry Pi GPIO and run

    ./bin/mysgw -d
    

    right? On my Pi it does not work this way, maybe the NFR24L01+ is not ok. Instead I am running an external esp-wifi-gateway, but a direct gateway seems the better solution to me.
    So did I get it right, that I can use a NFR24L01+ connected to the Raspberry PI GPIO without any external gateway? If so, what are the parameters for building the mysgw daemon? I tried this one:

    ./configure --spi-driver=SPIDEV --spi-spidev-device=/dev/spidev0.0
    

    update: as in https://www.mysensors.org/view/180#wiring
    22 – CE
    24 – CSN/CS
    23 – SCK
    19 – MOSI
    21 – MISO

    SPI is activated:

    $ls /dev/spidev*
    /dev/spidev0.0  /dev/spidev0.1
    

    And this is the result, when building it with the settings mentioned above. (Raspberry Pi 3, jessie 4.9.13-v7+)

    $ sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:PDT
    mysgw: TSM:FAIL:RE-INIT
    mysgw: TSM:INIT
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=2
    mysgw: TSM:FAIL:PDT
    mysgw: TSM:FAIL:RE-INIT
    mysgw: TSM:INIT
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=3
    mysgw: TSM:FAIL:PDT
    mysgw: TSM:FAIL:RE-INIT
    mysgw: TSM:INIT
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=4
    mysgw: TSM:FAIL:PDT
    

    And can someone show how to bind this gateway into FHEM? As said, today I am running an esp-wifi-gateay.

    Thanks in advance for any support...



  • @gohan
    With the serial Gateway on the raspberry; how is connected the nfr24 ??
    If usb/serial port is no possible, which serial port to use ?



  • @gohan Been trying to find my old post to tell you all how it got with my rpi and nodes that did not register. I bougt some voltage regulators LM350. used the 5v output insted of 3.3 V but still no luck to get node to register. when messauring volatage when GW send awnser it drops way below 3.3v. I think voltage output from rpi just is to bad. So I bought a nodemcu for GW instead and it works like a sharm πŸ™‚


  • Code Contributor

    @romeo01 You have to connect the nrf24 to the GPIO if you want to use it with the RPi, the information on the wiki was wrong, sorry about that.


  • Mod

    @marceloaqno he said he can't connect nrf24 chip on the rpi, so that's why he is struggling


  • Code Contributor

    @dirkc Try to connect your module to the SPI0 (https://www.mysensors.org/view/180#wiring).
    You only need to enable the SPIDEV if you want to use the SPI1.


  • Mod

    @dirkc I don't know where you got those pin numbers but they don't look like the ones on the guide. In addition you don't have to use spi driver. The PA version of nrf24 are quite a pain to get them working, so I suggest you first test with regular modules and then upgrade to PA



  • @gohan, @marceloaqno : sorry, I corrected the "typo", the NRF was already connected as shown in https://www.mysensors.org/view/180#wiring. I double checked that again.
    What is the correct setup for ./configure ?



  • @marceloaqno

    Thanks marceloagno, the answer is clear.

    Keep up the great work !


  • Code Contributor

    @dirkc The default settings for ./configure is to use the nrf24 module connected in the same way as shown in the guide and as an ethernet gateway.



  • I'm having issues with the LED setup as shown on the page. The LEDs are just constantly on even though everything looks like it's setup just like the picture. I'm new at this so I could be doing something stupid.



  • @marceloaqno ok, thanks, I will change the radio.


  • Code Contributor

    Support for RFM69 was added to the development branch (finally!).



  • @marceloaqno

    IΒ΄m really happy ear that !

    RFM69 is one of best RF transceivers in these days for IoT.
    So good news I believe for Mysensors community.

    You know if are any hope that RFM69 will be added too to OPI boards support mysgw development ?

    Congratulations for that great work !


  • Code Contributor

    @jirm Support for RFM69 also applies to the OrangePi πŸ˜‰



  • @marceloaqno

    Awesome !!!
    Thank you so much.

    Best regards



  • When I configure "MY_RFM69_MAX_POWER_LEVEL_DBM" in MyConfig.h, compiling fails.
    Perhaps you should change the code in ./drivers/RFM69/new/RFM69_new.h from:

    #define RFM69_MAX_POWER_LEVEL_DBM MY_RFM69_MAX_POWER_LEVEL_DBM //!< MY_RFM69_MAX_POWER_LEVEL_DBM

    to:

    #define RFM69_MAX_POWER_LEVEL_DBM ((rfm69_powerlevel_t)MY_RFM69_MAX_POWER_LEVEL_DBM) //!< MY_RFM69_MAX_POWER_LEVEL_DBM



  • I cannot get the RFM69(HW) working. When I start myswg in debug mode (-d), I see:

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
    mysgw: MCO:BGN:INIT GW,CP=RPNG----,VER=2.2.0-beta
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: RFM69:INIT
    mysgw: RFM69:INIT:PIN,CS=24,IQP=22,IQN=22
    mysgw: RFM69:PTX:LEVEL=5 dBm
    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: Listening for connections on 0.0.0.0:5003
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1
    

    But I can see ('hear' with a radio on 868.000 MHz) no transmission of the RFM69. When I power up a node, the node does not connect to the gateway: "NO REPLY"πŸ‘

    0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
    4 TSM:INIT
    4 TSF:WUR:MS=0
    8 TSM:INIT:TSP OK
    10 TSM:INIT:STATID=4
    12 TSF:SID:OK,ID=4
    14 TSM:FPAR
    274 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2281 !TSM:FPAR:NO REPLY
    2283 TSM:FPAR
    2562 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4569 !TSM:FPAR:NO REPLY
    4571 TSM:FPAR
    4831 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6838 !TSM:FPAR:NO REPLY
    6840 TSM:FPAR
    7100 TSF:MSG:SEND,4-4-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    9107 !TSM:FPAR:FAIL
    9109 TSM:FAIL:CNT=1
    9111 TSM:FAIL:PDT
    

    Is there any 'check' I can do to perform basic RFM69HW testing on my RPI?


  • Mod

    Was it working before on a normal Arduino gateway? How did you wire everything up?



  • I'm pretty sure I wired up the RFM69 correctly.
    However, I'm debugging. It seems we are stuck in "core/MyGatewayTransport.cpp":

    inline void gatewayTransportProcess(void)
    {
    
      if (gatewayTransportAvailable()) {
        // NEVER REACHED
    

    I never seem to get pass gatewayTransportAvailable. I will continue debugging.
    Disclaimer: I'm relatively new to MySensors and not really 'up to speed' with the source code :-).



  • @ftw64 Ok, this has to do with connecting an Ethernet client. When a client connects, this code works...
    Any idea where to start debugging for incoming RFM69 messages?


  • Mod

    Download myscontroller and connect it to the gateway, you can now see all messages from ethernet controller



  • @gohan said in πŸ’¬ Building a Raspberry Pi Gateway:

    myscontroller

    I just did. When I also have a Domoticz controller connected to the gateway:

    2017-04-23 11:18:33	INFO	Connected to 192.168.10.24:5003
    2017-04-23 11:18:33	CHILD	New child discovered, node id=0, child id=internal
    2017-04-23 11:18:33	RX	0;255;3;0;14;Gateway startup complete.
    2017-04-23 11:18:33	DEBUG	Update child id=255, type=ARDUINO_RELAY
    2017-04-23 11:18:33	RX	0;255;0;0;18;2.2.0-beta
    2017-04-23 11:18:33	RX	0;255;3;0;22;208103
    2017-04-23 11:18:33	RX	0;255;3;0;2;2.2.0-beta
    2017-04-23 11:18:43	RX	0;255;3;0;22;218106
    2017-04-23 11:18:53	RX	0;255;3;0;22;228110
    2017-04-23 11:19:03	RX	0;255;3;0;22;238101
    2017-04-23 11:19:13	RX	0;255;3;0;22;248104
    2017-04-23 11:19:23	RX	0;255;3;0;22;258110
    2017-04-23 11:19:33	RX	0;255;3;0;22;268107
    2017-04-23 11:19:43	RX	0;255;3;0;22;278106
    2017-04-23 11:19:53	RX	0;255;3;0;22;288110
    2017-04-23 11:20:03	RX	0;255;3;0;22;298116
    

    However, I found out that the DI00 (=IRQ) on the RFM69 never gives a rising edge...
    I'm suspecting that the RFM69 is not being initialised properly... I added some debugging in the RFM69 code to see what registers are being written and read:

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
    mysgw: MCO:BGN:INIT GW,CP=RPNG----,VER=2.2.0-beta
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: RFM69:INIT
    mysgw: RFM69:INIT:PIN,CS=24,IQP=22,IQN=22
    mysgw: FtW:RFM69:write register, reg=0x01, value=4
    mysgw: FtW:RFM69:write register, reg=0x02, value=0
    mysgw: FtW:RFM69:write register, reg=0x03, value=2
    mysgw: FtW:RFM69:write register, reg=0x04, value=64
    mysgw: FtW:RFM69:write register, reg=0x05, value=3
    mysgw: FtW:RFM69:write register, reg=0x06, value=51
    mysgw: FtW:RFM69:write register, reg=0x18, value=136
    mysgw: FtW:RFM69:write register, reg=0x19, value=66
    mysgw: FtW:RFM69:write register, reg=0x26, value=7
    mysgw: FtW:RFM69:write register, reg=0x28, value=16
    mysgw: FtW:RFM69:write register, reg=0x29, value=220
    mysgw: FtW:RFM69:write register, reg=0x2c, value=0
    mysgw: FtW:RFM69:write register, reg=0x2d, value=3
    mysgw: FtW:RFM69:write register, reg=0x2e, value=136
    mysgw: FtW:RFM69:write register, reg=0x2f, value=45
    mysgw: FtW:RFM69:write register, reg=0x30, value=101
    mysgw: FtW:RFM69:write register, reg=0x37, value=212
    mysgw: FtW:RFM69:write register, reg=0x38, value=66
    mysgw: FtW:RFM69:write register, reg=0x39, value=255
    mysgw: FtW:RFM69:write register, reg=0x3a, value=255
    mysgw: FtW:RFM69:write register, reg=0x3c, value=5
    mysgw: FtW:RFM69:write register, reg=0x3d, value=16
    mysgw: FtW:RFM69:write register, reg=0x6f, value=48
    mysgw: FtW:RFM69:write register, reg=0x07, value=217
    mysgw: FtW:RFM69:write register, reg=0x08, value=0
    mysgw: FtW:RFM69:write register, reg=0x09, value=0
    mysgw: FtW:RFM69:write register, reg=0x01, value=4
    mysgw: FtW:RFM69:read register, reg=0x27, value=128
    mysgw: FtW:RFM69:read register, reg=0x3d, value=16
    mysgw: FtW:RFM69:write register, reg=0x3d, value=16
    mysgw: FtW:RFM69:write register, reg=0x11, value=87
    mysgw: RFM69:PTX:LEVEL=5 dBm
    mysgw: FtW:RFM69:read register, reg=0x02, value=0
    mysgw: FtW:RFM69:read register, reg=0x03, value=2
    mysgw: FtW:RFM69:read register, reg=0x04, value=64
    mysgw: FtW:RFM69:read register, reg=0x05, value=3
    mysgw: FtW:RFM69:read register, reg=0x06, value=51
    mysgw: FtW:RFM69:read register, reg=0x30, value=101
    mysgw: FTW attachInterrupt: gpioPin=25 mode=3
    mysgw: TSM:INIT:TSP OK
    mysgw: TSM:INIT:GW MODE
    mysgw: FtW:RFM69:write register, reg=0x39, value=0
    mysgw: TSM:READY:ID=0,PAR=0,DIS=0
    mysgw: MCO:REG:NOT NEEDED
    mysgw: FtW:RFM69:write register, reg=0x25, value=64
    mysgw: FtW:RFM69:write register, reg=0x13, value=26
    mysgw: FtW:RFM69:write register, reg=0x5a, value=85
    mysgw: FtW:RFM69:write register, reg=0x5c, value=112
    mysgw: FtW:RFM69:read register, reg=0x3d, value=16
    mysgw: FtW:RFM69:write register, reg=0x3d, value=20
    mysgw: FtW:RFM69:write register, reg=0x01, value=16
    mysgw: Listening for connections on 0.0.0.0:5003
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1
    mysgw: New connection from 127.0.0.1
    mysgw: Client 0 connected
    mysgw: Client 0: 0;0;3;0;2;
    mysgw: gatewayTransportAvailable
    mysgw: Client 0: 0;0;3;0;2;Get Version
    mysgw: gatewayTransportAvailable
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: gatewayTransportAvailable
    mysgw: Client 0: 0;0;3;0;18;PING
    mysgw: gatewayTransportAvailable
    mysgw: Client 0: 0;0;3;0;18;PING
    


  • Can't get the RFM69HW to work on RPI. I tried the following:

    1. I installed on an old RPI1 (clean Rasbian install). Same results as on my Domoticz RPI-3.
    2. Setup the original RPI3 as a node, using the 2.2.0-beta code. I verified that in this case the RFM69HW actually transmits (I can hear it burst on 868.000 MHz). However, it is unable to connect to an existing Arduino 2.1.1 gateway.
    3. I built an Arduino 2.2.0-beta serial gateway. Even then, the RPI as a node fails to connect to the 2.2.0-beta serial gateway.
    4. I built an Arduino 2.2.0-beta node. This node is able to connect to the above gateway.

    There seems to be something different in the radio network between the RFM69HW on the RPI and the RFM69HW on the Arduino. But I'm unable to find out what the difference is :-(.

    The RPI RFM69HW will not communicate with the Arduino RFM69HW. When the RPI is a gateway, the RFM69HW will not physically interrupt when another node is trying to connect. When the RPI is a node, the RFM69HW on the ARduino does not interrupt either.

    Did anyone get the RFM69HW working on the RPI? I'd really like to get this beautiful piece of code working!


  • Mod

    I have to ask a stupid question : did you use a logic converter between rpi and rfm69 radio?



  • @gohan There are no stupid questions, right :-)? But perhaps a stupid answer: no, I did not use any logic convertors. The RFM69 is 3.3V and as far as I know, so are the GPIO pins on the RPI. But I might be mistaken, of course... Should I use logic convertors?

    At the moment I have no idea where it fails. Perhaps I need to give it a rest for a couple of days to think it over...

    I followed the steps as given on the web site (git branch development). Connected the RFM radio (7 wires: Vcc, GND, MOSI, MISO, SCK, NSS, DI00). Only modified MyConfig.h with regard to the NETWORKID (100 --> 101; my 'production' MySensors runs at 100) and enabling "MY_DEBUG_VERBOSE_RFM69". I configured with:

    % ./configure --my-debug=enable --my-config-file=/usr/local/etc/mysensors.dat --my-gateway=ethernet --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw
    % make -j 4
    % sudo bin/mysgw -d
    

  • Mod


  • Mod

    @ftw64 that configure command looks like an ethernet gateway. Could you post the configure command for your "RPI as a node" as well?


  • Code Contributor

    I forgot to mention in the guide:
    To communicate with the RPi using the RFM69 radio, all of your nodes need to use the new RFM69 driver available in the development branch.
    To make the change, add the following line to the node sketch:

    #define MY_RFM69_NEW_DRIVER
    

  • Mod

    @marceloaqno you forgot just a little little insignificant detail πŸ˜‚


  • Code Contributor

    @gohan @ftw64 sorry for all the trouble


  • Mod

    It's OK, don't worry. We need to update the guide with the new instructions πŸ˜€


  • Code Contributor

    @gohan Done!



  • @marceloaqno Thanks! That indeed does the trick! And no worries, it is my own decision to play with beta(!) code (and it was a fun weekend troubleshooting it - I learned a lot about the structure of the MySensors code)!

    Only 'bad' thing is that 2.2.0 is not compatible with my existing nodes :-).

    I appreciate all the work that has been put into MySensors.



  • This is really stupid. πŸ˜„ RFM69 radio need powered separately ?


  • Mod

    They shouldn't, but it's always a matter trying πŸ˜€



  • This post is deleted!


  • How will this work with HASS running on the same pi ?


  • Mod

    It's the same as it was running on separate hw, you will only set ip address of the gateway in hass



  • so i can attach the NRF24L01+ to the pi running HA, make it a Ethernet Gateway and point to his own ip adress ?, will this be a long job with converting from a USB connected GW (Arduino with local sensors ? )


  • Mod

    That's pretty much it. I don't know what is your current setup and what sensors you have, but is should not be a long job. Anyway you can install the ethernet gateway and when you are done you take care of the sensors



  • excellent, will the cpu utilisation be much higher that with a usb connected gw ?


  • Mod

    No, it uses very few cpu



  • @Richard van der Plas: I strongly recommend to use MQTT instead of Ethernet gateway, as it is a standard way for 2 processes to communicate, and platform-agnostic.
    HASS comes with an embed MQTT broker taht works out of the box.
    Plus:

    • you can easily mock either your sensors network or your controller
    • it does support secure communication
    • you can add other clients to observe the event, e.g. to log what is coming from/what is sent to the gateway

  • Mod

    I suggested ethernet because it's easier to setup and configure, mqtt is the next step.



  • Hi
    I also have problem to get the NRF24L01+ chip to work with the RPi3.

    I find that the masterbranch don't recognize the board as RPi3 and sets SoC and Type as unknown.
    But if i take development branch itΒ΄s detecting RPi3 and seems to work correct.

    This is result from development Branch configure:
    [SECTION] Detecting target machine.
    [OK] machine detected: SoC=BCM2837, Type=rpi3, CPU=armv7l.
    [SECTION] Detecting SPI driver.
    [OK] SPI driver detected:BCM.
    [SECTION] Detecting init system.
    [OK] init system detected: systemd.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.

    This is result from Master Branch configure:
    [SECTION] Detecting target machine.
    [OK] machine detected: SoC=unknown, Type=unknown, CPU=armv7l.
    [SECTION] Checking GPIO Sysfs.
    [OK] /sys/class/gpio/export found
    [SECTION] Detecting SPI driver.
    [OK] SPI driver detected:SPIDEV.
    [SECTION] Detecting init system.
    [OK] init system detected: systemd.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.

    This is the result from cat /proc/cpuinfo:

    Hardware : BCM2835
    Revision : a02082

    //Peter


  • Mod

    That's odd, I have the 2.1.1 compiled on mine rpi 3


  • Code Contributor

    @pettib @gohan There have been some changes in /proc/cpuinfo in newer versions of kernels which leads to a wrong detection.
    The problem was fix in #827 and will be available in the master branch in the next mysensor release.


  • Mod

    I'm using dietpi and I compiled it like 2 weeks ago..



  • @Richard-van-der-Plas what is this: HASS ?



  • Ok, i am standig on a crossroad it seems, i have to build a new gateway but i am also interested in the MQTT option, this is between mysensors & HomeASSistant i presume? i have some ESP's lying around unused, but i have 0 knowledge of mqtt (i dont think my hass has it running by default)


  • Mod

    Just go with ethernet first that is easier, get used to it then take your time to learn MQTT. Of course MQTT is more advanced has authentication and encryption but it adds complexity to initial setup.



  • Damn, just connected as in manual, but gives an error : mysgw: !TSM:INIT:TSP FAIL
    Double checked the GPIO pins (except 15 cannot find that one) but seems ok



  • NM, used GPIO numbers instead of Pin numbers RTFM πŸ™‚



  • I always have a mysgw: accept: Bad file descriptor error when I launch a new ./bin/mysgw -d Exact problem is the following:

    mysgw: bind: Address already in use
    mysgw: Failed to bind!
    

    And I always need to kill the process first. Is this normal ? (I'm in LAN GW)

    Thanks!


  • Mod

    If you already installed mysgw as service to start at boot, it is normal that you can not run another process in debug mode and it conflicts



  • @gohan said in πŸ’¬ Building a Raspberry Pi Gateway:

    lready installed mysgw as service to start at boot, it is normal that you can not run another process in debug mode and it conflicts

    Oh, Ok. Thanks.
    Another thing is that when i close PuTTY, the gateway doesn't retrieve anymore the data...


  • Mod

    You need to install it as service so it always runs in background



  • Is it this process :

    1421 ?        Rs    40:25 /usr/local/bin/mysgw
    

    Seems it runs for 40 minutes, but no the gateway sees no data...


  • Mod

    what gateway did you compile? What option in ./configure did you use?



  • First of all : thanks for helping !

    I compiled an Ethernet gateway
    The options are the following:

    ./configure --my-gateway=ethernet --my-port=5003 --my-rf24-irq-pin=15 --my-transport=nrf24
    

    The only way I make the GW working is through the debug mode (by switching off the service process)



  • Hello, it seems I found the problem: Complete newbie thing: πŸ”°
    sudo ./bin/mysgw -h worked, but /usr/local/bin/mysgw didn't
    I just gave the right to the folder, and now it's working.
    Thanks for taking time to help beginners !



  • @Richard van der Plas : i was have the same error with my raspberry zero. I have succed with the devellopement branch version...



  • Trying to setup a Rpi1, as i got one lying around here.

    All work untill i want to 'make'

    Generates an error:

    pi@mysgw:~/MySensors $ ./configure --my-gateway=ethernet --my-port=5003 --my-transport=nrf24 --my-rf24-irq-pin=15
    [SECTION] Detecting target machine.
      [OK] machine detected: SoC=BCM2835, Type=rpi1, CPU=armv6l.
    [SECTION] Detecting SPI driver.
      [OK] SPI driver detected:BCM.
    [SECTION] Detecting init system.
      [OK] init system detected: systemd.
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.
    pi@mysgw:~/MySensors $ make
    gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/log.c -o build/drivers/Linux/log.o
    g++ -MT build/drivers/Linux/noniso.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/noniso.cpp -o build/drivers/Linux/noniso.o
    g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o
    g++ -MT build/drivers/Linux/SPIDEV.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SPIDEV.cpp -o build/drivers/Linux/SPIDEV.o
    g++ -MT build/drivers/Linux/Print.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/Print.cpp -o build/drivers/Linux/Print.o
    g++ -MT build/drivers/Linux/EthernetClient.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/EthernetClient.cpp -o build/drivers/Linux/EthernetClient.o
    g++ -MT build/drivers/Linux/compatibility.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/compatibility.cpp -o build/drivers/Linux/compatibility.o
    g++ -MT build/drivers/Linux/SerialPort.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SerialPort.cpp -o build/drivers/Linux/SerialPort.o
    g++ -MT build/drivers/Linux/Stream.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/Stream.cpp -o build/drivers/Linux/Stream.o
    g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o
    g++ -MT build/drivers/Linux/interrupt.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/interrupt.cpp -o build/drivers/Linux/interrupt.o
    g++ -MT build/drivers/Linux/SerialSimulator.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SerialSimulator.cpp -o build/drivers/Linux/SerialSimulator.o
    g++ -MT build/drivers/Linux/SoftEeprom.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SoftEeprom.cpp -o build/drivers/Linux/SoftEeprom.o
    g++ -MT build/drivers/Linux/EthernetServer.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/EthernetServer.cpp -o build/drivers/Linux/EthernetServer.o
    g++ -MT build/examples_linux/mysgw.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi1\" -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15 -DMY_PORT=5003  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o
    In file included from ./MySensors.h:109:0,
                     from examples_linux/mysgw.cpp:83:
    ./hal/architecture/MyHwLinuxGeneric.cpp: In function β€˜ssize_t hwGetentropy(void*, size_t)’:
    ./hal/architecture/MyHwLinuxGeneric.cpp:79:17: error: β€˜SYS_getrandom’ was not declared in this scope
      return syscall(SYS_getrandom, __buffer, __length, GRND_NONBLOCK);
                     ^
    ./hal/architecture/MyHwLinuxGeneric.cpp:79:52: error: β€˜GRND_NONBLOCK’ was not declared in this scope
      return syscall(SYS_getrandom, __buffer, __length, GRND_NONBLOCK);
                                                        ^
    ./hal/architecture/MyHwLinuxGeneric.cpp:80:1: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
    Makefile:98: recipe for target 'build/examples_linux/mysgw.o' failed
    make: *** [build/examples_linux/mysgw.o] Error 1
    pi@mysgw:~/MySensors $
    

    Has this to do with a limitation of Rpi being v1?

    Regards

    Gerwin


  • Code Contributor

    @gdekeijzer There was a recent update on the random number generator for the RPi port, but unfortunately not all linux versions support the new method. @d00616 is working on a solution to this problem #856. Please use the master branch for the time being.



  • Ah great. Thanx for the response. I'll go try that for now.



  • Installed master branche. That did the job. Thanx.



  • Hello, did anyone tried gateway on pi with RS485 wired network ? It looks like node with ID set is looking for parrent and gateway does not respond to the node and therefore there is no succesfull presentation.
    example from GW mysgw:

    TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    mysgw: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:BC
    mysgw: TSF:MSG:FPAR REQ,ID=5
    mysgw: TSF:PNG:SEND,TO=0
    mysgw: TSF:CKU:OK
    mysgw: TSF:MSG:GWL OK
    mysgw: TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    mysgw: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:BC
    mysgw: TSF:MSG:FPAR REQ,ID=5
    mysgw: TSF:CKU:OK,FCTRL
    mysgw: TSF:MSG:GWL OK
    mysgw: TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    mysgw: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:BC
    mysgw: TSF:MSG:FPAR REQ,ID=5
    mysgw: TSF:CKU:OK,FCTRL
    mysgw: TSF:MSG:GWL OK
    mysgw: TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    mysgw: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:BC
    mysgw: TSF:MSG:FPAR REQ,ID=5
    mysgw: TSF:CKU:OK,FCTRL
    mysgw: TSF:MSG:GWL OK
    mysgw: TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    

    and from node :

    0 MCO:BGN:INIT NODE,CP=RSNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    5 TSM:INIT:TSP OK
    7 TSM:INIT:STATID=5
    9 TSF:SID:OK,ID=5
    10 TSM:FPAR
    27 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2035 !TSM:FPAR:NO REPLY
    2037 TSM:FPAR
    2055 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4063 !TSM:FPAR:NO REPLY
    4065 TSM:FPAR
    4082 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6090 !TSM:FPAR:NO REPLY
    6092 TSM:FPAR
    6110 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8118 !TSM:FPAR:FAIL
    8119 TSM:FAIL:CNT=1
    


  • @Luc3as Okay, Again I found answer while after asking, I used dev branch of mysensors and it is working like a charm.



  • I am a novice, trying to get the raspberry pi gateway to work. I did get it to work on one pi, but while installing it on the second, it produces the following error:

    In file included from examples_linux/mysgw.cpp:74:0:
    ./MySensors.h:254:2: error: #error No support for nRF24 radio on this platform
    #error No support for nRF24 radio on this platform
    ^
    In file included from ./drivers/RF24/RF24.cpp:23:0,
    from ./MySensors.h:290,
    from examples_linux/mysgw.cpp:74:
    ./drivers/RF24/RF24.h:52:17: fatal error: SPI.h: No such file or directory
    #include <SPI.h>

    I can see that the SPI.h library is among the files downloaded.

    Any ideas?

    Paul


  • Mod

    what raspberry version is that? What library version did you download?



  • do you have SPI enabled through raspi-config ?



  • @gohan Thanks for the response. I downloaded the MySensors Library 2.1.1. Sorting through it I can see that SPI.h is included.

    I installed a complete system in FL (I'm retired and a snowbird). Included are a Bunch of Arduino sensors, a Foscam Camera and Wemo switches. So I used a lot of material from MySensors to get the Arduino sensors up and running (great stuff: thanks to all those folks who created it). I then created a Raspberry Wireless (RF24) Gateway and installed Mosquitto to communicate with HomeAssistant. Took a while to configure HA, and I'm still learning.

    I do not recall having a problem with the SPI library when assembling all this stuff. Upon return to Boston, I have made a number of improvements talking to the Raspberry in FL through TeamViewer (a great app). However, along the way, I corrupted the system in FL. It now limps. So, I started recreating the stuff in FL on a new SD card, encountering the SPI problem.

    Since sending out my request for help, I found a backup version of my FL system on an SD card. Looking at it, the system seems to be whole and boots with no issues. mysgw works fine on it. So, I've added all my new stuff to this SD card and have tested it to make sure its working. Things are looking good and so, my immediate problem is solved (circumvented).

    I still want to know what I am doing wrong with the gateway. I've learned a little bit of Python along the way. There, one installs a library. I know effectively nothing about C++. So, I've done nothing to install the library, only followed the instructions on the MySensors Raspberry Pi Gateway page.

    BTW, this stuff is great.

    Paul



  • @Luc3as Thanks for your response. No, in fact it was not enabled. Please read my reply to gohan. As you see, I've cheated my way out of this problem. In the process, I've lost track of the SD card on which I encountered this problem. Nonetheless, I will circle back to test your suggestion.


  • Mod

    Try to enable the SPI first. Then you could also try different linux distributions and see which one you like better ( I personally like dietpi more than the others ). You may also want to try to use Mysensors library from development branch that is now 2.2.0.
    I now have a dietpi + mysensors 2.2.0 + nrf24 and all running fine



  • @marceloaqno said in πŸ’¬ Building a Raspberry Pi Gateway:

    @Roberto-Mo-Ca If you are using the nrf24 PA/LNA version you need to use a 5V->3.3V regulator otherwise you can connect to the 3.3v pin.

    But why do we need to convert down from 5v to 3.3v? The pi does supply 3.3 on some pins.. Is this because the PA/LNA uses more mA?


  • Mod

    yes, the 3.3v can't supply enough current. I am using some small adapters that have the AMS1117 and some capacitors that allow for a quick swap of radio modules when you need test them



  • @gohan said in πŸ’¬ Building a Raspberry Pi Gateway:

    yes, the 3.3v can't supply enough current. I am using some small adapters that have the AMS1117 and some capacitors that allow for a quick swap of radio modules when you need test them

    Ok. Maybe this should be mentioned in the documentation page.


  • Mod

    @subutux could you explain where you would expect to find that note?


  • Mod

    (obviously not here)
    0_1496838882911_image.png


  • Mod

    @subutux it is mentioned as stated above that you need it, it is just skipping all the info that are in datasheets and are not stricly necessary to make the gateway



  • @gohan said in πŸ’¬ Building a Raspberry Pi Gateway:

    @subutux it is mentioned as stated above that you need it, it is just skipping all the info that are in datasheets and are not stricly necessary to make the gateway

    Well, I for one would like to know why we need to step-down from 5v to 3.3v. Just a simple statement that the LNA version requires more power that only the 5v can deliver on the pi.
    @mfalkvidd Yeah I would mention it there. It mentions to use a regulator but not why.. I've read that line & was like, why? That's when I've started a search in the forums here.


  • Mod

    @subutux I've updated the text. Do you think it is ok?



  • @mfalkvidd said in πŸ’¬ Building a Raspberry Pi Gateway:

    @subutux I've updated the text. Do you think it is ok?

    yup! thanks!



  • Hi,
    I'm having trouble setting up mysensor with this configuration.
    Controler : Home assistant on a debian server. ip : 192.168.0.50
    Gateway : rpi3, connected to the server trought ethernet. ip : 192.168.0.21
    Sensor : simple door switch from the example scripts.

    On both sensor and gateway the transport is a nrf24l01+ module. I bought 4 of them and they all worked in simpler projects (on both arduino and rpi).

    The main problem is I can't get the rf24l01+ to work with mysensor. I checked the wiring multiple times a changed the module. Nothing changes.
    I also tried to change the configuration settings but it has no effect :

    I configured as :
    ./configure --my-transport=nrf24 --my-gateway=ethernet --my-controller-ip-address=192.168.0.50 --my-port=5003

    Here is what I got every time i launch mysgw :

    /MySensors $ sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:PDT
    mysgw: TSM:FAIL:RE-INIT

    I used the wiring described in the script but without a voltage regulator. so I also checked the voltage received by the nrf24l01+ and it's a steady 3.3v.

    What's wrong here ? Any help would be greatly appreciated.

    --

    On another topic, home assistant doesn't seem to provide support for mysensor 2.1 protocol. Should I downgrade to 2.0 ?
    Obviously the controler can't connect to the gateway presently since the gateway isn't launching properly.
    Home assistant is constantly whining about it :

    Here is what I get from home automation console :

    Error (Thread-13) [mysensors.gateway_tcp] Failed to connect to socket at ('192.168.0.21', 5003).

    and here is my configuration.yaml extract :

    mysensors:
    gateways:
    - device: '192.168.0.21'
    optimistic: false
    persistence: true
    retain: true
    version: 2.0,



  • I just checked the wiring again and tested it with a voltage shifter I used for a grove RGB LCD and I got the same results


  • Mod

    @qkzk said in πŸ’¬ Building a Raspberry Pi Gateway:

    --my-controller-ip-address=192.168.0.50

    I think you can ignore that parameter. Did you try making a USB gateway or ethernet gateway with an arduino? Why the voltage shifter? Did you add a capacitor on the 3.3v supply of the nrf24? You could also try with the 2.2.0 version from development branch that has some fixes



  • I tried the voltage shifter since I read : (*): If you are using the nrf24 PA/LNA version you need to use a 5V->3.3V regulator because the Raspberry Pi 3.3V can't supply enough power.
    Since I don't know the version...

    I had no success with an arduino USB gateway but I'll try again.

    I thought the controller-ip-adress=192.168.0.50 parameter was usefull otherwise the gateway would have to look guess where the controler is. I may have got everything wrong about who is initiating the dialogue. From what I read in home automation logs it's the controller who is looking for the gateway...

    I'll try the 2.2.0 version.



  • I managed to connect everything but not the way I would have prefered.
    Controler : Home assistant on debian server
    Gateway : arduino Uno connected to debian server trough usb serial
    Sensor : binary sensor (reed switch) on arduino mini.

    I'm still trying to figure what's wrong with what I posted earlier.



  • WOW ! It works πŸ™‚ thanks @gohan πŸ™‚
    I removed the voltage shifter, added an 1Β΅F capacitor and downloaded developpement libraries.
    Also, I cleaned the configuration parameters : ./configure --my-transport=nrf24 --my-gateway=ethernet
    It finally works as expected (sensor, gw on rpi3, controler on debian server) and I can ditch the uno (well, I'll find him another use).
    Thanks again for the wonderfull work, it's been fun πŸ™‚


 

311
Online

8.3k
Users

9.2k
Topics

97.3k
Posts