Ks0156 keyestudio W5100 Ethernet Shield: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
No edit summary
 
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
==keyestudio W5100 Ethernet Shield==
[[image:ks0156.png|thumb|500px|right|Keyestudio W5100 Ethernet Shield]]
<br>[[File:ks0156.png|500px|frameless|thumb]]<br>
<br>
==Introduction==
keyestudio W5100 Ethernet Shield gives you an easy way to get your Arduino Online. It can turn your Arduino into a simple web server or use the Internet to read /write its digital and analog outputs/inputs. <br>
Compatible with the UNO R3 board and Mega 2560 R3.<br>
It is directly supported by Arduino official Ethernet Library. It also supports the read &write of mini SD card (TF card). <br>
The shield adopts stackable design. You can directly plug it to Arduino board or plug other shields onto this Ethernet shield. . <br>


==Introduction==
<span style=color:red>Note: its MAC address is random. You can set MAC address in the code.<br>
keyestudio W5100 Ethernet Shield gives you an easy way to get your Arduino Online. It can turn your Arduino into a simple web server or use the Internet to read /write its digital and analog outputs/inputs. It is directly supported by Arduino official Ethernet Library. It also supports the read &write of mini SD card (TF card). The shield adopts stackable design. You can directly plug it to Arduino board. It’s also compatible with our other shields. <br>


<br>


