Kategori: Sensor Jarak, Object,Garis

Ultrasonic Ranging Module HC-SR04

Link product bracket ultrasonic HR-SR04http://indo-ware.com/produk-2960-bracket-ultrasonic-hrsr04.html
Vendor's Description: 
The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object like bats or dolphins do. It offers excellent range accuracy and stable readings in an easy-to-use package. It operation is not affected by sunlight or black material like Sharp rangefinders are (although acoustically soft materials like cloth can be difficult to detect). Similar in performance to the SRF005 but with the low-price of a Sharp infrared sensor.


  • Power Supply :5V DC
  • Quiescent Current : <2mA
  • Effectual Angle: <15°
  • Ranging Distance : 2cm – 500 cm/1" - 16ft
  • Resolution : 0.3 cm


Basic use of the HC-SR04 Ultrasonic Sensor 

Please see the datasheet for an excellent description of how the sensor operates. 

HC-SR04 Datasheet


Sampel code:


HC-SR04 Ping distance sensor]
VCC to arduino 5v GND to arduino GND
Echo to Arduino pin 13 Trig to Arduino pin 12
More info at: http://goo.gl/kJ8Gl
#define trigPin 12
#define echoPin 13
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
void loop() {
int duration, distance;
digitalWrite(trigPin, HIGH);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance >= 200 || distance <= 0){
Serial.println("Out of range");
else {
Serial.println(" cm");

he Theory Behind It:

In the program above, we want to calculate the distance of an object in front of the ultrasonic sensor. This sensor can send a "ping" at a given moment and receive the ping bouncing back on an object at another given moment.
A ping is nothing but a sound that is inaudible for the human hear and this is why this sensor is called "ultrasonic".
The sensor send a ping at a time t1 and receive the bouncing ping at a time t2.
Knowing the speed of sound, the time difference Δt = t2 - t1 can give us an idea of the distance of an object.

Example, if Δt = 500 microseconds, we know it took 250 microseconds for the ping to hit an object and another 250 microseconds to come back.
The approximate speed of sound in dry air is given by the formula:
c = 331.5 + 0.6 * [air temperature in degrees Celsius]
At 20°C, c = 331.5 + 0.6 * 20 = 343.5 m/s
If we convert the speed in centimetres per microseconds we get:
c = 343.5 * 100 / 1000000 = 0.03435 cm/ųs
The distance is therefore, D = (Δt/2) * c
or D = 250 * 0.03435 = 8.6 cm

Instead of using the Speed of Sound, we can also use the "Pace of Sound".
The Pace of Sound = 1 / Speed of Sound = 1 / 0.03435 = 29.1 ųs/cm
In this case the equation to calculate the distance become: D = (Δt/2) / Pace of sound
and for the example above: D = 250 / 29.1 = 8.6 cm


Video youtube:




Album produk




link produk sejenis:



Youtube test:




Beli Produk Ini Harga Rp. 30.000,-
Stok:   5 item

Kategori Lainnya

Keranjang Belanja
0 item produk
Total: Rp. 0
Kategori Produk
Cek Pengiriman Barang