Initial Configuration of the Ethernet Shield Arduino Uno

details

This is very good tutorials for whom will start the Arduino and Ethernet Shield

In this article, we can see the ease with which you can configure an Ethernet shield, assemble it with an Arduino Uno and connect it to a router, then verifying proper operation.

arduino_ethernet

Key features of the Ethernet card

  • Supply voltage 5V DC.
  • To operate must be installed above the Arduino Uno, we will see later in the article how.
  • It has an Ethernet controller W5100 with 16k internal memory buffer
  • Connection speed ranging from 10 to 100 mb
  • It must be connected directly with the SPI port of Arduino.
  • It has a slot for SD card.

These are the main features, but for more information, you can see the considerable documentation that already exists here, where we start from the hardware to the final program. The following is the image of the Ethernet Shield.

Ethernet Shield

Ethernet

How to connect Ethernet shield on the Arduino Uno

To connect the Ethernet card and very simple, as you can see in the following pictures, just overlay the Arduino Uno, being careful not to bend or damage the pins. You will see that you replicate the network adapter, all links of the Arduino Uno, then inputs PWM, Analog inputs, inputs of transmission and reception, the output voltage of 5v and zero volts to power the circuits and external components and finally the reset button that will perform the reset, both of the Ethernet card that the Arduino board as in the following:

The two boards after assembly

Arduino Uno Ethernet Shield right and left before being assembled.

two boards

The two boards after assembly. As you can see, the assembly is simple. As you have seen be careful not to damage the pins of the Ethernet card.

Configuration for Internet access

We are past the assembly stage, it’s time to configure the adapter so that it can connect to the internet. First we must connect the Arduino Uno to a power supply, or with the power supply that provides an output voltage of 5V DC and at least 2 ampere, or attaching it directly to the PC through a USB port, providing a voltage necessary for the operation of the card. We must have an Ethernet cable with RJ45 connector, to be connected to the router that will be the gateway. Now we start the Arduino IDE and create a new sketch of code called “EthernetTest” as shown and we execute a project save.

The new project EthernetTest
The new project EthernetTest.

Now for part of the code. The first thing to do after you create and save the file sketch is to include the necessary libraries to use the Ethernet Shield, exactly SPI.h and Ethernet.h.

// Importo le librerie Ethernet
#include <SPI.h>
#include <Ethernet.h>

Find these libraries from the menu Sketch -> Include Library -> Ethernet. You will find that more libraries will be added, but we can have a look the two mentioned above.

Adding libraries SPI
Adding libraries SPI and Ethernet.h on project.

Now that the necessary libraries have been added, we can start using them. First we need to define a Media Access Control (MAC) address. It is a unique address for each device that is usually issued by the manufacturer of the network card necessary to identify the device, in our case the Ethernet Shield case if there were more than one. If you do not have this address, we can safely create one, taking care to enter the letter “x” after the first number, because it is an address in hexadecimal numbers. We will enter the MAC address below.

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // MAC address

We define a data type with byte length of six elements, representing the MAC address of the network card. We can still define an Internet Protocol (IP) address. Also in this case it is a unique address that identifies a device in a host network. This step is optional and can directly assign the router an IP address automatically to the Ethernet Shield, this means the DHCP service. The last thing to do and implement the begin() method, passing as arguments the array values mac[], whereas for the IP address of the router will assign one dynamically. We have everything you need to configure the network card, it just must implement the methods setup() and loop(). We insert inside the initialization of the serial port, so you can see on the serial monitor the connection status.

From the full contents, you can understand how you can start the Ethernet shield step by step and get all source code. Please click here

http://www.c-sharpcorner.com/UploadFile/2651a2/initial-configuration-of-the-ethernet-shield-arduino-uno/

 

COMMENTS

Please Login to comment
  Subscribe  
Notify of