==Specification==
==Features==
* Compatible with Arduino Mega2560/Uno R3
* Compatible with [http://wiki.keyestudio.com/index.php/Ks0001_keyestudio_UNO_R3_BOARD  UNO R3 ] and [http://wiki.keyestudio.com/index.php/Ks0002_keyestudio_Mega_2560_R3_Development_Board  MEGA 2560 control board].
* Adds a micro-SD card slot, can be used to store files for serving over the network
* Comes with a SD card slot, supporting the read/write of mini SD card (TF card).
* Also compatible with Arduino Duemilanove, and Mega series
* Comes with a reset button
* Onboard comes with a D13 led
* Comes with a network connector, used to connect the network.
* Comes with several LED indicators for various status, such as network connection, powering on and communication situation.
* Support TCP/IP protocols
* Support TCP/IP protocols
<br>[[File:KS0156 (3).png|500px|frameless|thumb]]<br>
<br>
==Technical Details==
* Dimensions: 73mm x 54mm x 29mm
* Weight: 25.4g
<br>[[File:KS0156 Detail.png|600px|frameless|thumb]]<br>
<br>
==PINOUT Instruction==
<br>[[File:KS0156 pinout.jpg|700px|frameless|thumb]]<br>
<br>
<span style="color: red">'''Indicator light functions:''' </span>  <br>
* '''L:''' D13 LED ( D13 light up at HIGH, off at LOW)
* '''PWR:''' power led
* '''LINK:''' the network is connected. It will flash when send or receive the data
* '''100M:''' the network connection is in 100M/s
* '''FULLD:''' the network connection is full duplex communication
* '''COLL:''' flashing when the network detects a conflict.
* '''RX:''' flashing when the network receives data.
* '''TX:''' flashing when the network sends data.
<br>
==Test Code==
Below is an example code.<br>
[https://drive.google.com/open?id=14RrbN6lPfPU47iKCCGNl8S1dyOHPCjQk Click here] to download the libraries.<br>
[https://drive.google.com/open?id=1xjsRCVLaGCnmZ8tZPwsdTqwLQcE2VY2H  Click here  ]to download the code <br>
Or you can directly copy and paste the code below to [http://wiki.keyestudio.com/index.php/How_to_Download_Arduino_IDE  Arduino IDE].
<pre>
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,129);//modifying according your own IP
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion
//of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");
}
}
</pre>
<br>
<span style="color: red">'''Code to Note:'''</span>  <br>
'''1.''' Before compile the code, do remember to add the necessary libraries inside the libraries directory of Arduino IDE.<br>
Download the libraries from below link:<br>
https://drive.google.com/open?id=13zBGFTWGFiu6g2E-eACOB_Q52B3tVGiS<br>
'''2.''' In the code, you can set the MAC, '''byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }''', the content value can be set by yourself. It is hexadecimal.<br>
'''3.''' Set the IP address '''ip(192,168,1,129)''' in the code. It is the IP address that connected to the network connector on the shield.<br>
<br>
==Example Result==
Stack the shield onto the MEGA2560 board, then upload the code to MEGA 2560 and connect the network, open the Google browser and enter the IP address, it will display the analog data of A0-A5. Shown below.
<br>[[File:KS0156 Result 1.png|500px|frameless|thumb]]      [[File:KS0156 Result 2.png|600px|frameless|thumb]]<br>
<br>
==Resources ==
'''Download code and libraies'''
https://fs.keyestudio.com/KS0156
<br>
==Get One Now ==
*[https://www.keyestudio.com/new-keyestudio-w5100-ethernet-shield-for-arduino-uno-r3-mega-2560-p0143.html    '''Official Website''' ]
*[https://www.amazon.com/dp/B01E5JY7UU  '''Shop on Amazon''' ]
*[https://www.aliexpress.com/store/product/Free-Shipping-Ethernet-W5100-network-shield-board-with-SD-card-expansion-for-Arduino/1452162_2042247327.html?spm=2114.12010612.8148356.2.7ad6276feQmVfh  '''Shop on Aliexpress'''  ]
*[https://www.ebay.com/itm/132515810287 '''Shop on eBay''' ]




[[Category: shield]]
[[Category: Shield]]

Latest revision as of 09:35, 7 May 2021

Keyestudio W5100 Ethernet Shield


Introduction

keyestudio W5100 Ethernet Shield gives you an easy way to get your Arduino Online. It can turn your Arduino into a simple web server or use the Internet to read /write its digital and analog outputs/inputs.
Compatible with the UNO R3 board and Mega 2560 R3.
It is directly supported by Arduino official Ethernet Library. It also supports the read &write of mini SD card (TF card).
The shield adopts stackable design. You can directly plug it to Arduino board or plug other shields onto this Ethernet shield. .

Note: its MAC address is random. You can set MAC address in the code.


Features

  • Compatible with UNO R3 and MEGA 2560 control board.
  • Comes with a SD card slot, supporting the read/write of mini SD card (TF card).
  • Comes with a reset button
  • Onboard comes with a D13 led
  • Comes with a network connector, used to connect the network.
  • Comes with several LED indicators for various status, such as network connection, powering on and communication situation.
  • Support TCP/IP protocols


thumb

Technical Details

  • Dimensions: 73mm x 54mm x 29mm
  • Weight: 25.4g


thumb

PINOUT Instruction


thumb


Indicator light functions:

  • L: D13 LED ( D13 light up at HIGH, off at LOW)
  • PWR: power led
  • LINK: the network is connected. It will flash when send or receive the data
  • 100M: the network connection is in 100M/s
  • FULLD: the network connection is full duplex communication
  • COLL: flashing when the network detects a conflict.
  • RX: flashing when the network receives data.
  • TX: flashing when the network sends data.


Test Code

Below is an example code.
Click here to download the libraries.
Click here to download the code
Or you can directly copy and paste the code below to Arduino IDE.

#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,129);//modifying according your own IP
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion
//of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");
}
}


Code to Note:
1. Before compile the code, do remember to add the necessary libraries inside the libraries directory of Arduino IDE.
Download the libraries from below link:
https://drive.google.com/open?id=13zBGFTWGFiu6g2E-eACOB_Q52B3tVGiS
2. In the code, you can set the MAC, byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }, the content value can be set by yourself. It is hexadecimal.
3. Set the IP address ip(192,168,1,129) in the code. It is the IP address that connected to the network connector on the shield.


Example Result

Stack the shield onto the MEGA2560 board, then upload the code to MEGA 2560 and connect the network, open the Google browser and enter the IP address, it will display the analog data of A0-A5. Shown below.
thumb thumb


Resources

Download code and libraies

https://fs.keyestudio.com/KS0156



Get One Now