Jump to content
Electronics-Lab.com Community
Sign in to follow this  
HarryA

In the bowels of: Sonic Sensor

Recommended Posts

In the photography is the "Ultrasonic HC-SR04 distance measuring transducer sensor".

"HC-SR04 consists of ultrasonic transmitter, receiver, and control circuit. When triggered it sends out a series of 40KHz ultrasonic pulses and receives echo from an object. Power supply: 5V DC; quiescent current: less than 2mA; effectual angle: less than 15°; distance: 2cm - 500cm."  

The sensor is 1.75 inches/ 4.45 cm by 0.75 inches/ 1.9 cm. The IC on the bottom left is an LM324 quad op amp. The two on the right are not marked.

 

 

 

 

small 3650.JPG

// The sensor is triggered by a HIGH pulse of 10 or more microseconds. Give a short LOW pulse beforehand to ensure a clean HIGH pulse:

  • digitalWrite(iTrigPin, LOW); //pin 12 Out
  •  delayMicroseconds(5);
  • digitalWrite(iTrigPin, HIGH);
  • delayMicroseconds(12);
  • digitalWrite(iTrigPin, LOW);

   // Read the signal from the sensor: a HIGH pulse whose  duration is the time (in microseconds) from the sending  of the ping to the reception of its echo off of an object.

  • pinMode(iEchoPin, INPUT);   //pin 13 In
  • lDuration = pulseIn(iEchoPin, HIGH);

The photography shows the trigger pulse in blue and the signal from the sensor in yellow bracketed by the white cursors. In the lower right is the width of the pulse: 24.4 ms from a object at 16 inches/ 40.6 cm from the sensor.

 

 

 

 

 

small F3638.JPG

// Convert the time into a distance - long way for clarity

  • lCM = (lDuration/2) / 29.1;     // Divide by 29.1 or multiply by 0.0343
  • lInches = (lDuration/2) / 74;   // Divide by 74 or multiply by 0.0135

So for 2440 us/2 = 1220/74 = 16.48 inches  or 1220/29.1 = 41.9 cm

1919179439_small3653.JPG.8b75c972837172ff64118f640837dafd.JPG

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...