I am doing a watch with GPS tracker project. I am using an Ultrasonic HC-SR04 sensor. I don't know where to connect the Echo and trig pins with my Arduino. Please let me know how to connect it.
2 Answers
To any 2 free IO pins.
To quote sparkfuns datasheet:
(1) Using IO trigger for at least 10us high level s ignal,
(2) The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back.
(3) IF the signal back, through high level , time of high output IO duration is the time from sending ultrasonic to returning.
Test distance = (high level time×velocity of sound (340M/S) / 2,
In other words you send a short pulse to trigger pin and then wait for the echo pulse and measure how long it was high. Divide the number of microseconds it was high by 58 and you have the distance in centimetres ( use 148 for inches)
You can connect them to two GPIO pins. It does not matter much which ones (probably between 2 and 12 since these are not used by other functions like the builtin led or RX/TX).
In the following example pins 9 and 10 are used:
Fragment related to the pins:
The HC-SR04 Ultrasonic Module has 4 pins, Ground, VCC, Trig and Echo. The Ground and the VCC pins of the module needs to be connected to the Ground and the 5 volts pins on the Arduino Board respectively and the trig and echo pins to any Digital I/O pin on the Arduino Board.
-
Okay I will try sir . Another question that i want to ask is ,what is the red light indication in an arduino nano? and how to connect rx/dx from gps tracker with arduino nano ? please help me Commented Sep 25, 2017 at 11:37
-
I don't have a Nano. It's best to post it as a new question with a picture and a mark to the indicator you mean. Also the other question is best to ask as a separate question. I never worked with a GPS tracker. Commented Sep 25, 2017 at 12:16