Help with Ultrasonic sensor

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am a newbie to the world of sensors , i have read about the ultrasonic HC-SR04 , the problem is does the echo pin gets high if the transmitted signal gets reflected ? or as soon as the transmitted ultrasonic signal “8 pulses “ the echo gets high??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What does the datasheet read?

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

After you trigger the transmit pulse, wait for the echo pin to go high, and measure how long it stays high, the measurement period is over when the echo pin goes low.

You should google "Arduino HC-SR04" for LOTS of examples of how to do this.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The echo pin goes high (active) about 10-15 microseconds after the six pulses are generated.   Those six pulses are generated a few microseconds after there is a pulse on the trigger pin of the HC-SR04.   Some designers will combine the trigger pin and the echo pin to one AVR port pin.   They send a signal to start the six pulse sequence and then switch the AVR port pin from an output to an input.  When the HC-SR04 gets the reflection of six-pulse sequence, the echo pin goes low.  

 

The length of the pulse on the echo pin is the time that it takes for sound to go from the starting piezo, bounce off of the reflecting surface and return to the receiving piezo on the SR04 unit.  The software will start a timer with value 0x0000 when the trigger gets activated and stops the timer when the echo pin returns to low.  The software then usually applies a mathematical formula to give the user the present distance between the HC-SR04 and the reflecting surface.

 

The six piezo pulses will bounce off skin so you can use the palm of your hand as a reflecting surface.  I've had satisfactory near-linear results by using my hand as a controller that moves between about 10 and 30 centimeters (between three four inches and a foot in the real world) from the HC-SR04.   I think that you could make a controller by cupping your hand and positioning it in front of the SR04 to get a distance value and then turning your hand sideways so that the pulses no longer bounce off your palm when you want to 'lock' the value.  I haven't tried to get a two-dimensional value by using two SR04 units positioned 90 degrees apart.

 

There is a possibility that the ultrasonic pulses will bother animal pets that have hearing that extends into the range of the pulses (which I believe come at a 25K to 30K Hertz frequency).

 

Last Edited: Wed. Oct 23, 2019 - 12:49 AM