KS0328 Keyestudio HR-SR04 Blue Ultrasonic Module

From Keyestudio Wiki
Revision as of 14:55, 29 April 2019 by Keyestudio (talk | contribs)
Jump to navigation Jump to search


Keyestudio HR-SR04 Blue Ultrasonic Module 3PCS


thumb


Introduction

This kit includes three HR-SR04 ultrasonic modules. As the ultrasonic has strong directivity, slow energy consumption and far spread distance in the media, so it is commonly used in the measurement of distance, such as range finder and position measuring instrument. Using ultrasonic is more rapid, convenient, simple to calculate and more easier to achieve real-time control, so it has also been widely used in the development of mobile robots.
Ultrasonic detector module can provide 2cm-450cm non-contact sensing distance, and its ranging accuracy is up to 3mm, very good to meet the normal requirements. The module includes an ultrasonic transmitter and receiver as well as the corresponding control circuit.


Working Schematics

Please refer to the working sequence as below:


thumb

  • 1. First pull down the TRIG, and then trigger it with at least 10us high level signal;
  • 2. After triggering, the module will automatically transmit eight 40KHZ square waves, and automatically detect whether there is a signal to return.
  • 3. If there is a signal return, through the ECHO to output a high level, the duration time of high level is actually the time from emission to reception of ultrasonic.

Test distance = high level duration * 340m/s * 0.5.


Parameters

  • 1)Working Voltage: 0.5V(DC)
  • 2)Working Current: 15mA
  • 3)Detecting Range: 2-450cm
  • 4)Detecting Angle: 15 degrees
  • 5)Input Trigger Pulse: 10us TTL Level
  • 6)Output Echo Signal: output TTL level signal (HIGH), proportional to range.


Dimensions


thumb


Connection Diagram


thumb


Test Code

Copy and paste the test code below to Arduino software:

int inputPin=4; // define ultrasonic signal receiver pin ECHO to D4 
int outputPin=5; // define ultrasonic signal transmitter pin TRIG to D5
 void setup()

{
Serial.begin(9600); 
pinMode(inputPin, INPUT); 
pinMode(outputPin, OUTPUT);
}

void loop()
{
digitalWrite(outputPin, LOW); delayMicroseconds(2);
digitalWrite(outputPin, HIGH); // Pulse for 10μ s to trigger ultrasonic detection
delayMicroseconds(10); 
digitalWrite(outputPin, LOW);
int distance = pulseIn(inputPin, HIGH); // Read receiver pulse time 
distance= distance/58; // Transform pulse time to distance 
Serial.println(distance); //Output distance
delay(50);
}


Example Result


thumb
After upload well the code to UNO board, then open the serial monitor. When place an object in front of ultrasonic sensor (from near and far), it will detect the distance of object. You should see the value is displayed on the monitor shown below.
thumb

thumb


Packaging Display


thumb



Resource

  • Click the link below to download the datasheet:

https://drive.google.com/open?id=1eQnowUm-D3smr4gNvCTVAJzWtLlgMTqC


Get One Now