Skip to content
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. MQTT ethernet gateway Works great for 3+ hours then stops
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

MQTT ethernet gateway Works great for 3+ hours then stops

Scheduled Pinned Locked Moved Troubleshooting
24 Posts 6 Posters 13.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • GuyPG Offline
    GuyPG Offline
    GuyP
    wrote on last edited by
    #1

    I've built an ethernet gateway from scratch.. using the ENC28J60 Ethernet module and NRF24L01 Radio. I loaded the MQTT gateway into my ATMega268 and started it going...

    For the first few hours everything is working perfectly. I can see it receiving updates from the the sensors (Temperature for the moment), and sending it on to openHAB. I can see a TCP connection on the OpenHAB server and all will be well.

    After 3+ hours though the MQTT will still be receiving traffic from the sensor but will stop Ethernet communication and not send it onto OpenHAB. I suspect it's a overflow issue somewhere.. As soon as I reboot the MQTT gateway all is well again.

    I've seen a few people report issues similar to this and discussing a watchdog to reboot the MQTT if it fails. I'd rather not do this though, and better to find the underlaying issue. I also read that not all the ATMega support it.

    C 1 Reply Last reply
    1
    • GuyPG GuyP

      I've built an ethernet gateway from scratch.. using the ENC28J60 Ethernet module and NRF24L01 Radio. I loaded the MQTT gateway into my ATMega268 and started it going...

      For the first few hours everything is working perfectly. I can see it receiving updates from the the sensors (Temperature for the moment), and sending it on to openHAB. I can see a TCP connection on the OpenHAB server and all will be well.

      After 3+ hours though the MQTT will still be receiving traffic from the sensor but will stop Ethernet communication and not send it onto OpenHAB. I suspect it's a overflow issue somewhere.. As soon as I reboot the MQTT gateway all is well again.

      I've seen a few people report issues similar to this and discussing a watchdog to reboot the MQTT if it fails. I'd rather not do this though, and better to find the underlaying issue. I also read that not all the ATMega support it.

      C Offline
      C Offline
      C.r.a.z.y.
      wrote on last edited by
      #2

      @GuyP You are lucky my mqtt worked only 3 minutes :)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        marceloaqno
        Code Contributor
        wrote on last edited by
        #3

        There have been some updates to the MQTT gateway recently. Are you using the latest version of mysensors?

        1 Reply Last reply
        0
        • GuyPG Offline
          GuyPG Offline
          GuyP
          wrote on last edited by
          #4

          Yup I'm on the latest library 1.4 and the latest version of the MQTT gateway that's posted.

          I'm in the process of designing a PCB and 3D printed case for my temp sensors. But having to reboot the gateway 3 times a day or more is really putting a damper on the project.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            marceloaqno
            Code Contributor
            wrote on last edited by
            #5

            Do you still see the node messages being printed on the serial output of the gateway after the problem happens?

            GuyPG 1 Reply Last reply
            0
            • M marceloaqno

              Do you still see the node messages being printed on the serial output of the gateway after the problem happens?

              GuyPG Offline
              GuyPG Offline
              GuyP
              wrote on last edited by
              #6

              @celonunes said:

              Do you still see the node messages being printed on the serial output of the gateway after the problem happens?

              Yup... They continue to be received by the MQTT, so the issue appears to lie with the Ethernet part.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                marceloaqno
                Code Contributor
                wrote on last edited by
                #7

                @GuyP @C.r.a.z.y.
                What happens if you ping the gateway IP?
                What happens if you restart openhab?
                Do you see any error messages in the openhab console?
                Could you try to connect to the gateway using another MQTT client and see if it responds? Like paho-MQTT, MQTT-fx, mosquito_sub

                GuyPG 1 Reply Last reply
                0
                • M marceloaqno

                  @GuyP @C.r.a.z.y.
                  What happens if you ping the gateway IP?
                  What happens if you restart openhab?
                  Do you see any error messages in the openhab console?
                  Could you try to connect to the gateway using another MQTT client and see if it responds? Like paho-MQTT, MQTT-fx, mosquito_sub

                  GuyPG Offline
                  GuyPG Offline
                  GuyP
                  wrote on last edited by
                  #8

                  @celonunes said:

                  @GuyP @C.r.a.z.y.
                  What happens if you ping the gateway IP?

                  GP> the MQTT stops responding pings

                  What happens if you restart openhab?

                  GP> nothing! :( it doesn't reconnect to the MQTT, in fact I can't telnet to the MQTT on port 1883 when it stops responding. I just have to reboot the MQTT to get it back on track.

                  Do you see any error messages in the openhab console?

                  GP> No nothing

                  Could you try to connect to the gateway using another MQTT client and see if it responds? Like paho-MQTT, MQTT-fx, mosquito_sub

                  GP> I'll give it a go but as I'm not able to telnet to it I don't think that will fair any better

                  C 1 Reply Last reply
                  0
                  • GuyPG GuyP

                    @celonunes said:

                    @GuyP @C.r.a.z.y.
                    What happens if you ping the gateway IP?

                    GP> the MQTT stops responding pings

                    What happens if you restart openhab?

                    GP> nothing! :( it doesn't reconnect to the MQTT, in fact I can't telnet to the MQTT on port 1883 when it stops responding. I just have to reboot the MQTT to get it back on track.

                    Do you see any error messages in the openhab console?

                    GP> No nothing

                    Could you try to connect to the gateway using another MQTT client and see if it responds? Like paho-MQTT, MQTT-fx, mosquito_sub

                    GP> I'll give it a go but as I'm not able to telnet to it I don't think that will fair any better

                    C Offline
                    C Offline
                    C.r.a.z.y.
                    wrote on last edited by
                    #9

                    @GuyP
                    You can find MQTT and serial logs in the zip files openhab 1.6.2 and 1.7.0 logs-1.7.0.zip logs-1.6.2.zip

                    1 Reply Last reply
                    0
                    • MagiskeM Offline
                      MagiskeM Offline
                      Magiske
                      wrote on last edited by
                      #10

                      Have had this problem. And I am pretty sure it's a power issue. Running 5v lines on a 3.3v. Works flawless when I pipe the ethernet lines through a 74LVC245 or when I replaced my "base station" with a Uno+Shield.

                      So try a level shifter or try running it with a 3.3v(3.7v) power supply to test ?(Remember to set the Arduino to 8Mhz so it's not overclocked)

                      /Mads

                      GuyPG 1 Reply Last reply
                      0
                      • MagiskeM Magiske

                        Have had this problem. And I am pretty sure it's a power issue. Running 5v lines on a 3.3v. Works flawless when I pipe the ethernet lines through a 74LVC245 or when I replaced my "base station" with a Uno+Shield.

                        So try a level shifter or try running it with a 3.3v(3.7v) power supply to test ?(Remember to set the Arduino to 8Mhz so it's not overclocked)

                        /Mads

                        GuyPG Offline
                        GuyPG Offline
                        GuyP
                        wrote on last edited by
                        #11

                        @Magiske said:

                        Have had this problem. And I am pretty sure it's a power issue. Running 5v lines on a 3.3v. Works flawless when I pipe the ethernet lines through a 74LVC245 or when I replaced my "base station" with a Uno+Shield.

                        So try a level shifter or try running it with a 3.3v(3.7v) power supply to test ?(Remember to set the Arduino to 8Mhz so it's not overclocked)

                        /Mads

                        Interesting... I am running the whole circuit at 3.3Volts from a regulator (LE33CZ-TR) and I have a capacitor across the power lines as well. But it's clocked at 16Mhz..

                        I don't have an 8Mhz crystal at hand to test with. I guess I could try the internal clock.

                        1 Reply Last reply
                        0
                        • MagiskeM Offline
                          MagiskeM Offline
                          Magiske
                          wrote on last edited by
                          #12

                          Just rechecking the specs, and the ENC28J60 should be 5v tolerant ? I ran my at 8mhz using the internal clock.
                          So if it was the levelshift or 8mhz that "fixed" mine is a good question.
                          Have to add that the Uno+Shield I am using now for the gateway is a W5100 simply because I ordered the W5100 shield when I started having the issues.
                          (And this have also been running flawless from day one!)

                          1 Reply Last reply
                          0
                          • GuyPG Offline
                            GuyPG Offline
                            GuyP
                            wrote on last edited by
                            #13

                            I setup a continuous ping every 60 seconds to the MQTT gateway and when it stops working the pings stop as well. I also see that the "Green and Yellow" LEDS on the ENC28J60 are no longer lit.

                            1 Reply Last reply
                            0
                            • MagiskeM Offline
                              MagiskeM Offline
                              Magiske
                              wrote on last edited by
                              #14

                              Sounds like the same issue I had.. Some time it would run for a day other times it would stop responding after an hour or so.
                              After reboot it was back right away. So it looks like the ENC28J60 chip is crashing.
                              For me fideling with it and droppinglines to 3.3v running at 8mhz worked(And working was having it up and running for at least 3-4 days compared to "normal"). But I remember seeing others having ENC28J60 issues to ?? Maybe you should check to see if you are running latest ENC28J60 Lib ??

                              1 Reply Last reply
                              0
                              • GuyPG Offline
                                GuyPG Offline
                                GuyP
                                wrote on last edited by
                                #15

                                I've been doing a great deal of research on this and I think I might have found the issue.

                                It seems that the radio is very sensitive to power changes... In my original circuit I had the Arduino and the radio running from the 3.3v line. Since I moved it to the 5Volts line the Gateway has stayed up for over a day now.

                                So to sum up. Everything is now powered by 5Volts except the radio which is 3.3v from the LE33CZ-TR regulator. I have it powered direct from a USB power adapter as well rather than the Uno I did have.

                                Once I have etched and tested I will post the circuit and PCB layout.

                                1 Reply Last reply
                                0
                                • GuyPG Offline
                                  GuyPG Offline
                                  GuyP
                                  wrote on last edited by
                                  #16

                                  So to follow up.. yes indeed it seems that the power was my issue.
                                  IMG_0402.jpg

                                  the connector just above the Radio is the 5Volts and ground. The Single connection on the other side is serial TX so I can see the serial diagnostics.

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    AlinClaudiu
                                    wrote on last edited by
                                    #17

                                    @Magiske said:

                                    ENC28J60

                                    you connected ENC28J60 to 5v?

                                    http://www.alban.ro/category/arduino

                                    GuyPG 1 Reply Last reply
                                    0
                                    • A AlinClaudiu

                                      @Magiske said:

                                      ENC28J60

                                      you connected ENC28J60 to 5v?

                                      GuyPG Offline
                                      GuyPG Offline
                                      GuyP
                                      wrote on last edited by
                                      #18

                                      @AlinClaudiu said:

                                      @Magiske said:

                                      ENC28J60

                                      you connected ENC28J60 to 5v?

                                      Yes, the ENC28J60 and the Arduino are running on 5V. The only thing connected to the 3.3Volt regulator is the Radio, NRF24L01+

                                      1 Reply Last reply
                                      0
                                      • GuyPG Offline
                                        GuyPG Offline
                                        GuyP
                                        wrote on last edited by
                                        #19

                                        And now in it's 3D Printed case..

                                        IMG_0403.jpg

                                        1 Reply Last reply
                                        1
                                        • GuyPG Offline
                                          GuyPG Offline
                                          GuyP
                                          wrote on last edited by
                                          #20

                                          I was still seeing it stop working. However after further diagnostics it seems the issue lies with the ethernet side of things, the Arduino and Radio still continue to function.

                                          I tried to use the Arduino to reboot it's self, which didn't work, but also would not have rebooted the ethernet modules and thus would not have solved this.

                                          I've ended up building a 555 timer circuit which is triggered from the Arduino (Digital pin 3), the time fires and triggers a relay to remove power from everything for 2 seconds. Thus we end up with a complete reboot.

                                          Here's my circuit diagram, take 5Volts directly and then PWR is fed into my previous circuit that way when the relay clicks over all power to the Arduino and ethernet is removed.

                                          GWReset.png

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          18

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular