Raspberry Pi Gateway



  • I've been trying to integrate Serial Gateway directly into the Raspberry Pi following these instructions (https://github.com/mysensors/Raspberry) to no avail.

    I run sudo ./PiSerialGateway and it creates /dev/ttyMySensorsGateway, which is a symlink to /dev/pts/1 (owner = root, group = tty). I symlink then /dev/ttyMySensorsGateway to /dev/ttyUSB020, which is recognised by domoticz under MySensors Gateway USB hardware.

    In the controller log I see this error:

    2015-10-22 21:57:34.881 MySensors: Using serial port: /dev/ttyUSB020
    2015-10-22 21:57:34.881 Error: MySensors: Error opening serial port!
    

    This is the output of running PiSerialGateway:

    Starting PiGatewaySerial...
    Protocol version - 1.4
    Created PTY '/dev/pts/1'
    Gateway tty: /dev/ttyMySensorsGateway
    ================ SPI Configuration ================
    CSN Pin      = CE0 (PI Hardware Driven)
    CE Pin      = Custom GPIO25
    Clock Speed    = 8 Mhz
    ================ NRF Configuration ================
    STATUS       = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1    = 0xe7e7e7e7e7 0xc2c2c2c2c2
    RX_ADDR_P2-5    = 0xff 0xc4 0xc5 0xc6
    TX_ADDR       = 0xe7e7e7e7e7
    RX_PW_P0-6    = 0x00 0x00 0x20 0x00 0x00 0x00
    EN_AA       = 0x3b
    EN_RXADDR    = 0x07
    RF_CH       = 0x4c
    RF_SETUP    = 0x23
    CONFIG       = 0x0e
    DYNPD/FEATURE    = 0x3f 0x06
    Data Rate    = 250KBPS
    Model       = nRF24L01+
    CRC Length    = 16 bits
    PA Power    = PA_LOW
    

    Any clues?



  • Hello,

    I have similar issue with gateway on my RPi 2, but I think it is more related to RF24 library rathern than USB port. Did you check your wiring? I have nrf24l01+ wired in a slightly different manner (CE Pin = 22).

    Starting PiGatewaySerial...
    Protocol version - 1.4
    Created PTY '/dev/pts/1'
    Gateway tty: /dev/ttyMySensorsGateway
    ================ SPI Configuration ================
    CSN Pin  	 = CE0 (PI Hardware Driven)
    CE Pin  	 = Custom GPIO22
    Clock Speed	 = 8 Mhz
    ================ NRF Configuration ================
    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0xa8a8e1fc00 0xa8a8e1fc00
    RX_ADDR_P2-5	 = 0xff 0xc4 0xc5 0xc6
    TX_ADDR		 = 0xe7e7e7e7e7
    RX_PW_P0-6	 = 0x20 0x20 0x20 0x00 0x00 0x00
    EN_AA		 = 0x3b
    EN_RXADDR	 = 0x06
    RF_CH		 = 0x4c
    RF_SETUP	 = 0x23
    CONFIG		 = 0x0e
    DYNPD/FEATURE	 = 0x3f 0x06
    Data Rate	 = 250KBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_LOW
    
    

    However, my problem is that Domoticz cannot see any sensors. See my post below:

    http://forum.mysensors.org/topic/2305/nrf24l01-rpi2-direct-connection-problem

    with a number of messages "failed":

    read: 3-3-0 s=255,c=0,t=17,pt=0,l=3:1.5
    send: 3-194-1-0 s=255,c=0,t=17,pt=0,l=3,st=fail:1.5
    read: 3-3-0 s=255,c=3,t=6,pt=1,l=1:0
    send: 3-194-1-0 s=255,c=3,t=6,pt=1,l=1,st=fail:0
    read: 3-3-0 s=255,c=3,t=11,pt=0,l=17:Sensebender Micro
    send: 3-194-1-0 s=255,c=3,t=11,pt=0,l=17,st=fail:Sensebender Micro
    read: 3-3-0 s=255,c=3,t=12,pt=0,l=3:1.2
    send: 3-194-1-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.2
    read: 3-3-0 s=1,c=0,t=6,pt=0,l=0:
    send: 3-194-1-0 s=1,c=0,t=6,pt=0,l=0,st=fail:
    read: 3-3-0 s=1,c=1,t=0,pt=7,l=5:23.5
    send: 3-194-1-0 s=1,c=1,t=0,pt=7,l=5,st=fail:23.5
    read: 3-3-0 s=2,c=1,t=1,pt=2,l=2:64
    send: 3-194-1-0 s=2,c=1,t=1,pt=2,l=2,st=fail:64
    


  • @Viper_Scull said:

    /dev/ttyMySensorsGateway

    Just noticed something.
    Are you linking /dev/ttyMySensorsGateway to /dev/ttyUSB020?
    Try to delete the link and create it again sudo ln -s /dev/ttyMySensorsGateway /dev/ttyUSB20



  • @alexsh1
    Is the MySensorsGateway + Domoticz now working on your installation?
    Have the similar problem you mentioned above.
    A sensor node is sending data to the Gateway. The data appears in the console, even if there are some "fail".
    I linked the ttyMySensorsGateway to ttyUSB20. It appears in the Domoticz Setup when adding MySensorsGateway USB. Everything's fine so far, but the node don't appear in the Device section of the setup.
    Have you solved this problem?


  • Hardware Contributor

    I have a same setup (NRF24 directly connected to RPi). When I start a sensor, sometimes I do not see it under Devices, even though I can see it in the SETUP of Mysensor Gateway under Hardware.
    A sensor needs to succesfully send a presentation message and I think at least 1 measurement before it is seen in Domoticz "Devices". Most problems with st=fail - in my case - were because the default power output of a sensor is set to MAX, with seems to be too much for my NRF24L01+ with PA and LNA on the RPi.
    I now set it to MED or LOW using a define (I use the DEV build), so that the sensor no longer "screams" at the gateway.
    Secondly I also wait at least 500ms between presentation messages, because the gateway software on the RPi seems to have a problem with presentation messages coming in rapid succession. Someone made a change to the SerialGateway code so that it uses the interrupt capability of the NRF24, and that seems to help him, but I have not needed to use that trick. Reducing the power output of the sensor radio and adding wait(500) between presentation messages seems to be sufficient for me.



  • @thomas1412 said:

    @alexsh1
    Is the MySensorsGateway + Domoticz now working on your installation?
    Have the similar problem you mentioned above.
    A sensor node is sending data to the Gateway. The data appears in the console, even if there are some "fail".
    I linked the ttyMySensorsGateway to ttyUSB20. It appears in the Domoticz Setup when adding MySensorsGateway USB. Everything's fine so far, but the node don't appear in the Device section of the setup.
    Have you solved this problem?

    What Domoticz version are you running?
    Did you check the log file?

    As @GertSanders suggested, check out Low/Med settings - I has resolved my issue.

    Ever since I moved to the ethernet gateway (which I may upgrade to MQTT at a later stage). I am not sure the direct nrf24l01+ connection is going to be supported in the future (it is MS 1.4 now vs 1.5 for other GWs and 1.6 being dev) I also moved several nrf24l01+ around. Right now I have a very stable network of sensors and the gateway, which I can place almost anyway. I did not like my Raspberry with the USB cable connected to another box.


  • Hardware Contributor

    Just to confirm, the directly connected nrf24l01+ with PiSerialGateway running on the Raspberry handles my DEV 1.6 version nodes without a problem. Maybe @hek can confirm if the gateway just passes everything to the controller transparently or needs to have compatibility with de DEV library.
    So far I have a mix of 1.4, 1.5 and DEV 1.6 nodes in my network, and it all just works 🙂


  • Admin

    Yes, it should just pass along values. Just note that the PiGateway doesn't handle message signing as it it quite outdated.

    @All: I'd really appreciate some help merging the PIGateway specifics into the development branch and perhaps creating autoconf-files to ease up the compiling/installing part. This isn't exactly my area of expertise...


  • Hardware Contributor

    @hek I wish I could help, but on the unix side I'm a noob as well 🙂 I'm playing with DietPi (a minimal unix implementation) now hoping I can learn from that experience. Unix is something I used 25 years ago. Still learning the basics again.



  • Hi,
    first I must say thanks for the good work to the developers and community for this great project, I tried in the past to set up a domotic system without success, now in few days I have a floorplan with 2 remote sensor on my raspberry pi.

    I set up Domoticz on a Raspberry Pi B with a nrf24l01+ direct PiSerialGateway using MINIBIAN distribution.

    The PiSerialGateway work fine since the beginning, the only things that I noticed was the double script in the /etc/init.d the only I have now PiSerialGateway and another that I deleted called PiGateway , diffed, them was very similar and sometimes sensors in Domoticz stop to receive data, after deleted the file it didn't happen anymore.

    Tell me, if I can help performing some test or providing more data of my setup.

    Hope you understand my english.
    Greeting from Italy
    Carlo.


  • Hardware Contributor

    I currently have a RaspberryPi running OpenHAB and Mosquitto working perfect with a sample 'MQTTController.cpp' file where it can identify a few nodes, publish their readings from sensors and display it in OpenHAB. However, i need to expand my development now and that is where MySensors comes into play. So, if i delete this MQTTController file and its compiled program and MakeFile, install the Raspberry Pi files, these, would this then make my RaspberryPi the Controller(OpenHAB), MQTT Broker(Mosquitto) and Gateway(PiGateway) all in one system? If it matters, all of my sensors will be using RF Radios (nRF24L01).


Log in to reply
 

Suggested Topics

  • 1
  • 6
  • 3
  • 5
  • 1
  • 2

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts