Skip to content
  • MySensors
  • 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

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
    #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
                  • pit007P Offline
                    pit007P Offline
                    pit007
                    wrote on last edited by pit007
                    #21

                    Have you try to init the ENC all ~2 hours or by detecting the connection lost ? (brute force style, but better as powerdown all with a relais)

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

                      Well it's very simple to detect if the network has gone away.

                      In the processEthernetMessage() function, it checks

                      if (client) {

                      if there's a client connection then the network must be working. If not then either the network has stopped or nothing is connected. Well OpenHAB always maintains a connection.

                      So I've just added the

                      } else {

                      part to say the connection has gone. I also setup a timeout by counting the micros() since boot. so it's not constantly firing the reboot.

                      I then raise digital pin 3 which is linked to my 555 timer circuit, which causes the power cycle.

                      unsigned long resetCounter = micros();
                      int rebootAborted = 0;
                      
                      void processEthernetMessages() {
                      	char inputString[MQTT_MAX_PACKET_SIZE] = "";
                      	uint8_t inputSize = 0;
                      	EthernetClient client = server.available();
                      	if (client) {
                                      resetCounter=micros();
                                      if (rebootAborted) {
                                        Serial.println("Rebooting Aborted");
                                        rebootAborted = 0;
                                      }
                      		while (client.available()) {
                      			char inChar = client.read();
                      			inputString[inputSize] = inChar;
                      			inputSize++;
                      		}
                      #ifdef TCPDUMP
                      		Serial.print("<<");
                      		char buf[4];
                      		for (uint8_t a=0; a<inputSize; a++) { sprintf(buf,"%02X ", (uint8_t)inputString[a]); Serial.print(buf); } Serial.println("");
                      #endif
                      		gw.processMQTTMessage(inputString, inputSize);
                      	} else {
                                if ((micros() - resetCounter) >= 100000000 && !client.connected() && !rebootAborted) {
                                    rebootAborted = 1;
                                    Serial.println("Rebooting");
                                    pinMode(3,OUTPUT);
                                    digitalWrite(3,HIGH);
                                    delay(100);
                                    digitalWrite(3,LOW);
                                }
                             }
                      }
                      
                      1 Reply Last reply
                      0
                      • pit007P Offline
                        pit007P Offline
                        pit007
                        wrote on last edited by pit007
                        #23

                        Yes - noooo :-) Right - you are able to detect the connection loss (good to know) but why do you not trigger the NE555, but to re-init the ENC28. Have you try if it response via SPI ?

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

                          It completely locks up.. I tried to talk with at the same point but it doesn't seem to listen to anything

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


                          12

                          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
                          • MySensors
                          • OpenHardware.io
                          • Categories
                          • Recent
                          • Tags
                          • Popular