hello friends I have a problem related to the ethernet shield
I use library blynk v0.3.8
constantly waiting for that
[0] Blynk v0.3.8 on Arduino Uno
[0] Getting IP…
[60460] DHCP Failed!
[0] Blynk v0.3.8 on Arduino Uno
[0] Getting IP…
[60460] DHCP Failed!
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include <SPI.h> #include <Ethernet.h> #include <BlynkSimpleEthernet.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth = “9620*****************4bd9d88”;
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
// You can also specify server.
// For more options, see BoardsAndShields/Arduino_Ethernet_Manual example //Blynk.begin(auth, “your_server.com”, 8442); //Blynk.begin(auth, IPAddress(192,168,1,100), 8888);
}
Hi guys, @krzyspx I faced thesame issue with thesame board hunrun 16/02 but i got the solution for this problem.
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xA2, 0xBE, 0xEF, 0xAE, 0xAB
};
IPAddress ip(192, 168, 1, 99);
byte gateway[] = { 192, 168, 1, 1 };
// the subnet:
byte subnet[] = { 255, 255, 255, 0 };
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);
void setup() {
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Serial.print("Use the I.P to open this from web Browser para ma test ang Net module ");
Serial.println(Ethernet.localIP());
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("<p>Ethernet Module is Working fine! Network Module is Ready to accept project sketch... Net Test By Castle Marc*****</p>");
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
// close the connection:
client.stop();
Serial.println("client disconnected");
}
}
try to load the sketch above then type your ethernet shield i.p to your net broser and you should see some message. if not follow steps below.
1.) Replace your LAN cable.
2.) make sure your network switch or router port is 8 pins available. normmaly for dlindk 4 port or 8 port switch you can see the 8 pins leads,
but for other common brand like TP-link and other generic network switch no will notice that there are 4 pin leads only inside the port.
3.) Ping your ethernet shield if you able to communicate after 1 & 2 steps is verified.
Hope this can help. mine is solved i got 4 netwis5100 all of them or showing DHCP failed!!! but now. all up in running…
Hi guys, @krzyspx I faced thesame issue with thesame board hunrun 16/02 but i got the solution for this problem.
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xA2, 0xBE, 0xEF, 0xAE, 0xAB
};
IPAddress ip(192, 168, 1, 99);
byte gateway[] = { 192, 168, 1, 1 };
// the subnet:
byte subnet[] = { 255, 255, 255, 0 };
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);
void setup() {
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Serial.print("Use the I.P to open this from web Browser para ma test ang Net module ");
Serial.println(Ethernet.localIP());
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("<p>Ethernet Module is Working fine! Network Module is Ready to accept project sketch... Net Test By Castle Marc*****</p>");
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
// close the connection:
client.stop();
Serial.println("client disconnected");
}
}
try to load the sketch above then type your ethernet shield i.p to your net broser and you should see some message. if not follow steps below.
1.) Replace your LAN cable.
2.) make sure your network switch or router port is 8 pins available. normmaly for dlindk 4 port or 8 port switch you can see the 8 pins leads,
but for other common brand like TP-link and other generic network switch no will notice that there are 4 pin leads only inside the port.
3.) Ping your ethernet shield if you able to communicate after 1 & 2 steps is verified.
Hope this can help. mine is solved i got 4 netwis5100 all of them or showing DHCP failed!!! but now. all up in running…
Little side note, since the port is 10 mbit it’s useless to have the 8 pins. The 4 pins for 100mbit full duplex are more than enough to get connectivity. There is probably not a single vendor which doesn’t adhere to cat6 standards, so everything should be 8 wires.
The LAN cable tip is a very good one though!
Setting a fixed IP is not a solution if you ask me. It’ll only make things worse when you are troubleshooting later. The mission is to solve the problem.
Resetting a router might help, updating the firmware on your router.
And last tip, change the MAC address of the device via the sketch! Some devices and/or routers can get really wonky when they see the same MAC on two or more ports.
@tariktumanbay is your DHCP still not solved? Please update. I think it is solve because your not posting any comments any more , LOL… Enjoys Guys… Happy Blynking…