[SOLVED] MQTT Ethernet shield gateway



  • Hi guys,

    I just downloaded the library, 1.5, from the download page and uploaded the sketch W5100MQTTClient to my Arduino uno. Now, the problem is I couldn't get the radio working so I checked the forum and after a while I made som changes.
    Enabled SoftSPI
    Changed datarate to 1Mbps
    Disabled Sanitycheck

    Now I get this message when I boot my device.

    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSM:RADIO:OK
    0;255;3;0;9;TSM:GW MODE
    0;255;3;0;9;TSM:READY
    IP: 192.168.254.202
    0;255;3;0;9;No registration required
    0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
    IP: 192.168.254.202
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;TSP:MSG:READ 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0:
    0;255;3;0;9;!TSP:MSG:PVER mismatch
    0;255;3;0;9;TSP:MSG:READ 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0:
    0;255;3;0;9;!TSP:MSG:PVER mismatch
    

    I can't figure out what the problem is, anyone can help me?


  • Mod

    @Gustafsson unfortunately, the download link for 1.5 now points to 2.0. This is the correct link https://github.com/mysensors/Arduino/archive/1.5.4.zip ( @hek could you fix the link?)

    But using 2.0 should work as well, if you update all nodes including the gateway. I don't know how to read the debug messages from 2.0 yet though 😞


  • Admin

    Will update the link (hopefully during the day).



  • Ah, okey. Then it is 2.0.0 🙂

    Still don't have a clue about that error. Feels like I've tried it all but nothing works. Tried different radios, with and without antenna.

    Is there a chance that it is some problem with my arduino uno or my ethernetshield? Both of them comes from China.

    I feel lika I don't want to buy new things just to try if it is the hardware.



  • Anyone got a clue what can be the issue here? Would love someone to Point me in the right direction so I can continue with all my planed builds.



  • Hi @Gustafsson
    I cannot claim to be an Expert. I did what you are doing with almost untouched v2.0 examples... so a suggestion be to upgrade to 2.0 and try again...
    Sensors must have a client id manually assigned AND Clear the eeprom with the sketch in the The mysensor - not the arduino One.
    The Gateway I just commented out the ip to get a dhcp ip. Then I updated the broker url and it Works 😀

    Good luck



  • @Thomas-Augustinus Thanks for your help.

    What hardware are you using? It kind of feels like something i troubling with mine. As I said before, I have to do a lot of modifications to make my radio pass the "check". Can you please describe you build of your gateway?

    Thanks



  • @Gustafsson - sure,

    Gateway:
    arduino uno R3 with w5100 ethernet shield and NRF24L01 radio. All bought on ebay from some random chinese manufacturer...

    Radio with soft-spi - connected as illustrated here.
    Running the GatewayW5100MQTTClient sketch with the following changes:

    • comment out the IP to activate DHCP:
      //#define MY_IP_ADDRESS 192,168,178,87
    • Enter mqtt broker address - I use the public available hivemq demo:
      #define MY_CONTROLLER_URL_ADDRESS "broker.hivemq.com"
    • optional change mqtt settings:
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "to"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "ti"
      #define MY_MQTT_CLIENT_ID "tv50"

    Sensor
    Arduino nano with serial adaptor, NRF24L01 radio and a switch on pin 3.
    Running the BinarySwitchSleepSensor. Only change is to add this line to assign node-id:
    #define MY_NODE_ID 12
    It is only needed the first time - after that it is stored in eeprom. If you check the debug serial prints, then you should be able to find something like:
    TSP:ASSIGNID:OK (ID=11)
    If it does not get the right id then load the ClearEepromConfig, run it and go back to the binary switch sketch.

    How to test
    The above enabled me to use mqtt.fx to connect to the hivemq broker and subscribe to "to/#" which means all messages from my gateway (to is the mqtt out prefix configured on the controller).

    If it still does not work then please post a dump from the serial port - perhaps some of the champs can help decode it... 🙂

    /th



  • @Thomas-Augustinus - Thanks

    It sounds like it's exactly as my gateway.

    I'm going to work now but the first thing tomorrow morning I will check on mine and come back to you if it works or not.

    I really appreciate all your help 👍

    //Fredrik



  • Gateway:
    alt text

    Sensor:
    alt text



  • @Thomas-Augustinus Thanks for the pictures.

    I checked my gateway and it's wired exactly the way yours is but still no luck.

    I reinstalled my arduinoprogram and installed the latest MySensors library again, just to be sure. The only thing I have done to the code is enable soft SPI, commented out IP to activate DHCP and also entered my MQTT IP adress.

    This i what my serial port says..

    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:RADIO:FAIL
    0;255;3;0;9;!TSM:FAILURE
    0;255;3;0;9;TSM:PDT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:RADIO:FAIL
    0;255;3;0;9;!TSM:FAILURE
    0;255;3;0;9;TSM:PDT
    

    I first bought all my parts from China, but after I got this message I ordered some radios, with and without antenna, from Sweden but still no luck. I have one arduino Uno and W5100 ethernet shield.

    Is there a possibility that my Uno or W5100 is the problem?

    /Fredrik



  • Problem fixed.

    Apparently my wires from Chine was the problem. Bought some new ones and now it works.

    Thanks for all help @Thomas-Augustinus



  • Great to hear that. I had similar problems - only with corroded pins on the w5100 shield so my proposal would have been to remove the shield, work on the radio and then when that worked return to the w5100...
    But great! It Works 😃
    /th



  • Good to hear that you had a plan 😆

    Now the only problem is that I need to figure out how to connect everything with the sensors and then to openhab. I'm off duty tonight so I'm going to see what Google have for me 🙂


Log in to reply
 

Suggested Topics

54
Online

11.4k
Users

11.1k
Topics

112.6k
Posts