Ks0242 keyestudio EASY plug SR01 Ultrasonic Module: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
==EASY Plug SR01Ultrasonic Module==
[[image:ks0242图.jpg|thumb|600px|right|EASY plug SR01 Ultrasonic Module]]
<br>[[File:KS0242-1.png|500px|frameless|thumb]]<br>




==Introduction==
==Introduction==
The EASY plug SR01 ultrasonic module needs to be used with the EASY plug Control board V2.0. The module is connected to the double digital port interface with only one line,which is very easy and convenient. This module includes ultrasonic transmitter, receiver and corresponding control circuit. The module comes with four round holes, so that customers can put the module to be fixed on other devices, such as the servo plastic platform and so on.<br>
The distance sensor are really common in robotics projects, very useful for automation, interactive art and motion sensing. <br>
This EASY Plug SR01 Ultrasonic integrates ultrasonic transmitter, receiver and corresponding control circuit.<br>
It should be connected to the double digital interface with only one line, which is very easy to use and convenient for connection. <br>
The module comes with four fixed holes, so that can easily fix it on other devices, such as the servo plastic platform and so on. <br>
<span style="color: red">'''Note: ''' this module should be used together with EASY plug control board.<br>
<br>[[File:KS0242-.jpg|500px|frameless|thumb]]<br>
<br>[[File:KS0242-.jpg|500px|frameless|thumb]]<br>


<br>
==Specification==
==Specification==
* Working Voltage: DC 5V
* Operating Voltage: DC 5V
* Working Current: 15mA
* Operating Current: 15mA
* Working Frequency: 40KHz
* Operating Frequency: 40KHz
* Max Range: 3--5m
* Max Range: 3--5m
* Min Range: 2cm
* Min Range: 2cm
* Measuring Angle: 15 degree
* Measuring Angle: 15 degree
* Trigger Input Signal: 10µS TTL pulse
* Trigger Input Signal: 10µS TTL pulse
* Interface:double digital interface
* Interface:double digital  
* Weight: 11.3g
 
<br>[[File:KS0242-4.jpg|500px|frameless|thumb]]<br>
<br>[[File:KS0242-4.jpg|500px|frameless|thumb]]<br>


==Connection Diagram ==
<br>
<br>[[File:KS0242-2.png|500px|frameless|thumb]]<br>
==Technical Details==
* Dimensions: 49mm*26mm*28mm
* Weight: 11.3g


<br>
==Connect It Up==
Connect the EASY Plug Ultrasonic module to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
<br>[[File:KS0242.png|500px|frameless|thumb]]<br>


