Cannot run MySensors on RPI 3



  • Hello all,

    I have been reading and trying for 3 days now without success and simply do not know what to do anymore. I do not know what the problem is. Maybe I am misunderstanding the whole concept of MySensors? Anyways, let me explain.

    My main issue seems to be not able to run the gateway.

    The way I understand it, is that I can use the RPI 3 as both gateway and run a controller on it at the same time (in this case MyController).

    I followed the instructions on the MySensor's RPI page. Here is what I did:

    • Connected the NRF24L01+ to RPI3's pins (I triple-checked that all wires are correct)
    • I then entered the following commands:
    git clone https://github.com/mysensors/MySensors.git --branch master
    cd MySensors
    ./configure --my-transport=nrf24
    ./configure --my-gateway=mqtt --my-controller-ip-address=[IP-OF-MY-RPI] --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1
    make
    sudo ./bin/mysgw -d
    

    But I get the following error message:

    pi@rpi-lite:~/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
    mysgw: TSM:INIT
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=2
    mysgw: TSM:FAIL:PDT
    ^Cmysgw: Received SIGINT
    

    So already here I am stuck...

    Then I tried to use a WeMos D1 Mini connected to an NRF24 to create a gateway. I used all default settings to upload the sketch (which I got from Examples > MySensor > GatewayESP8266MQTTClient.

    I made sure to add the correct IP for my WeMos in the sketch under
    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68

    But when adding it to MyController.org's gateways the status is "unavailable"...

    What am I doing wrong?

    Ideally, I would wish the NRF24 to be hooked up to my RPI.

    Does anyone know what I am doing wrong?

    Thanks in advance 🙂


  • Mod

    @kkanedaa welcome to the MySensors community! Sorry for your troubles.

    All parameters to the ./configure command need to be entered on one line, like this:

    ./configure --my-transport=nrf24 --my-gateway=mqtt --my-controller-ip-address=[IP-OF-MY-RPI] --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1
    

    In your case it doesn't matter, because nrf24 is the default choice anyway. But it might be good to know if you change to another configuration later 🙂

    This part of the log:

    mysgw: !TSM:INIT:TSP FAIL
    

    indicates that the gateway software is unable to talk to the radio module. Since you've already triple-checked the wiring, maybe you could upload pictures of the wiring, to get a fresh pair of eyes on it?

    If you have another nrf24 radio module, it could be good to replace the one you are using, to rule out that there is something wrong with the nrf24 module. Or try the radio module on another device (your wemos d1 mini for example) to verify that it works there.

    Did the make command produce any warnings? If it did, those could be needing attention.



  • @mfalkvidd said in Cannot run MySensors on RPI 3:

    ./configure --my-transport=nrf24 --my-gateway=mqtt --my-controller-ip-address=[IP-OF-MY-RPI] --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1

    Hi thanks for the quick reply.

    I checked the NRF24 module by communicating with each other and it works fine...so I don't think the problem is with the module.

    I attached 2 photos of my wiring of the NRF with my Pi so you can have a look.

    As for error messages while "make" - none.

    Here is the output of make:

    pi@rpi-lite:~/MySensors $ make
    gcc -MT build/drivers/Linux/log.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/log.c -o build/drivers/Linux/log.o
    g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o
    g++ -MT build/drivers/Linux/noniso.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/noniso.cpp -o build/drivers/Linux/noniso.o
    g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o
    g++ -MT build/drivers/Linux/Print.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/Print.cpp -o build/drivers/Linux/Print.o
    g++ -MT build/drivers/Linux/EthernetClient.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/EthernetClient.cpp -o build/drivers/Linux/EthernetClient.o
    g++ -MT build/drivers/Linux/compatibility.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/compatibility.cpp -o build/drivers/Linux/compatibility.o
    g++ -MT build/drivers/Linux/SerialPort.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/SerialPort.cpp -o build/drivers/Linux/SerialPort.o
    g++ -MT build/drivers/Linux/Stream.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/Stream.cpp -o build/drivers/Linux/Stream.o
    g++ -MT build/drivers/Linux/interrupt.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/interrupt.cpp -o build/drivers/Linux/interrupt.o
    g++ -MT build/drivers/Linux/SerialSimulator.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/SerialSimulator.cpp -o build/drivers/Linux/SerialSimulator.o
    g++ -MT build/drivers/Linux/SoftEeprom.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/SoftEeprom.cpp -o build/drivers/Linux/SoftEeprom.o
    g++ -MT build/drivers/Linux/EthernetServer.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/EthernetServer.cpp -o build/drivers/Linux/EthernetServer.o
    g++ -MT build/examples_linux/mysgw.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o
    g++ -MT build/drivers/SPIDEV/SPI.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID=\"mygateway1\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/SPIDEV/SPI.cpp -o build/drivers/SPIDEV/SPI.o
    g++ -pthread  -o bin/mysgw build/drivers/Linux/log.o build/drivers/Linux/IPAddress.o build/drivers/Linux/noniso.o build/drivers/Linux/GPIO.o build/drivers/Linux/Print.o build/drivers/Linux/EthernetClient.o build/drivers/Linux/compatibility.o build/drivers/Linux/SerialPort.o build/drivers/Linux/Stream.o build/drivers/Linux/interrupt.o build/drivers/Linux/SerialSimulator.o build/drivers/Linux/SoftEeprom.o build/drivers/Linux/EthernetServer.o build/examples_linux/mysgw.o  build/drivers/SPIDEV/SPI.o
    

    And then again the error when running sudo ./bin/mysgw -d:

    pi@rpi-lite:~/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
    

    And here the photos:

    • CE = yellow
    • CSN = green
    • SCK = blue
    • MO = violet
    • MI = grey
    • IRQ = white

    alt text
    alt text

    Would you know what I am doing wrong? 😞

    I really want to get this to work.

    Thanks again in advance.


  • Mod

    @kkanedaa it looks like the "adapter board" you're using for the nrf24 has got an LDO on it. Is that the case? If so, is 3.3V sufficient for it? If you used it when you checked that the nrf24 works then it should be fine. But just to try to eliminate possible problem sources, how about connecting the nrf24 directly to the raspberry pi?

    It is recommended to place the capacitor as close to vcc/gnd on the nrf24 as possible. I see on the picture that it is placed at the input to the adapter board.


  • Mod

    The connections on the raspberry pi side look good. I can't see if the connections to the adapter board are correct because I'm not familiar with that board. Would you mind posting a photo where the adapter board silkscreen / labels are visible?



  • @kkanedaa said in Cannot run MySensors on RPI 3:

    gcc -MT build/drivers/Linux/log.o -MMD -MP -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_SPIDEV -DMY_MQTT_CLIENT_ID="mygateway1" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX="mysensors-in" -DMY_MQTT_PUBLISH_TOPIC_PREFIX="mysensors-out" -DMY_CONTROLLER_IP_ADDRESS=192,168,xx,166 -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/SPIDEV -c drivers/Linux/log.c -o build/drivers/Linux/log.o

    I dont know if it's important, but your configure didn't detect the BCM chip for SPI?
    Did you enable SPI via raspi-config (or /boot/config.txt) ?



  • @mfalkvidd said in Cannot run MySensors on RPI 3:

    @kkanedaa it looks like the "adapter board" you're using for the nrf24 has got an LDO on it. Is that the case? If so, is 3.3V sufficient for it? If you used it when you checked that the nrf24 works then it should be fine. But just to try to eliminate possible problem sources, how about connecting the nrf24 directly to the raspberry pi?

    It is recommended to place the capacitor as close to vcc/gnd on the nrf24 as possible. I see on the picture that it is placed at the input to the adapter board.

    Hi there, thanks again for the reply 🙂

    I have removed the baseboard and attached the wires directly to the NRF24. I also moved the capacitor to Pi's VCC and GND.

    alt text

    As for the baseboard, if you are wondering, the layout looks like this. I always used it in all my NRF projects and never seemed to have a problem.

    alt text

    @sburlot said in Cannot run MySensors on RPI 3:

    I dont know if it's important, but your configure didn't detect the BCM chip for SPI?
    Did you enable SPI via raspi-config (or /boot/config.txt) ?

    Yep, SPI is enabled. Otherwise I would get error message while executing "make" (I guess). But thanks for trying to help 🙂

    I will try to get MySensors running now once again and let you guys know the results. Hope it will work this time...



  • Nope....still same error message....

    What am I doing wrong? 😞



  • @mfalkvidd Should I try to use the dev version? Also, should I "format" my SD card with a fresh install of Raspbian Stretch Lite?

    Do you think this might help?

    Also, it does not matter if my Pi runs the controller and MySensors at the same time, right?



  • Download the development version of MySensors and try that. I could not get MySensors to work on a RPI 3 with the 2.1.1 version.


  • Mod

    There is a note in the raspberry page to use development version. BTW, did you connect the 5v pin to the nrf24 module? It seems so from the picture and if it's the case, say bye-bye to it. Also the capacitor it is better to be closer to the radio module and not on the raspberry gpio



  • I had same problem (but on serial GW). It started after I removed IRQ connector. I was able to add devices (using Domoticz as controller) , bust after few hours it stops to work.


  • Mod

    I'm using irq pin without issues



  • @mickecarlsson said in Cannot run MySensors on RPI 3:

    Download the development version of MySensors and try that. I could not get MySensors to work on a RPI 3 with the 2.1.1 version.

    I will try with the dev version and let you guys know again.

    @gohan said in Cannot run MySensors on RPI 3:

    There is a note in the raspberry page to use development version. BTW, did you connect the 5v pin to the nrf24 module? It seems so from the picture and if it's the case, say bye-bye to it. Also the capacitor it is better to be closer to the radio module and not on the raspberry gpio

    Nope, it's connected to 3.3V. Regarding the capacitor, I had it first near the NRF24, but mfalkvidd told me to move it.

    But thank you for your inputs, guys. I'll try the dev version and hope it will work.


  • Mod

    @kkanedaa sorry for being unclear. I meant closer to the nrf24, not further away from it.



  • This post is deleted!


  • Hey all,

    So I removed the stable version of MySensors and got the development version.

    Let me show you step by step what I did:

    sudo rm -r MySensors
    git clone https://github.com/mysensors/MySensors.git --branch development
    cd MySensors
    
    ./configure --my-transport=nrf24 --my-gateway=mqtt --my-controller-ip-address=[MY-PI-IP] --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1
    
    make
    sudo ./bin/mysgw -d
    

    [MY-PI-IP] has been changed to my RPI's IP.

    The output I got first is this:

    pi@rpi-lite:~/MySensors $ sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-rc.2
    mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-rc.2
    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: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: !TSF:MSG:LEN,0!=7
    mysgw: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: !TSF:MSG:LEN,0!=7
    mysgw: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: !TSF:MSG:LEN,0!=7
    mysgw: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: !TSF:MSG:LEN,0!=7
    

    then it started going non-stop repeating the following output:

    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    mysgw: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: !TSF:MSG:LEN,0!=7
    mysgw: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: !TSF:MSG:LEN,0!=7
    mysgw: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: !TSF:MSG:LEN,0!=7
    mysgw: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: !TSF:MSG:LEN,0!=7
    mysgw: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysgw: !TSF:MSG:LEN,0!=7
    mysgw: GWT:RMQ:MQTT RECONNECT
    mysgw: connect: Connection refused
    mysgw: failed to connect
    

    Now I have a problem with the gateway. Did I configure something wrong? Or did I forget a step?

    All help is very much appreciated 🙂



  • I struggled with RPi gateway for ages without success. The easiest solution by far is to run the gateway on arduino and interface it to RPI through a serial gateway. Its not a very elegant solution but works. I did some investigation and came to the conclusion that the problem with RPi gateway is to do with the low level library that communicates with the radio but never found a fix.



  • @grdl said in Cannot run MySensors on RPI 3:

    I struggled with RPi gateway for ages without success. The easiest solution by far is to run the gateway on arduino and interface it to RPI through a serial gateway. Its not a very elegant solution but works. I did some investigation and came to the conclusion that the problem with RPi gateway is to do with the low level library that communicates with the radio but never found a fix.

    Hi, thanks for your answer.

    If you are telling me that you have had the same issues as me, I am willing to do your method. True, not an elegant solution but I just want it to get up and running...

    When you say "run the gateway on arduino and interface it to RPI through a serial gateway", do you mean you built a serial gateway as mentioned here: https://www.mysensors.org/build/serial_gateway and then with an USB cable you connect it directly to your RPI? Am I understanding this correct?

    If yes, could you please tell me which parameters you have used while building your MySensors on your RPI. Would this be correct:

    ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway
    

    Did you leave the value for --my-serial-pty was shown above? Did you add any other parameters?

    Sorry for asking so many questions but I cannot fully grasp the concept of MySensors without MQTT.

    I appreciate your response and thank you in advance 🙂


  • Hardware Contributor

    I've been running the Ethernet gateway (port 5003) on my raspi without issues for several months now.

    @kkanedaa It looks like the development version finally works with your nrf module. Regarding the MQTT connection refused: Are you sure your MQTT broker does not need a username and password?


  • Mod

    @grdl on rpi3 is running fine, I have 2 radio modules too



  • This weekend a had also issues with nrf24 on rpi3. I'm using openhabian image and it was all working ok. But my sd card got corrupted and i had to reinstall openhabian. So I downloaded the newest image burned and ran my setup script - which should give me running and restored setup of OpenHAB, MySensors and couple more. But mysensors didn't work ... I found that the mysgw was failing to initialise nrf module (!TSM:INIT:TSP FAIL) - wierd because even with the binary that was working in previous setup i got the same error ... same hardware only new software ... So I connected my oscilloscope to spi pins and to my amazement there was no life on MOSI pin ... I even try with python to send something trough SPI - the same result. Then I compiled the mysgw with BCM driver ... and it worked ! Even better, I recompiled again with SPIDEV driver AND STILL WORKED !!!

    So @kkanedaa try to compile with BCM driver - maybe it will work, for me it did.


  • Mod

    @rozpruwacz did you use mysensors 2.1 or 2.2?



  • @gohan I was trying both master and developement branches (I believe ...).



  • @gohan I am sure that the old binary mysgw that was working before openhabian update and was not working after openhabian update was 2.1.


  • Mod

    A lot of users reported 2.1 no longer working with the more recent raspian images, while development version is known to be working better.



  • Hello all,

    Thank you for all the replies. It is very much appreciated 🙂

    @reinhold said in Cannot run MySensors on RPI 3:

    I've been running the Ethernet gateway (port 5003) on my raspi without issues for several months now.

    @kkanedaa It looks like the development version finally works with your nrf module. Regarding the MQTT connection refused: Are you sure your MQTT broker does not need a username and password?

    I am starting to think that I am misunderstanding the concept of MySensors. I thought that the RPI would handle both RF24 communication and MQTT. That is not correct...right?

    And your Ethernet gateway, did you use an Arduino to make the gateway and connected it to your RPI, or is the RPi itself the gateway?

    Can't I just install Mosquitto on my RPI and use it as a gateway? I'm really confused here.

    All I did was add MySensors (dev) to a fresh install of Raspbian Stretch Lite.

    Could you please tell me what exactly you did, I would appreciate it a lot.

    @rozpruwacz Unfortunately I am still fairly new to this, and I do not know what you mean by BCM and SPIDEV... but my ultimate goal is what you are doing: using MySensors in combination with openHABian (but currently I am trying with MyController since it seems easier).

    Anyways, I hope some of you guys can help me out setting up MySensors on RPI3 🙂

    Thanks again for all the replies.



  • @kkanedaa said in Cannot run MySensors on RPI 3:

    @rozpruwacz Unfortunately I am still fairly new to this, and I do not know what you mean by BCM and SPIDEV... but my ultimate goal is what you are doing: using MySensors in combination with openHABian (but currently I am trying with MyController since it seems easier).

    to compile the gateway with BCM driver You need to add to ./configure invocation special option, I don't remember now how it is named ... run ./configure --help and find this option - look for spidev and bcm keywords.
    and after that run make install 🙂



  • Hi all! Good news! I managed to make it work, finally 🙂

    Here is what I did (for those who might face the same problem):

    1. Fresh install of Raspbian Stretch Lite
    2. Install Mosquitto MQTT
    3. Install MySensors
    ./configure --my-transport=nrf24 --my-gateway=mqtt --my-controller-ip-address=[RPI-IP] --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1
    

    (Replace [RPI-IP] with your IP)

    1. "make" then "sudo ./bin/mysgw -d"

    I got the following output

    pi@rpi-mycontroller:~/MySensors $ sudo ./bin/mysgw -d
    mysgw: Config file /etc/mysensors.dat does not exist, creating new config file.
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-rc.2
    mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-rc.2
    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: GWT:RMQ:MQTT RECONNECT
    mysgw: connected to 192.168.xx.166
    mysgw: GWT:RMQ:MQTT CONNECTED
    mysgw: GWT:TPS:TOPIC=mysensors-out/0/255/0/0/18,MSG SENT
    mysgw: Received SIGINT
    
    1. Auto start service with "sudo systemctl enable mysgw.service"

    Thank you for all your inputs, guys. Really really appreciated. I am looking forward playing with MySensors. Very excited 😄



  • @kkanedaa said in Cannot run MySensors on RPI 3:

    Install MySensors

    developement branch as 2.2.0-rc.2 suggests that.
    So you only added --my-transport=nrf24 to what You started with ? (which seems to be the default so it shouldn't matter ...)



  • @rozpruwacz said in Cannot run MySensors on RPI 3:

    (which seems to be the default so it shouldn't matter ...)

    Yea, I'm confused too. But basically a fresh install of Raspbian did the trick..


  • Mod

    If you had failed mqtt connection it was most likely caused by mqtt broker non accepting anonymous connections


 

451
Online

7.9k
Users

8.7k
Topics

93.6k
Posts