Tags: , ,

Connecting Arduino to internet is made possible with the use of an Ethernet Shield VM04. The basis for creating connected object (IoT) is to connect them to a network such as the WiFi network.
Communication via the Ethernet network is very convenient when you want to connect a device to WiFi.

Prerequisites: Knowledge of HTML/CSS


  • Computer
  • ArduinoUNO
  • USB A Male/B Male
  • Ethernet cable RJ45
  • Ethernet Shield VMA04

Operating principle

The communication uses the Ethernet network which can be linked to the WiFi. To access the Arduino board without having to connect to the Internet router, it is necessary to create a bridge between wifi and ethernet connection to your computer. For this, we must:

  • Go to the Network and Sharing Center
  • Go to “Change adapter settings”
  • Select Ethernet and Wifi/(internet source) and right click
  • Click “Create Bridge”

In Windows, the control terminal, type “arp -a” to see the IP addresses used on the network.

The Ethernet Shield VMA04 uses Microchip ENC28J60 as Ethernet controller.
Note: Write a web page can take a lot of memory space for an Arduino board. We use an Ethernet VMA04 Shield and Arduino UNO board but if you think that your page will be memory-intensive upgrade to a shield W5100.
(Warning: Shield VMA04 exists version KA04 Kit soldering oneself Check the one you want to buy.)


The Ethernet Shield VMA04 is compatible with the Arduino UNO and Mega microcontrollers and is placed directly on the map. In the case of a shield, the connections are predefined. Make sure the component’s technical documentation how to use it (VMA04 datasheet).
The ethernet shield VMA04 uses:

  • 10 and 2 pins on a map Arduino UNO
  • the SPI bus: 11,12,13 pins on an Arduino UNO


To interact with the Ethernet Shield VMA04 we use the library UIPEthernet.h

  • Ethernet.begin () to initialize a network connection
  • server.begin () to initialize a server
  • EthernetClient client=server.available() to initialize a client
  • client.read () to read data from the client
  • client.print () to send data to the client
#include <UIPEthernet.h>//https://github.com/UIPEthernet/UIPEthernet

String request ;
unsigned long refreshCounter  = 0;
IPAddress ip(192, 168, 1, 179) ;
byte mac [6] = {0x54, 0x34, 0x41, 0x30, 0x30, 0x31};

EthernetServer server(80);
EthernetClient client;

void setup() {
  //Init Serial USB
  Serial.println(F("Initialize System"));
  //Init VMA04
  Ethernet.begin(mac, ip);
  while (!Ethernet.begin(mac)) {
    Serial.println(F("failed. Retrying in 1 seconds."));
    Serial.print(F("Starting VMA04..."));
  pinMode(4, OUTPUT);
  Serial.println(F("VMA04 initialized"));
  Serial.print(F("IP Address: "));

void loop() {
  client = server.available();

void clientRequest( ) { /* function clientRequest */
  ////Get client request
  if (!client) {
  //Wait until the client sends some data
  while (!client.available()) {

  request = client.readStringUntil('\r');//Read the first line of the request

void handleRequest( ) { /* function handleRequest */
  ////Handle web client request
  if (request.indexOf("/dig4on") > 0) {
    digitalWrite(4, HIGH);
  if (request.indexOf("/dig4off") > 0) {
    digitalWrite(4, LOW);
  if (request.indexOf("GET") >= 0) {


void webpage(EthernetClient client) { /* function webpage */
  ////Send webpage to client

  //output HTML data header
  client.println(F("HTTP/1.1 200 OK"));
  client.println(F("Content-Type: text/html"));
  client.print(F("<!DOCTYPE HTML><html><head><title>AranaCorp</title>"));
  client.print(F("<meta http-equiv='content-type' content='text/html; charset=UTF-8'>"));
  //meta-refresh page every x seconds
  client.print(F("<meta http-equiv='refresh' content='2'>"));
  client.print(F("</head><body bgcolor='black'><br>"));
  client.print(F("<h1 style='color : #3AAA35;'><center> AranaCorp - Arduino Web Controller </center></h1>"));
  client.println("<center><p style='color:white;'>");
  client.print(F("Page refresh number: "));
  client.print(refreshCounter);//current refresh count
  client.print(F("<h2 style='color:green;'>Arduino Inputs</h2>"));
  client.println("<p style='color:white;'>");


  //output analog input pin
  for (int i = 0; i < 6; i++) {
    client.print("<b>Input A");
    client.print(" : </b>");
    client.print(analogRead(14 + i));//A0=14, A1=15 ,etc.

  client.print(F("<h2 style='color:green;'>Arduino Outputs</h2>"));
  client.print(F("<p style='color:white;'>"));

  //digital output

  client.print(F("<b>Digital output Pin 4 : </b>"));
  client.print("<input value=" + String(digitalRead(4)) + " readonly></input>");
  client.print(F("<a href='/dig4on'><button>Turn On </button></a>"));
  client.print(F("<a href='/dig4off'><button>Turn Off </button></a><br/>"));


  //file end
  refreshCounter += 1;


We can see that the Ethernet Shield VMA04 initializes correctly. When you enter the IP address in the browser address bar, the web page described in the webpage function should appear.
Once the page loads, the analog input values ​​vary with each refresh and the status of the pin 4 can be changed by pressing the corresponding buttons.


  • Use a web interface to control your Arduino


How useful was this post?

Click on a star to rate it!

Average rating 4.7 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?