July Saturday 21

Bookmark and Share

Related Articles...

MILWAUKEE WI Arduino Meet Up Make Space


WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Arduino Make Space Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Raspberry Pi Meet Up Make Space


WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Raspberry Pi Make Space Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Internet of Things (IoT) Meet Up Make Space


WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Make Space Acquired!

Full Advanced Fabrication Facility, machine Shop, Welding, Electronics Lab Equipment Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Machine Repair, & Installation  - Tier 1 Business Support

Machine Technician Mechanic 20+ Years  Personal Experienced In Industrial Factory Machine Servicing, Rebuilding, Installation And Repair - Plus A 35+ Years Experienced Computer Engineer Service Technician Team Ready For Your Outsourced Market Advantage Needs!

Hartung Industrial - Member - CGI Science & Technology Group

Email :

COASMailBox @ gmail.com

2018 July REVIEW


Arduino IoT Web Serving 101

Internet of Things

2017 | by Gene Casanova

Senior Systems/Network/Internet Engineer

Enable An Arduino To Server Web Content

This document is a study into an Arduino serving HTTP web content.  An Arduino systemboard and an "Ethernet Shield" will be used for this study.

The objective to this study is to build a system capable of responding to HTTP requests through an Ethernet network connection; HTTP communications over a LAN, WAN, or Internet.

Example System

I will create a system where data will be presented as the response to HTTP requests; the basic/fundamental concept of Internet of Things (IoT).


  1. 1 Arduino systemboard
  2. 1 'Arduino Ethernet Shield'
  3. 1 CAT 5 Patch Cable


The Ethernet shield provides a world industry standard digital network interface.  The Arduino Ethernet Shield uses a WizNet Ethernet controller.  The controller connects to the SPI bus on an Arduino systemboard.  The connection uses pins 10, 11, 12, and 13.

Later models of the 'Ethernet Shield' have a SD Card reader/writer device on-board and uses digital pin 4 to control the 'slave select' pin on the SD card.

Connect the RJ45 Ethernet network port to a LAN using a CAT 5 or better rated cable.

The Arduino Shield

The Arduino Shield connects to the top of an Arduino systemboard; creating a stacked board configuration

Standoff Hardware

For a safer, more stable, and when building a system for use in application deployments/operations, use proper standoff PCB hardware.  Contact CGI Computer Wares for Arduino standoff hardware; available in nickle plated brass (presentation applications), stainless steel (environment applications), and aluminum alloy (lightweight applications).

Arduino Ethernet Shield

Image above developed using Fritzing. For more circuit examples, see the Fritzing project page


Arduino Ethernet Shield Schematic

SD Card Use Notice

The example circuit does not require the use of an SD flash memory card.

If an SD flash memory card is inserted and not used, then the system could become unusable; as pin 4 is used as SS (Slave Select active low) and when not used, pin 4 is configured as 'INPUT' by default.

Remove the SD card.

Or, depending on the specific intended application, leave a SD-card installed and the following two lines to the sketch (source code):

pinMode(4, OUTPUT);
digitalWrite(4, HIGH);

The Program

The basic fundamental sketch (source code) to create a HTTP server, is:

Arduino IoT Data HTTP Web Server
Serve values collected from analog input pins on an Arduino,
using an Arduino Wiznet Ethernet shield for network connectivity.
* Ethernet shield connects to pins 10, 11, 12, 13
* Analog inputs pins A0,A1,A2,A3,A4,A5 as needed.

2017, by Gene Casanova */ #include <SPI.h>
#include <Ethernet.h> // Enter the MAC-address and IP-address of the Ethernet controller:
byte mac[] = {0xDE,0xAD,0xBE,0xEF,0xFE,0xED};
IPAddress ip(192,168,1,125); // Initialize Ethernet library:
// Set the IP-address and port the system will respond on:
// port 80 is default for HTTP (web servers) // For cyber security, use a random higher port number:
EthernetServer server(8067);

void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only. } // Start Ethernet connection and the server: Ethernet.begin(mac, ip); server.begin(); Serial.print("server is at "); Serial.println(Ethernet.localIP()); } void loop() { // Listen (monitor) for clients (HTTP requests): 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 a newline character on a blank line is received, // then the HTTP request has ended. // Send Reponse:
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"); // Close connection after completion of response. client.println("Refresh: 5"); // Refresh page every 3 seconds/presents new data changes in near real time. client.println(); client.println("<!DOCTYPE HTML>"); client.println("<html><body>"); // Output 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("</body></html>"); break; } if (c == '\n') { // Starting a new line: currentLineIsBlank = true; }else if (c != '\r') { // Gotten a character on the current line currentLineIsBlank = false; } } } // Delay Time: delay(1); // Close Connection: client.stop(); Serial.println("client disconnected"); } }

Arduino Open Source Community member - Tier 1 Full Stack Developer

Further Study

The circuit above represents the foundation for IoT implementation.  IoT is an interfacing concept, taking something and connecting it to the World's public Internet. Use The Technology Wisely & Keep It Simple.

Tier 1 IoT Consulting Available; full stack, complete concept to deployment leadership, team meber available.

Use The Technology Wisely & Keep It Simple

- Cheers!

Gene Casanova

Need More?   Need Help? ........Software, Network, System & Data Center Builder & Developer | Development Services Available - Freelance Small Jobs; To Outsourced Long Term Service Provider Contract Labor Available.

CGI Computer Wares | EST 1979

Send E-MailCONTACT: [click]@CGIComputerWares.com