0

I have HC-SR04 Ultrasonic Sensor with me. I couldn't understand the "Trig" pin's working structure and the working technic. Do we really need it while we use?

(With Arduino examples, I generally use Echo pin more than trig pin.)

image

asked Jun 14, 2015 at 9:20
2
  • I wonder how you can get anything meaningful from Echo, if you do not use Trig. Are you sure that Trig is not activated by some library you might be using? Or you might have some circuitry driving Trig for you? Commented Jun 14, 2015 at 10:26
  • This is a reasonable question, as the Arduino example assumes a 3-pin device where Trigger and Echo are combined, but most suppliers provide a 4-pin one where they are distinct. Commented Jun 14, 2015 at 14:46

3 Answers 3

3

Yes, you do need it.

The purpose of the TRIG pin is to cause the module to send out a "Ping". It's what makes the whole thing work. As soon as the TRIG pin goes HIGH then LOW (for a period of not less than 10μs) the internal clocks start ticking. 8 cycles of 40KHz audio are sent out of the transmitter and it starts counting how long it takes for the echo to arrive.

If you don't use the TRIG pin the module won't be able to do anything at all.

answered Jun 14, 2015 at 9:34
1

Two versions of ultrasonic sensors

There are two versions of this device. In the threepin version you trigger the measurement and receive the echo pulse on the same pin. In the four pin version trigger and echo are on separate pins.

Possibly your Arduino example is written for the three pin version.

answered Jun 14, 2015 at 11:26
3
  • If we can use it with three pins, why do we need it with the four? And Is it meanful with using four pinned one in any project? How? What is the difference? Commented Jun 15, 2015 at 11:31
  • Two different solutions to the same problem. Both works. You have to interface the version you have. Do you need help with modifying your code? Commented Jun 15, 2015 at 12:14
  • No, thanks. I learnt how to do. You are kind. Thanks. Commented Jun 15, 2015 at 13:59
0

I stumbled across your topic while working in a personal project. As people said earlier, your doubts must be related to the different versions of this board.

Keep in mind that, when using the 4-pin you can keep the ECHO full online as an input, while in the 3-pin version, you need to cancel the ECHO to use it as Output for the TRIG.

This is particularly useful when you need to make a environmental analysis to different responses to different actions.

answered Nov 20, 2017 at 22:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.