As the title says, I have an Arduino Uno Rev3 connected to an Mini Ethernet module ENC28J60.
Using the example Files > Examples > Blynk > Boards_Ethernet > ENC28J60
from the Blynk library version 1.0.1 by Volodymyr Shymanskyy I can’t succeed connecting it to internet. The wires were checked for continuity, the pinout used is the one in the example:
Typical wiring would be:
VCC -- 5V
GND -- GND
CS -- D10
SI -- D11
SCK -- D13
SO -- D12
INT -- D2
The code I use (I’ve read somewhere that I can comment Blynk.run()
until it connects):
#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>
char auth[] = "my_key";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
//Blynk.begin(auth, "blynk-cloud.com", 80);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8080);
}
void loop()
{
//Blynk.run();
}
The output:
[0] Getting IP...
[60218] DHCP Failed!
[1] Getting IP...
The Ethernet wire works because when I connect my PC via ethernet it works, I can navigate on the internet.
I also tried to use the “manual” connection to internet as another example exists in this sense. The code used and my settings:
#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL-G0tCsqY"
#define BLYNK_DEVICE_NAME "D"
#define BLYNK_DEFAULT_PORT 80
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
char auth[] = "my_key";
IPAddress server_ip (192,168,10,20);
byte arduino_mac[] = { 0x43, 0x44, 0xB2, 0x07, 0xF8, 0x26};
IPAddress arduino_ip ( 192, 168, 100, 254);
IPAddress dns_ip (192,168,100,1);
IPAddress gateway_ip (192,168,1,1);
IPAddress subnet_mask(255, 255, 255, 0);
void setup()
{
Serial.begin(9600);
//Blynk.begin(auth, server_ip, 8080, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
// Or like this:
Blynk.begin(auth, "blynk-cloud.com", 80, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
}
void loop()
{
//Blynk.run();
}
The output
[0] Using static IP
[1580] IP:5.0.0.0
[1581]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v1.0.1 on Arduino Uno
[1692] Connecting to blynk-cloud.com:80
I want to connect the device via router. My router specs:
IPv4 Address. . . . . . . . . . . : 192.168.100.4(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.100.1
DHCP Server . . . . . . . . . . . : 192.168.100.1
I want to mention that for the second example I need to add Ethernet-master.zip library (because it doesn’t work only with Blynk) and for the first example I need to use UIPEthernet-master.zip. Also when I ping the Blynk cloud server I get the response from my computer.