Problem in getting online through ENC28J60 via UNO

I am also facing problem in getting online through ENC28J60 via UNO. i don’t have a router so i am sharing my PC wifi via LAN. It says
[0] Blynk v0.4.0 on Arduino Mega
[0] Using static IP
[1051] IP:192.168.1.27
[5001] Connecting to blynk-cloud.com:8442
[20058] Connecting to blynk-cloud.com:8442
[35116] Connecting to blynk-cloud.com:8442

Could be how it is wired up to the UNO? Or just a glitchy shield/adapter… seems difficult to find a reliable Ethernet shield/adapters for Arduinos.

This also sounds like it could be a factor… the shared internet connection may not be routing to the shield/adapter properly?

Since you are tethered to the PC anyhow, try using the USB link option:

http://help.blynk.cc/hardware-and-libraries/arduino/usb-serial

I never had any big problems with the ENC, it works really well. Did you solder all connections or are you using a breadboard? I’d highly recommend soldering and using an external powersupply for the ENC. They can be a bit power hungry, like wifi.

Further more I would recommend upgrading your Blynk library to the latest version (0.4.7).

this is the code i am using and i am not using any shield . i am using hanrun 911105a ethernet module. i am trying to connect it to blynk cloud

    #define BLYNK_PRINT Serial
    #include <SPI.h>
    #include <UIPEthernet.h>
    #include <BlynkSimpleEthernet.h>
    char auth[] = "16**************************7f69";    // Write your Blynk project key here
    WidgetLED led1(V1);   // Virtual LED to show status on App
    WidgetLED led2(V2);
    WidgetLED led3(V3);
    int sensor1 = 2;      // IR Sensors
    int sensor2 = 3;
    int sensor3 = 4;
    //byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
    //IPAddress arduino_ip ( 192,   168,   43,  168);
    //IPAddress dns_ip     (  192,   168,   43,   1);
    //IPAddress gateway_ip ( 192,   168,   43,   1);
    //IPAddress subnet_mask(255, 255, 255,   0);


void setup()
{
  Serial.begin(9600);
 // Blynk.begin(auth, "arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac");
 Blynk.begin(auth);         // Starting Blynk server and connecting to the cloud
  
  pinMode(sensor3,INPUT);    // Setting sensors to input
  
  pinMode(sensor2,INPUT);
  
  pinMode(sensor1,INPUT);

  while (Blynk.connect() == false) {
    // Wait until connected
  }
}
 void loop() {  
   int sensorval1 = digitalRead(sensor1); // Saving Values os sensors
   int sensorval2 = digitalRead(sensor2);
   int sensorval3 = digitalRead(sensor3);
   Serial.println(sensorval1);            // printing values 
   Serial.println(sensorval2);
   Serial.println(sensorval3);
   delay(1000);
   if (sensorval1 == 1)
   {
led1.on(); // Setting virtual led on the app
Serial.print("on");}
   if (sensorval2 == 1)
   {
led2.on();
}
   if (sensorval3 == 1)
   {

led3.on();}
    if (sensorval1 == 0)
   {

led1.off();
}
   if (sensorval2 == 0)
   {
led2.off();
}
   if (sensorval3 == 0)
   {
led3.off();
}   
    
    Blynk.run();
    
     }`Preformatted text`

@Raam_Mishra edit your last post so the code is formatted for forum use.

Remove everything from loop() except Blynk.run(). Study Blynk Timer if you want to call functions at regular intervals.

When I use the ENC I have all your uncommented lines included i.e. MAC. gateway etc.

i have commented them because i thought they are used in local server. how i am supposed to give ip address to arduino ,when it is always changing.

They are needed to connect to your router.

Also revise setup() to:

 Blynk.begin(auth, "arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac");
 //Blynk.begin(auth);         // Starting Blynk server and connecting to the cloud

I am not using any router. My PC is connected to Internet through Wi-Fi. I am simply sharing my PC’s ethernet connection with the ethernet module. Now everytime when I am connected to Internet, I get different IP because of DHCP, so how am I supposed to give an IP to Arduino when I don’t even the Network address,DNS and SERVER IP.

I would say 99% of the time WiFi involves a router.

Do you mean WiFi or 3G / 4G or something else? Be very specific if you need assistance.

The code that you have commented out actually sets a fixed local IP for your Uno.

yes,Wi-Fi involves router, but I don’t have access to that router.

OK so you are trying to share your PC’s LAN connection.

Does the PC’s LAN connection have internet access or does the PC just have internet access via a WiFi connection to an inaccessible router?

Are you just trying to hook up an Ethernet cable between the ENC and the PC as normally you would need a cross-over cable to do this?

Have you upgraded your libraries to 0.4.7 now?

Shield or adapter, same thing, different mounting :wink: and (trap for new players) the Hanrun 911105a refers only to the RJ45 connector, not the rest of the adapter. http://www.kosmodrom.com.ua/pdf/HR911105A.pdf

by uncommenting the IP address and supplying a static one… might be a bit tricky when running a PC shared internet connection though.

As I stated earlier, if you are going to be tethered to your PC anyhow, then instead of trying to figure out a PC shared internet connection, static IP, etc. Just use the USB for now until you can get a proper WiFi router.

Now its working but it is getting logged out.

[71[0] Getting IP...
[1285] IP:192.168.137.176
[1286] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.7 on Arduino Uno

[5001] Connecting to blynk-cloud.com:8442
[6174] Ready (ping: 536ms).
[22232] Heartbeat timeout
[25233] Connecting to blynk-cloud.com:8442
[28381] Login timeout

You are making progress. Comment everything out of loop() except Blynk.run() and hopefully you will be connected indefinitely. This should tell you where your problem is.