==Sample Code==
<br>
==Upload the Code==
Copy and paste below code to [http://wiki.keyestudio.com/index.php/How_to_Download_Arduino_IDE Arduino IDE] and upload.
<pre>
<pre>
#define echoPin 4 // Echo Pin
#define echoPin 4 // Echo Pin
Line 52: Line 62:


  duration = pulseIn(echoPin, HIGH);
  duration = pulseIn(echoPin, HIGH);
 
  //Calculate the distance (in cm) based on the speed of sound.
  //Calculate the distance (in cm) based on the speed of sound.
  distance = duration/58.2;
  distance = duration/58.2;
 
  if (distance >= maximumRange || distance <= minimumRange){
  if (distance >= maximumRange || distance <= minimumRange){
  /* Send a negative number to computer and Turn LED ON  
  /* Send a negative number to computer and Turn LED ON  
Line 68: Line 78:
  digitalWrite(LEDPin, LOW);  
  digitalWrite(LEDPin, LOW);  
  }
  }
 
  //Delay 50ms before next reading.
  //Delay 50ms before next reading.
  delay(50);
  delay(50);
Line 74: Line 84:
</pre>
</pre>


==Test Result==
<br>
After connecting the power and burning the code, please open the serial monitor, and set 9600 baud rate, you can see the distance between ultrasonic and obstacle, as the diagram shown below.
==What You Should See==
<br>[[File:KS0242-3.png|500px|frameless|thumb]]<br>
Done uploading the code, open the serial monitor and set the baud rate to 9600. You should see the measured distance between the ultrasonic sensor and front obstacle.
<br>[[File:ks0242 Result.png|500px|frameless|thumb]]  [[File:ks0242 Result1.gif|500px|frameless|thumb]]<br>


<br>
==Resources ==
==Resources ==
'''Datasheet:''' <br>
'''Datasheet:''' <br>
https://drive.google.com/open?id=1cExRhWZXi2EJNH3RCE8IDsD-482UCNwL
https://drive.google.com/open?id=1cExRhWZXi2EJNH3RCE8IDsD-482UCNwL


<br>
==Buy from ==
==Buy from ==
'''Official Website'''
'''Official Website'''<br>
http://www.keyestudio.com/easy-plug-sr01-ultrasonic-module.html


http://www.keyestudio.com/easy-plug-sr01-ultrasonic-module.html


[[category:EASY Plug]]
[[category:EASY Plug]]

Revision as of 11:47, 23 November 2018

EASY plug SR01 Ultrasonic Module


Introduction

The distance sensor are really common in robotics projects, very useful for automation, interactive art and motion sensing.
This EASY Plug SR01 Ultrasonic integrates ultrasonic transmitter, receiver and corresponding control circuit.
It should be connected to the double digital interface with only one line, which is very easy to use and convenient for connection.
The module comes with four fixed holes, so that can easily fix it on other devices, such as the servo plastic platform and so on.
Note: this module should be used together with EASY plug control board.

thumb


Specification

  • Operating Voltage: DC 5V
  • Operating Current: 15mA
  • Operating Frequency: 40KHz
  • Max Range: 3--5m
  • Min Range: 2cm
  • Measuring Angle: 15 degree
  • Trigger Input Signal: 10µS TTL pulse
  • Interface:double digital


thumb


Technical Details

  • Dimensions: 49mm*26mm*28mm
  • Weight: 11.3g


Connect It Up

Connect the EASY Plug Ultrasonic module to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
thumb


Upload the Code

Copy and paste below code to Arduino IDE and upload.

#define echoPin 4 // Echo Pin
#define trigPin 3// Trigger Pin
#define LEDPin 13 // Onboard LED

int maximumRange = 200; // Maximum range needed
int minimumRange = 0; // Minimum range needed
long duration, distance; // Duration used to calculate distance

void setup() {
 Serial.begin (9600);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
 pinMode(LEDPin, OUTPUT); // Use LED indicator (if required)
}

void loop() {
/* The following trigPin/echoPin cycle is used to determine the
 distance of the nearest object by bouncing soundwaves off of it. */ 
 digitalWrite(trigPin, LOW); 
 delayMicroseconds(2); 

 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10); 
 digitalWrite(trigPin, LOW);

 duration = pulseIn(echoPin, HIGH);
 
 //Calculate the distance (in cm) based on the speed of sound.
 distance = duration/58.2;
 
 if (distance >= maximumRange || distance <= minimumRange){
 /* Send a negative number to computer and Turn LED ON 
 to indicate "out of range" */
 Serial.println("-1");
 digitalWrite(LEDPin, HIGH); 
 }
 else {
 /* Send the distance to the computer using Serial protocol, and
 turn LED OFF to indicate successful reading. */
 Serial.println(distance);
 digitalWrite(LEDPin, LOW); 
 }
 
 //Delay 50ms before next reading.
 delay(50);
}


What You Should See

Done uploading the code, open the serial monitor and set the baud rate to 9600. You should see the measured distance between the ultrasonic sensor and front obstacle.
thumb thumb


Resources

Datasheet:
https://drive.google.com/open?id=1cExRhWZXi2EJNH3RCE8IDsD-482UCNwL


Buy from

Official Website
http://www.keyestudio.com/easy-plug-sr01-ultrasonic-module.html