Interfacing SRF05 Ultrasonic Distance Module with Arduino

Table of Contents

SRF05 Ultrasonic Module Features

SRF05 is an ultrasonic transmitter and receiver module used to measure distance. The sensor operation is very simple. You only need to measure the return time of ultrasonic waves in order to measure the distance. Then you should divide measured time by 2 and multiply by the sound speed. The sensor measuring range is about 2 to 400 cm.

You can download the datasheet of this module here.

SRF05 Ultrasonic Module Pinout

This sensor has 3 pins:

  •  VIN: Module power supply – 5 V
  •  GND: Ground
  •  Trig: A 10 microseconds pulse is required for ultrasonic transmitter to start working
  •  Eco: Shows the waves travel time as pulses.
You can see the pinout of this module in the image bellow.

Required Materials

Hardware Components

Arduino UNO R3 × 1
SRF05 Ultrasonic Distance Module × 1
Male Female Jumper Wire × 1

Software Apps

Arduino IDE

Interfacing SRF05 Ultrasonic Distance Module with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to SRF05 module. Connect wires accordingly.

Step 2: Code

Upload the following code to Arduino. This code displays the sensor’s data in the serial monitor.

  SRF005 Ultrasonic Sensor
  modified on 22 Sep 2020
  by Mohammad Reza Akbari @ Electropeak
*/ const int pingPin = 5; // Trigger Pin of Ultrasonic Sensor const int echoPin = 6; // Echo Pin of Ultrasonic Sensor long duration; void setup() { pinMode(pingPin, OUTPUT); pinMode(echoPin, INPUT); digitalWrite(pingPin, LOW); Serial.begin(9600); } void loop() { digitalWrite(pingPin, HIGH); delayMicroseconds(10); digitalWrite(pingPin, LOW); duration = pulseIn(echoPin, HIGH); Serial.print(duration / 29 / 2); Serial.println(" cm"); delay(300); }

Liked What you see?

Get updates and learn from the best

More To Explore

Leave a Reply

Your email address will not be published. Required fields are marked *