Ultra-sonicSensor

Page Actions

The Ultrasonic Distance Sensor HC-SR04

In order to measure the distance of the colored paper sheet from the sensors we use the HC-SR04 ultra-sonic distance sensor.

As can be seen from the photo, the modules has 4 connections:
  • Vcc, which is 5V
  • Gnd
  • Trig
  • Echo
The module is triggered with a 10us TTL trigger pulse. It then sends an 8 cycle sonic burst of 40 kHz and tries to detect the echo. The module sends an echo pulse whose length is proportional to the time the sound signals takes to the target and back.

These are the connection we make:
Vcc 5V
Trig gpio 23
Echo gpio 24 via the level converter
Gnd Gnd

Here is a Python test program demonstrating the readout:

https://iotworkshop.africa/pub/AFNOG/Ultra-sonicSensor/hc-sr04.py.txt

-- %USERSIG{UliRaich - 2018-02-08}%

Comments


 
I Attachment Action Size Date Who Comment
hc-sr04.pngpng hc-sr04.png manage 172 K 06 Mar 2018 - 13:45 UnknownUser  
hc-sr04.py.txttxt hc-sr04.py.txt manage 940 bytes 06 Mar 2018 - 13:59 UnknownUser  
Topic revision: r4 - 08 Mar 2018, UliRaich