Arduino UNO ENC28J60 works, other Arduino UNO doesn't (same code, same adapter)

Hello,

I’m fairly new to Arduinos and Blynk and still learning.

I have three Arduinos UNOs. One clone I ordered from Amazon and two identical clones from Aliexpress. I set up the Amazon clone with Blynk and an ENC28J60 Ethernet adapter. This combo has been working really reliably. To run some experiments, I flashed a slightly different code on one of the Aliexpress clones and connected it with the ENC28J60 adapter from the Amazon clone.

When I noticed that I couldn’t get a working connection with the Aliexpress clone, I decided to flash the exact same code on both boards. The result is that the Amazon Arduino works like a charm and DHCP always fails on the Aliexpress board, so I can’t establish a connection with it.

My first idea was that both Arduinos could use the same MAC adress, so I tried to set it manually on the Aliexpress clone with:

byte arduino_mac [] = {0xDE, 0xED, 0xFE, 0xBA, 0xAE, 0xEF};
Blynk.begin (auth, "blynk-cloud.com ", 8442, arduino_mac);

This didn’t change anything, unfortunately.

I also tried different auth keys for both boards, which didn’t make a difference, either. The Amazon clone works fine with both keys, while the Aliexpress clone doesn’t work with either keys.

I always used the same wiring (SI to 11, CS to 10, SCK to 13, SO to 12, GND to GND, VCC to 3.3V) and the same ENC28J60 adapter (the only ethernet adapter I own). Both Aliexpress boards behave identically. My library version is 0.5.3 and I have the Android app.

I would really appreciate your help!

I would normally suspect that there is something wrong with the Aliexpress boards, but the fact that both Aliexpress boards behave the same way makes it unlikely (the offer has 4100 orders and 4.9 stars).

Here is the code I flashed on both boards:

#define BLYNK_PRINT Serial
#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>

unsigned long blink_timer = millis(); 
unsigned long lcd_timer = millis(); // refresh rate for virtual lcd screen
int status_led = A2;
int analogValue = 0; // light sensor value
int lightsensor = A5; // light sensor pin
boolean led_on = false; // led status
char auth[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // same auth key on both boards

WidgetLCD lcd(V7);

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);
  pinMode(status_led, OUTPUT);
  WidgetLED led1(V1);
  digitalWrite(0, HIGH); // relay 1
  digitalWrite(2, HIGH); // relay 2
  digitalWrite(3, HIGH); // relay 3
  digitalWrite(4, HIGH); // relay 4
  
}

void loop()
{
  Blynk.run();
  if (((millis() - blink_timer) >= 500) && led_on == false){
    digitalWrite(status_led, HIGH);
    Blynk.virtualWrite(V1, 1023);
    blink_timer = millis();
    led_on = true;
  }
  if (((millis() - blink_timer) >= 500) && led_on == true) {
    digitalWrite(status_led, LOW);
    Blynk.virtualWrite(V1, 0);
    blink_timer = millis();
    led_on = false;
  }
  if ((millis() - lcd_timer) >= 250){
    lcd.clear();
    lcd.print(0, 0, analogRead(A5));
    lcd_timer = millis();
  }
}

Serial Monitor Amazon Arduino:

[0] Getting IP...
[5334] IP:192.168.178.21
[5335] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.5.3 on Arduino Uno

  Give Blynk a Github star! => https://github.com/blynkkk/blynk-library

[5531] Connecting to blynk-cloud.com:80
[6107] Ready (ping: 44ms).

Serial Monitor Aliexpress clone:

[0] Getting IP...
[60336] DHCP Failed!
[1] Getting IP...
[60270] DHCP Failed!
[0] Getting IP...
[60334] DHCP Failed!
[1] Getting IP...
[60338] DHCP Failed!

The Ethernet shields for Arduino are notoriously flaky, and I’d be surprised if the board you’re using is much different.
From what I can gather, the issues are mostly about timing at boot time. If you google the problem with the Uno shields you’ll find lots of info, including some threads on this site. There’s also an issue with some types of router/switch not working with the Uno shields, which is another variable to consider.

My guess is that although your two types of UNO clones are similar, there will be slight differences and most probably one boots slightly faster/differently to the other, which is causing the timing issue with your Ethernet adaptor.
Another possibility is your power supply or the voltage regulators on the boards that aren’t working with your Ethernet adaptor. You ought to try a separate power supply for the Ethernet adaptor to rule out a power issue.

I used Arduino UNOs and Mega’s with Ethernet shields when I first started looking at home automation, but the flakyness meant that I quickly abandoned the Arduinos in favour of ESP8266/NodeMCU devices like the Wemos D1 Mini.

Pete.

Thank you for your reply, Pete.

I think a power issue is most likely at this point. When I power the ethernet adapter from the working Arduino and connect the data wires to the Aliexpress board, the ethernet connection works fine. What I also noticed is that measuring the current that flows to the adapter while it’s attached to the Aliexpress Arduino with my multimeter seems to address the issue as well. I have no explanation for this. What’s also weird is that the adapter draws slightly more current from the Aliexpress board (121,6 milliamp) vs. the Amazon board (114,2 milliamp). I’ll do more testing, but I’m pretty confident the voltage regulators must be at fault. Maybe I’ll try to get a 5V ethernet adapter for this board.

I would love to switch to a different device with more flash. Unfortunately, I haven’t been able to find any devices with Ethernet (which is a requirement for me) and decent community support besides the Raspberry Pi, which is a bit pricey for the kind of stuff I want to do. Any suggestions?

Okay, it does sound like a power issue.
It might be worth running one of the standard sketches that read the Uno fuse settings and display the results - to compare if they’re the same for both types of device.

Is there no possibility of setting-up a small Wi-Fi network to connect NodeMCU devices to your Ethernet via a wireless access point?

Pete.

I just tried the reverse and let the cheap clones power the Ethernet adapter for the Amazon board. The result is that DHCP fails this way. This pretty much proves that it must be a power issue.

I used avrdude to read the fuse settings. I’m not sure if I did it correctly. Please let me know how to do it if I made a mistake.

Amazon board as ISP:

Aliexpress board as ISP:

Both boards are using the default voltage fuse settings, so that’s not where the differences lie.

I’d say that it’s probably just a design/manufacturing tolerance issue with the two types of board, rather than dodgy voltage regulators on the boards that aren’t able to power your Ethernet adapter. Your working Uno is probably operating at the limit of its abilities and you’ll probably experience Ethernet dropouts and early failure of the regulator on that board if you were to use it to power your Ethernet adapter.

Pete.

What is the maximum current the voltage regulators of the Uno can supply long-term? Aren’t they made to power an Ethernet adapter?
Are the W5100 or W5500 modules powered with 5V? I found conflicting information about this.
Is there any difference between the W5100 + W5500 Ethernet modules and the Ethernet shields regarding Blynk compatibility or are they essentially the same?

Another thing that bothers me about the ENC28J60 is that it gets really hot. I can sometimes barely touch it.

Thank you, Pete!

http://robotics.lib-ieronimoub.gr/?p=715

Pete.