Ultrasonic transmitter emitted an ultrasonic wave in one direction, and started timing when it launched.
Pages / Page
6 /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 / Size
PDF / 740 Kb
Document Language
English
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.2 5. MoM do ud lu el opo ep re ar ta it ni gn PrP ir ni cn ic pi lp el 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. PaP ra tr 3t UsU es FrF er ae da ud iu ni on UNU ONtot tet se ts HCH -C S- RS 0R 403.3 1. FrF er ae da ud iu ni on unu on ana dn HCH -C S- RS 0R 40 CoC no nn en ce tc it oi no 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