Authorized Online Retailers:

AMAZON
AMAZON-jp
amzuk

1 Overview

In this lesson, we’ll learn how to use HC-SR04 Ultrasonic sensor to measure distances and send data to remote browser.

2 Hardware Preparation

Quantity
Arduino UNO 1
Ethernet Shield W5100 1
USB Cable 1
HC-SR04 Ultrasonic sensor module 1
Jumper wires Several
Breadboard(Optional) 1

3 Hardware connection

Connect the HC-SR04 with UNO as following diagram:

4)Software Installation

Download the sketch file from https://osoyoo.com/driver/ethernet_iot/lesson10/w5100-lesson10.zip

unzip the file and double click the w5100-lesson10.ino file, load the sketch into Arduino IDE.

Open your Serial Monitor, you can see your router will assign an IP address to your Arduino   as following:

In above example, 10.0.0.45 is the IP address of my Arduino.
Now put an obstacle in front of the sensor and  use another computer or your cell phone’s  browser to visit url : http://10.0.0.45
Your browser will show following result which tells you the distance between sensor and obstacle: