Community discussions

MikroTik App
 
User avatar
Sky18
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Sat Jan 13, 2018 9:21 am
Location: Germany

Arduino ETHERNET Shield 2 looses connection within few minutes

Sun Nov 06, 2022 8:14 pm

Hi,

I have an Arduino Uno with an Arduino ETHERNET Shield 2 on top.
When I connect this to my MikroTik Routerboard RouterBOARD 750G r3 the Arduino looses its IP address within few minutes.
Also then cannot ping the Arduino anymore.

When I connect the Arduino to my FritzBox 7590, no issues. Connection ist stable since 24hours...

So my guess is that I have to change something in my MikroTik Router config to keep the connection alive without time limitation.

Your help is very appreciated.

Thanks, Tom
 
[b]Arduino code snippet[/b]

#include <SPI.h>
#include <Ethernet.h>

// MAC address (printed on a sticker on the shield)
byte mac[] = {0xA8, 0x61, 0x0A, 0xAE, 0x96, 0xA7};
IPAddress ip(192, 168, 176, 170);

void setup()
{
     ....
     Ethernet.begin(mac, ip);
     ....
     #ifdef DEBUG
       Serial.println(" Server IP:" + DisplayMyIpAaddress(Ethernet.localIP()));  [u]// for few minutes correct IP address is printed, then 0.0.0.0[/u]
    #endif 
}

void loop()
{
   ...
   Ethernet.maintain();
   ...
}
 
 
sindy
Forum Guru
Forum Guru
Posts: 10205
Joined: Mon Dec 04, 2017 9:19 pm

Re: Arduino ETHERNET Shield 2 looses connection within few minutes

Sun Nov 06, 2022 9:30 pm

While most DHCP clients calculate the renewal time based on the lease time, some apparently want it explictly stated (sniffing the initial DHCP conversation and opening it in Wireshark would be helpful). So try this suggestion.
 
User avatar
Sky18
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Sat Jan 13, 2018 9:21 am
Location: Germany

Re: Arduino ETHERNET Shield 2 looses connection within few minutes

Mon Nov 07, 2022 1:04 pm

Thanks @sindy.

Behavior is improved after the config updates mentioned in the post you referred to.
As long as I do not contact the Arduino via http, connection is stable for at least one hour (assuming longer, but not tested by now).

But when I connect the Arduino via http (http://192.168.177.170:666) to request data, just after a couple of http client connecions the IP address/connection is lost again.

Arduino connected to the FritzBox: hundreds of http request don't end into a connection issue.

So I am still guessing some additional MikroTik configuration is needed...

Server IP:2863769792
Server IP:192.168.177.170
reading 10000 samples ...
waiting for first period
starting...
0 1023 49.998 - Server IP:192.168.177.170
0 1023 49.994 - Server IP:192.168.177.170
0 1023 49.989 - Server IP:192.168.177.170
0 1023 49.995 - Server IP:192.168.177.170
0 1023 49.994 - Server IP:192.168.177.170
0 1023 49.995 - Server IP:192.168.177.170
New json client
Sending: {"analog":[496,420,990,1023,589,439],"digital":[1,0,0,0,1,0,0,0,0,0,1,1,0,0]}
... Sent json port disconnected.
0 1023 27.174 - Server IP:192.168.177.170
New json client
Sending: {"analog":[492,419,990,1023,636,474],"digital":[1,0,0,0,1,0,0,0,0,0,1,1,0,0]}
... Sent json port disconnected.
0 1023 30.485 - Server IP:192.168.177.170
0 1023 49.994 - Server IP:192.168.177.170
0 1023 49.990 - Server IP:192.168.177.170
0 1023 49.991 - Server IP:192.168.177.170
New json client
Sending: {"analog":[490,415,990,1023,610,452],"digital":[1,0,0,0,1,0,0,0,0,0,1,1,0,0]}
... Sent json port disconnected.
0 1023 30.485 - Server IP:192.168.177.170
New json client
Sending: {"analog":[491,419,990,1023,654,489],"digital":[1,0,0,0,1,0,0,0,0,0,1,1,0,0]}
... Sent json port disconnected.
0 1023 30.484 - Server IP:0.0.0.0
0 1023 49.985 - Server IP:0.0.0.0
0 1023 49.983 - Server IP:0.0.0.0
0 1023 49.985 - Server IP:0.0.0.0
0 1023 49.980 - Server IP:0.0.0.0
0 1023 49.981 - Server IP:0.0.0.0
0 1023 49.983 - Server IP:0.0.0.0


While most DHCP clients calculate the renewal time based on the lease time, some apparently want it explictly stated (sniffing the initial DHCP conversation and opening it in Wireshark would be helpful). So try this suggestion.
 
vzfogy
just joined
Posts: 1
Joined: Sat Jan 09, 2021 1:40 pm

Re: Arduino ETHERNET Shield 2 looses connection within few minutes

Sat Dec 10, 2022 7:27 pm

Turn of "Auto Negotation" in mikrotik .. Inerfaces- ether2 ( is where is your ethenet shield connected )- Auto Negotation 8)

Who is online

Users browsing this forum: BinaryTB, Bing [Bot], rplant and 71 guests