Ethernet Shield W1500

Ethernet W1500 shield dapat digunakan untuk menghubungkan modul arduino ke dalam jaringan internet melalui koneksi kabel RJ45 (tidak termasuk dalam paket). Penggunaan modul W1500 sangat mudah dan cepat dilakukan, karena pada program IDE arduino sudah terdapat contoh programnya. Sehingga dalam hitungan menit Anda akan dapat melakukannya. Untuk melakukan testing terpisah bagaimana menggunakan Ethernet Shield W1500 silakan merujuk pada posting Testing W1500 Ethernet Shield.

Sensor Ultrasonic HC-SR04

Sensor Ultrasonic HC-SR04

Sensor ultrasonic HC-SR04 adalah salah satu modul yang dapat digunakan pada modul Arduino. Untuk menggunakan sangat mudah dan dalam waktu beberapa menit bisa dilakukan. Bagi yang ingin melakukan testing secara mandiri silakan merujuk posting Simple Arduino and HC-SR04 Example. Datasheet dapat diunduh HC-SR04.

Koneksi pin HC-SR04 adalah:

  • 5V Supply
  • Trigger Pulse
  • Echo Pulse O
  • 0V Ground

seperti terlihat dibawah ini:

Selanjutnya, untuk melakukan testing komponen yang dibutuhkan adalah:

  • 1 unit sensor ultrasonic HC-SR05
  • 4 pin kabel jumper female-male
  • 1 unit modul arduino
  • 1 unit modul ethernet W1500
  • 1 kabel RG45
  • 1 kabel USB
HC-SR04 dan kabel jumper female-male

HC-SR04 dan kabel jumper female-male


Pemasangan kabel jumper pada HC-SR05

Pemasangan kabel jumper pada HC-SR05

Pemasangan kabel jumper pada modul ethernet W1500

Pemasangan kabel jumper pada modul ethernet W1500

Pemasangan kabel RG45 pada W1500

Pemasangan kabel RG45 pada W1500

Pemasangan kabel RG45 pada Komputer

Pemasangan kabel RG45 pada Komputer

Source code yang dipakai dapat dilihat dibawah ini:

Web Server

A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield.

* Ethernet shield attached to pins 10, 11, 12, 13
* Analog inputs attached to pins A0 through A5 (optional)

created 18 Dec 2009
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe


#include <SPI.h>
#include <Ethernet.h>

#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin
#define LEDPin 13 // Onboard LED

int maximumRange = 200; // Maximum range needed
int minimumRange = 0; // Minimum range needed
long duration, distance; // Duration used to calculate distance

// 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,168,177);

// 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:
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(LEDPin, OUTPUT); // Use LED indicator (if required)
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only

// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
Serial.print("server is at ");

void loop() {
/* The following trigPin/echoPin cycle is used to determine the
distance of the nearest object by bouncing soundwaves off of it. */
digitalWrite(trigPin, LOW);

digitalWrite(trigPin, HIGH);

digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);

//Calculate the distance (in cm) based on the speed of sound.
distance = duration/58.2;

if (distance >= maximumRange || distance <= minimumRange){
/* Send a negative number to computer and Turn LED ON
to indicate "out of range" */
digitalWrite(LEDPin, HIGH);
else {
/* Send the distance to the computer using Serial protocol, and
turn LED OFF to indicate successful reading. */
digitalWrite(LEDPin, LOW);

// 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 =;
// 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: 1");  // refresh the page automatically every 5 sec
client.println("<!DOCTYPE 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(" is ");
client.println("<br />");
client.print("Distance:  ");
client.print(" cm");
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
// close the connection:
Serial.println("client disonnected");

Lebih lengkap langkah-langkahnya silakan simak pada video berikut:

Demikian, semoga bermanfaat.