User Guide HC-SR04 (ElecFreaks) - 4

ManufacturerElecFreaks
DescriptionUltrasonic transmitter emitted an ultrasonic wave in one direction, and started timing when it launched.
Pages / Page6 / 4 — 2 5. . Mo. M d. o u. d l. u e. l op. o e. p r. e a. r t. a i. t n. i g. n …
File Format / SizePDF / 740 Kb
Document LanguageEnglish

2 5. . Mo. M d. o u. d l. u e. l op. o e. p r. e a. r t. a i. t n. i g. n Pr. P i. r n. i c. n i. c p. i l. p e. P r. a t. r 3. t Us. U e. s Fr. F e. r a. e d. a u. d i. u n. i o. n UN. U O

2 5  Mo M d o u d l u e l op o e p r e a r t a i t n i g n Pr P i r n i c n i c p i l p e P r a t r 3 t Us U e s Fr F e r a e d a u d i u n i o n UN U O

Text Version of Document

2. 2 5 . Mo M d o u d l u e l op o e p r e a r t a i t n i g n Pr P i r n i c n i c p i l p e l
Set low the Trig and Echo port when the module initializes , firstly, transmit at least 10us high level pulse to the Trig pin (module automatically sends eight 40K square wave), and then wait to capture the rising edge output by echo port, at the same time, open the timer to start timing. Next, once again capture the falling edge output by echo port, at the same time, read the time of the counter, which is the ultrasonic running time in the air. According to the formular: test distance = (high level time * ultrasonic spreading velocity in air) / 2, you can calculate the distance to the obstacle.
Pa P r a t r 3 t Us U e s Fr F e r a e d a u d i u n i o n UN U O N to t te t s e t s HC H - C S - R S 0 R 4 0 3. 3 1 . Fr F e r a e d a u d i u n i o n un u o n an a d n HC H - C S - R S 0 R 4 0 Co C n o n n e n c e t c i t o i n o
Connection Description:D2<------>Trig D3<------>Echo (The users can define the connection pin by themselves) Note : You need to set the Freaduino UNO switch in 5V Side when use together with HC-SR04 Module. 4 Document Outline HC-SR04UserGuide Part1UltrasonicIntroduction 1.1UltrasonicDefinition Thehumanearcanhearsoundfrequencyaround20HZ 1.2Ultrasonicdistancemeasurementprinciple Ultrasonictransmitteremittedanultrasonicwave 1.3UltrasonicApplication Part2HC-SR04UltrasonicModuleIntroduction 2.1ProductFeatures 2.2ProductImage 2.3、Modulepindefinitions 2.4、Electricalparameters 2.5ModuleoperatingPrinciple Part3UseFreaduinoUNOtotestHC-SR04 3.1FreaduinounoandHC-SR04Connection 3.2HCSR04libraryfunctiondescription Longtiming() floatCalcDistance(longmicrosec,intmetric) 3.3AddtheHC-SR04Library 3.4TesttheModulewiththeExamplesofLibraryF
EMS supplier