Hi all. I can't configure the mDNS name for Arduino UNO with W5100 shield. Here is a short sketch in which the board receives an IP address via DHCP and must assign an mDNS name. I receive the address, but the name, although it says that it has been assigned, does not respond. At the same time, I have the Bonjour service configured on my PC and the ESP8266/32 normally receives the mDNS name and pings using it.
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <ArduinoMDNS.h>
// Мак-adress Arduino Ethernet Shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetUDP udp;
MDNS mdns(udp);
void setup() {
Serial.begin(74880);
// Initial Ethernet Initialization
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
while (true);
}
// Displaying information about the assigned IP address in Serial Monitor
Serial.print("Assigned IP address: ");
Serial.println(Ethernet.localIP());
// Assigning the name "ardo" using mDNS
if (!mdns.begin(Ethernet.localIP(),"ardo")) {
Serial.println("Error setting up MDNS responder!");
} else {
Serial.println("MDNS responder started");
}
}
void loop() {
//
}
In this case, I can ping the board at the address that it receives via DHCP. But I need to be able to ping by the name that I specified here.
I found one error. It turns out that you need to run in a loop
void loop() {
mdns.run();
}
But another problem appeared. when I connect the board using a power supply (5v 1a), on my Mikrotik I see how the board connects and then disappears. Rebooting doesn't help. Resetting with the reset button on the board and on the shield also does not help.
After that, if I connect the board using a power supply, without a USB cable, then at first nothing happens, nothing changes. But I tried to reset the reset button on the Arduino Uno board and the board received an address and began to ping by name. But after the address rental time has expired, it disappears from the list in Mikrotik, although it continues to ping both by name and address. In principle, the same situation is observed if the board is connected to a PC via a USB cable and is powered from it. I’m not very knowledgeable about Arduino and microelectronics, but I assume that the issue is with the board’s power supply, or rather with its distribution/switching.
Can someone tell me, perhaps I need to short-circuit some contacts on the board or load/disable some additional pins?