Documente Academic
Documente Profesional
Documente Cultură
UltrasonicRangingSensorModule
FromElecrow
Contents
1Introduction
2Features
3Usage
3.1Hardware
3.2Programming
3.3Resource
Introduction
Description:ThisHCSR04UltrasonicRangingSensorisanoncontactdistancemeasurementmodulewith
stableperformanceandhighrangingaccuracy.withtheinexpensiveprice,Themeasurmentrangeifitcan
beupto5M,whichwouldbehelpfulforyourprojectsuchasroboticObstacleAvoidanceandsoon.
http://www.elecrow.com/wiki/index.php?title=Ultrasonic_Ranging_Sensor_Module 1/5
19/2/2015 UltrasonicRangingSensorModuleElecrow
Features
Powersupply:5VDC.
Effectualangle:<15.
Rangingdistance:2cm500cm.
Resolution:1cm.
UltrasonicFrequency:40kHz.
Usage
http://www.elecrow.com/wiki/index.php?title=Ultrasonic_Ranging_Sensor_Module 2/5
19/2/2015 UltrasonicRangingSensorModuleElecrow
Ashortultrasonicpulseistransmittedatthetime0,reflectedbyanobject.Thesenorreceivesthissignal
andconvertsittoanelectricsignal.Thenextpulsecanbetransmittedwhentheechoisfadedaway.This
timeperiodiscalledcycleperiod.Therecommendcycleperiodshouldbenolessthan50ms.Ifa10s
widthtriggerpulseissenttothesignalpin,theUltrasonicmodulewilloutputeight40kHzultrasonicsignal
anddetecttheechoback.Themeasureddistanceisproportionaltotheechopulsewidthandcanbe
calculatedbytheformulaabove.Ifnoobstacleisdetected,theoutputpinwillgivea38mshighlevel
signal.
Hardware
http://www.elecrow.com/wiki/index.php?title=Ultrasonic_Ranging_Sensor_Module 3/5
19/2/2015 UltrasonicRangingSensorModuleElecrow
ConnectthistripleaxismagnetometerbreadkoutmoduletoyourArduino/CrowduinoI2Cwires(SDA:A4,
D18SCL:A5,D19)asbelow:
Programming
CopythefollowingprogramtoArduinoIDEanduploadtoyourArduino/Crowduino,youcanalso
downloadtheexampleintheResource(http://www.elecrow.com/wiki/index.php?
title=Triple_Axis_Magnetometer_Breakout#Resource).
#include"Ultrasonic.h"
Ultrasonicultrasonic(12,13);
voidsetup(){
Serial.begin(9600);
}
voidloop()
{
Serial.println(ultrasonic.Ranging(CM));
delay(100);
}
http://www.elecrow.com/wiki/index.php?title=Ultrasonic_Ranging_Sensor_Module 4/5
19/2/2015 UltrasonicRangingSensorModuleElecrow
OpentheSscom32terminalortheSerialmoniter,andsetthebaudrateto9600,youwillseetheoutput
changingwiththeobjectdistance.
Resource
File:UltrosonicrangermoduleLibraryanddemocodeforarduino10.zip
Retrievedfrom"http://www.elecrow.com/wiki/index.php?
title=Ultrasonic_Ranging_Sensor_Module&oldid=11307"
Thispagewaslastmodifiedon5November2014,at00:03.
Thispagehasbeenaccessed690times.
http://www.elecrow.com/wiki/index.php?title=Ultrasonic_Ranging_Sensor_Module 5/5