Interfacing HC-SR04 Ultrasonic sensor with evive

ultrasonic sensor working
About This Tutorial
In this tutorial we will interface HC-SR04 Ultrasonic sensor with evive and we will calculate distance between ultrasonic sensor and obstacle form which ultrasound waves are reflected
Tutorial Info

Components Required

Image Component Quantity Available in Kit
evive 1
USB A-B Cable 1
Male to Female Jumper Cable 10cm 1
  • None
Ultrasonic Sensor 1


An Ultrasonic sensor is a device that can measure the distance to an object by using sound measures distance by sending out sound wave at a specific frequency and listening to that sound wave to bounce back.


Ultrasonic sound vibrates at a frequency above the range of human hearing. Transducers are the microphones used to receive and send ultrasonic sound. HC-SR04 and like other ultrasonic sensor module use a single transducer to send a pulse and to receive the echo. The sensor determines the distance to the target by measuring time lapse between sending and receiveing of the ultrasonic pulses.


 Distance calculation

It is known that sound travels through air at a speed of 344 meters/seconds approximately, you can take a time taken by the sound wave to return and multiply it by 344 meters to get total round-trip distance of the sound wave, round-trip time means total distance traveled by the wave i.e two times the distance between HC-SR04 ultrasonic sensor module and object from which ultrasonic wave reflected. To find the distance to object simply divide round-trip time by 22, you can calculate the distance to object by using a simple formula which is given below.


 Pin description

The HC-RS04 Ultrasonic sensor module has 4 pins, two pins for power supply and one pin for sending out ultrasonic sound waves and one pin for receiving ultrasonic sound waves.

  • VCC
  • GND
  • TRIG (for sending ultrasonic sound waves)
  • ECHO (for receiving ultrasonic sound waves)

Circuit diagram


Place the HC-RS04 ultrasonic sensor module on the evive board such that the connecting wires or component of the evive board do not block the path of the ultrasonic sensor 

  • Connect VCC of HC-SR04 module to VCC of evive board 
  • Connect GND of HC-SR04 module to GND of evive board
  • Connect TRIG pin of HC-SR04 module to pin number 9 of evive board
  • Connect ECHO pin of HC-SR04 module to pin number 10 of evive board

Arduino code

Expected result

Share this Tutorial
Share on facebook
Share on twitter
Share on pinterest
Share on reddit
Share on print
Featured Projects

Leave a Reply