Connecting Arduino Ethernet shield to main board

Ethernet Arduino shield

Contents:

How to solve: “Sorry, can’t run without hardware.”

Written by: Julio Gonzalez-Saenz
E-mail: julio.gonzalez@seanasol.org
Date: 20 July 2020

This tip will help Arduino developers to resolve a problem with the Arduino Ethernet shield when the main board is not able to recognise the Ethernet hardware. The tip can be applied only if the lights on the Ethernet board and on the RJ-45 connector are OK.



Introduction

When using shields for Arduino, the instructions to connect them to the Arduino’s board are straightforward. The instructions would read as follows: “just plug the module onto the Arduino board”, as shown in Fig. 1, (in the example below we use the Ethernet shield, but it can be any shield), then connect the module to your network through a cable, either to a router, a switch, an IoT Gateway, etc. Finally, follow a few simple instructions to start controlling your Arduino-based project.

When everything is working properly and the board and the shield do not present any issue, then the above instructions are valid. However, there are occasions when we encounter problems whereby the two boards cannot connect. Although it is common to find the solution on the web, this article will document an issue for which the solution was not available on the internet. After a couple or hours of troubleshooting, we were able to find a solution to the problem. Here, we hope to help the Arduino developer to solve similar problems.

missing Arduino Picture missing Arduino Picture
Figure 1.a. Pins (green boxes) on Ethernet shield board plugged into Arduino board.
missing Arduino Picture
Figure 1.b. Ethernet shield board plugged into Arduino board.

Go to top

Description of the problem

When trying to run a basic Ethernet program you do not get the IP address that was defined in the sketch or get the following message via the serial console of Arduino’s IDE:

17:05:12.038 -> ENTER AT Commands:
17:05:12.073 -> Initialize Ethernet with DHCP:
17:05:12.622 -> Failed to configure Ethernet using DHCP
17:05:12.658 -> Ethernet shield was not found.  Sorry, can't run without hardware. :(

A quick search for a solution on the Internet and you will find an extensive list of possible problems with its respective solution. The most common “suggestions” are:

  • Ethernet cable is not working and the link is not ON
  • Use the latest Ethernet library (which at the time of this writing was 2.0.0)
  • The Ethernet library included with the Arduino IDE only supports W5100 chip
  • The router does not support DHCP
  • The switch does not store the MAC address
  • Most modern networking equipment only supports 100/1000MBs, so the shield just won’t work with the router if the shield does not support 100MBs
  • Use WireShark (https://www.wireshark.org) to try to discover the problem
After trying all these suggestions, the problem persisted. The Ethernet shield still could not communicate with the Arduino board.

Go to top

Simple test sketch

In order to investigate the problem further, you will need to compile and upload the following simple sketch that test whether or not the serial interface is running and whether or not the 192.168.2.2 IP address was properly assigned to the board. It does not matter if the router is connected, if the speed is supported, or if the cable is good or bad. This simple program will only exercise the internal hardware of the Ethernet shield.

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,2,2);

void setup() {
 Serial.begin(9600);
 // disable SD card by bringing pin 4 high
 pinMode(4,OUTPUT);
 digitalWrite(4,HIGH);
 Serial.println("Starting w5100");
 Ethernet.begin(mac,ip);
 Serial.println(Ethernet.localIP());
}

void loop() {
}

After compiling the sketch and downloading it into the Arduino board, start the Serial monitor via the tools menu: tools → Serial Monitor.

On the screen, you should see the following two lines:

Starting w5100
92.168.2.2
However, I assume because you are at this line, you will see the following output:
Starting w5100
0.0.0.0
Go to top

Lights in the shield

The tip provided in this article can be applied only if the light on the shield and on the RJ-45 connector are OK. The correct lights on the RJ-45 connector are shown in Figure 2. The correct lights on the Ethernet shield are shown in the Figure 3.
missing Arduino Picture
Figure 2. Picture of wired lights on Ethernet shield (green→steady; orange→flashing).
missing Arduino Picture
Figure 3. Picture of wired lights on Ethernet shield.
Go to top

Wire the pins of the shield

Before trying the solution explained in this article, you will need to wire the pins from the Ethernet shield to the Arduino board as shown in Figure 4. The usable pins are: 3.3V, 5V, GRD, 10,11,12,13 and the 6 outputs from the ICSP. Run the program again, either by pressing the reset button or uploading it again or just returning to the serial screen, now you should see the following message:

Starting w5100
92.168.2.2
If you can see the above message with the correct IP address printed out, then the problem is that the pins of the shield were too long and they prevented the ICSP pins from the Arduino’s board to make a good contact, therefore the Arduino main board did not recognise that the Ethernet shield was there. However, notice that this is true, only if the lights on the shield and on the connector are ON, as shown in Figures 2 and 3. If you do not see that these lights are properly flashing, then the issue might be different.

missing Arduino Picture
Figure 4. Picture of wired Ethernet shield to Arduino board.

Go to top

Solution

The simplest solution to the problem is to use a wire cutter (see Figure 5) and cut about 1 mm of every pin of the Ethernet shield. After the cutting, connect the Ethernet shield again, and run the program. If the shield still does not work, as confirmed by running the program again, repeat the operation once again by removing an extra 1 mm of every pin.

Warning

Cutting too much of the pins will ruin the board, because the outside cover of the RJ-45 and the Arduino USB plug will short-circuit the shield. To avoid this situation, keep watching the GAP (see figure 1.a for a description) between the two boards and use your criteria for when to stop.



missing Arduino Picture
Figure 5. Example of the wire cutter that can be used to cut the pins of the board.

Further tips

Please let us know (Technical Support) if you find something that was hard to fix and we will be happy to add them in our Academy Articles.
Go to top

Start a Discussion

%d bloggers like this: