1
\$\begingroup\$

this is the operation of the ultarsonic module HC-sr04 :

The timing diagram of HC-SR04 is shown. To start measurement, Trig of SR04 must receive a pulse of high (5V) for at least 10us, this will initiate the sensor will transmit out 8 cycle of ultrasonic burst at 40kHz and wait for the reflected ultrasonic burst. When the sensor detected ultrasonic from receiver, it will set the Echo pin to high (5V) and delay for a period (width) which proportion to distance. To obtain the distance, measure the width (Ton) of Echo pin.

enter image description here

is the number of 8 cycles related to the microcontroller of the module ,I think that but why?

don't forget the second question why the trigger is 10us ?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Or maybe 8 us as per your title? \$\endgroup\$
    – Andy aka
    Commented Dec 11, 2016 at 0:55

3 Answers 3

2
\$\begingroup\$

The receiver and transmitter are mechanically tuned to the frequency, so it will take a few cycles for the amplitude to ring up to the maximum (the transmitter will ring up in amplitude as you drive it, and the receiver needs to 'hear' a number of cycles before it reaches full output, so you better drive it for enough cycles). It's also of no advantage to have too long a sequence of cycles.

That is why the designer programmed the microcontroller to output 8 cycles in particular, in answer to your first question.


Read any reference on 2nd order systems for an explanation of Q and resonance. The center frequency of this mechanical resonance is typically specified to +/- 1kHz (+/-2.5%). Here is a typical one:

enter image description here

Note the ringing specification of 1.2ms for this product, which implies a much higher Q. It is a waterproof type and has too high a Q for good results in a ranging application. You can find more information in this answer.


In answer to your second question, the 10us is probably to allow the firmware in the microcontroller to recognize the input. If they don't use an interrupt but rather a tight loop it might take that long to traverse the loop so a shorter pulse might be missed some of the time.

\$\endgroup\$
14
  • \$\begingroup\$ There is no oscillatory or tuned circuit, it is driven by a 14 V p-p square wave. \$\endgroup\$ Commented Dec 11, 2016 at 6:13
  • 1
    \$\begingroup\$ @JackCreasey Jack, I don't think you understood my point at all. They have a mechanical resonance at 40kHz. That's why they have to be driven at that specific frequency. The receiver will ring up over a number of cycles. The mechanical Q is probably something like 5. When I developed a videographer sonar ranging system this was quite an apparent (and limiting) effect. \$\endgroup\$ Commented Dec 11, 2016 at 6:17
  • \$\begingroup\$ I think I do understand. I included a link to a likely sensor as well so you can see the breadth of sensitivity. I would agree with your comments more if the question was about the Rx channel, but it was about the Tx channel. \$\endgroup\$ Commented Dec 11, 2016 at 6:36
  • \$\begingroup\$ You can only receive what has been transmitted. \$\endgroup\$ Commented Dec 11, 2016 at 6:48
  • 2
    \$\begingroup\$ They are both driven 2nd order systems and the amplitude of the transmitter transducer will ring up over a number of cycles. It has to, the Q is high as you can see from the peaking at 40kHz. Otherwise it would be more-or-less flat. This is 2nd year stuff. \$\endgroup\$ Commented Dec 11, 2016 at 7:14
2
\$\begingroup\$

trigger pulse is the requirement of controller.

the number of pulses provided is the optimum number for generating ouput voltage at receiver side.

to understand that i performed an experiment: I used two 200kHz US transducers, one as transmitter and other as receiver at a distance of 40mm.

On sending pulses from transmitter the receiver gives an output signal which is conditioned to give a mountain like peak.

output of receiver after signal conditioning

The big peak is the main signal that is transmitted, the second peak is the signal that is reflected and detected. Similarly other smaller reflections are detected.

So as we increase the number of pulses the amplitude of the received signal increases and saturates at a point. After further increase in number of pulses results in increase in reflection peak, which are not required.

number of pulses vs peak voltages

Hence from this experiment I concluded that for 200kHz, at 40mm the optimum number of pulse required to get maximum output is 6.

Similarly the number of 8 pulse might be calculated. also some sensors provide this information on data sheet. e.g. Air Ultrasonic Ceramic Transducersenter image description here

\$\endgroup\$
1
\$\begingroup\$

Yes, the input trigger is related only to the onboard microprocessor detecting the start pulse.

Yes, the 8 cycles of drive at 40kHz is related only to the microprocessor timing driving the output.

The HRC-SR04 has a microprocessor on it that does all the timing for send and distance calculation. The output signal is actually created by an RS232 driver (MAX232A). The driver creates it's own +ve and -ve supplies to drive an RS232 line. There is a delay from the 10 uS input trigger to allow the MAX232 to stabilize it's +ve and -ve supply (typically it reaches +/-7 V).
The microprocessor then sends the 8 cycles of drive to the sender (14 V p-p through 600 Ohm resistor, so there is no waiting for an osc to reach amplitude.
The sender does have a natural oscillating frequency, but in this application it is actively driven by a square wave, there is no oscillator circuit.
The sender is driven by the RS232 driver and damped heavily (600 Ohms) when the digital signals stop.

One guy did a lot of excellent work on the HC-SR04. I'm not sure what MAX232's he's talking about but in my experience the output drive voltages are closer to 7 V rather than his quoted 10 V. Either way the material on his website is superb.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.