W5200 Ethernet Shield Instruction
This instruction shows you how to use DFRobot W5200 Ethernet Shield in Arduino IDE, taking UNO as an example.
Hardware Preparation
- DFRduino UNO R3 (or similar) x 1
- Ethernet Shield for Arduino - W5200 x1
- USB Cable for Arduino UNO/Mega x1
- Ethernet Cable x1
Hardware Connection
- Plug W5200 shield onto Arduino UNO board.
- Use a Ethernet cable to connect W5200 Shield's RJ45 port to a computer's Ethernet interface or router's LAN port that is in same local network.
- Connect UNO board with the computer via a USB cable.
Download W5200 Library
- Download "W5200 library" provided by Wiznet.
- Unzip the downloaded file"Ethernet-mater.zip" to the libraries folder in Arduino installing catalogue. As shown below:
WebServer Sample Revising
- Find and open the unzipped files sample program "WebServer.ino".
- Open "WebServer.ino" in Arduino IDE, and add code in the program to define the IO connection between W5200 shield and UNO (For other mainboards, please revise according to actual IO connection), create a W5200 shield init function "DF_W5200_Init" and place it in setup for calling.
#define W5200_nSCS 10
#define W5200_nRST 8
#define W5200_PWDN 9
#define W5200_nINT 3 //unused
void DF_W5200_Init(void)
{
pinMode(W5200_nSCS,OUTPUT);
pinMode(W5200_nRST,OUTPUT);
pinMode(W5200_PWDN,OUTPUT);
pinMode(W5200_nINT,INPUT); //unused
digitalWrite(W5200_PWDN,LOW); //Normal Mode Enable
digitalWrite(W5200_nRST,LOW); //Hardware reset
delay(10);
digitalWrite(W5200_nRST,HIGH);
delay(200);
Ethernet.init(W5200_nSCS);
}
- Revise IP address (please make sure that the modified IP address is in the same network segment as the computer and is not occupied by other devices.). For example, set W5200 shield IP as: 20.20.1.177, then the codes should be revised as below:
- Burn the program to UNO.
Test and Check
Open a browser and enter the IP address set for w5200 in Arduino code.
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.