Ks0242 keyestudio EASY plug SR01 Ultrasonic Module: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
No edit summary
 
(20 intermediate revisions by the same user not shown)
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 control board. 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 steering gear of the cloud 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>
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>
<span style=color:red> '''Special Note:''' <br>
The sensor/module is equipped with the RJ11 6P6C interface, compatible with our keyestudio EASY plug Control Board with RJ11 6P6C interface. <br> If you have the control board of other brands, it is also equipped with the RJ11 6P6C interface but has different internal line sequence, can’t be used compatibly with our sensor/module. </span><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  
 
<br>
==Technical Details==
* Dimensions: 49mm*26mm*28mm
* Weight: 11.3g
* Weight: 11.3g


<br>[[File:KS0242-4.jpg|500px|frameless|thumb]]<br>
<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.jpg|500px|frameless|thumb]]<br>
 
<br>
==Upload the Code==
Below is an example code. Open or drag below code to [https://wiki.keyestudio.com/Getting_Started_with_Mixly  Mixly Blocks] and upload. <br>
<br>[[File:ks0398 19.1.png|600px|frameless|thumb]]<br>
<br>


==Connection Diagram ==
==What You Should See==
<br>[[File:KS0242-2.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>
<br>[[File:ks0242 Result.png|500px|frameless|thumb]]
<br>[[File:ks0398 19-1.png|500px|frameless|thumb]]<br>


==Sample Code==
<br>
<pre>
==Turn on Light==
#define echoPin 4 // Echo Pin
<br>
#define trigPin 3// Trigger Pin
When the measured distance between an obstacle and ultrasonic sensor is less than a certain range, turn the led on.<br>
#define LEDPin 13 // Onboard LED
<br>
'''Hookup Guide'''<br>
<br>[[File:超声波灯.jpg|500px|frameless|thumb]]<br>


int maximumRange = 200; // Maximum range needed
<br>
int minimumRange = 0; // Minimum range needed
'''Test Code'''<br>
long duration, distance; // Duration used to calculate distance
Below is an example code. Open or drag below code to [https://wiki.keyestudio.com/Getting_Started_with_Mixly  Mixly Blocks] and upload. <br>
<br>[[File:ks0398 19.2.png|600px|frameless|thumb]]<br>


void setup() {
<br>
Serial.begin (9600);
'''What You Should See'''<br>
pinMode(trigPin, OUTPUT);
Upload success, when the measured distance is less than 30, the LED will be turned on. Otherwise, the LED is turned off.
pinMode(echoPin, INPUT);
<br>[[File:ks0398 19-3.png|500px|frameless|thumb]]<br>
pinMode(LEDPin, OUTPUT); // Use LED indicator (if required)
<br>[[File:ks0398 19-2.png|500px|frameless|thumb]]<br>
}


void loop() {
<br>
/* The following trigPin/echoPin cycle is used to determine the
<span style="color: red">'''Little Knowledge:'''</span> <br>
distance of the nearest object by bouncing soundwaves off of it. */
* You can modify the setting distance in the code here, so that turn on or off led according to the obstacle distance measured by ultrasonic sensor.
digitalWrite(trigPin, LOW);
<br>[[File:ks0398 19-4.png|600px|frameless|thumb]]<br>
delayMicroseconds(2);


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


duration = pulseIn(echoPin, HIGH);
<br>


//Calculate the distance (in cm) based on the speed of sound.
==Resources ==
distance = duration/58.2;


if (distance >= maximumRange || distance <= minimumRange){
https://fs.keyestudio.com/KS0242
/* 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);
}
</pre>


==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.
<br>[[File:KS0242-3.png|500px|frameless|thumb]]<br>


==Resources ==
==Buy from ==
*[https://www.keyestudio.com/keyestudio-easy-plug-sr01-ultrasonic-sensor-module-for-arduino-robot-car-free-shipping-p0066-p0066.html  '''Official Website''' ]


'''Datasheet:''' <br>
*[https://www.aliexpress.com/store/product/Keyestudio-EASY-Plug-SR01-Ultrasonic-Sensor-Module-for-arduino-robot-car-free-shipping/1452162_32819745262.html?spm=2114.12010612.8148356.8.79054ba7IyVAuP  Shop on aliexpress ]
http://www.keyestudio.com/files/index/download/id/1500362507/


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


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

Latest revision as of 08:35, 8 January 2021

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.
This module should be used together with EASY plug control board.

thumb

Special Note:
The sensor/module is equipped with the RJ11 6P6C interface, compatible with our keyestudio EASY plug Control Board with RJ11 6P6C interface.
If you have the control board of other brands, it is also equipped with the RJ11 6P6C interface but has different internal line sequence, can’t be used compatibly with our sensor/module.


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


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

Below is an example code. Open or drag below code to Mixly Blocks and upload.

thumb

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


Turn on Light


When the measured distance between an obstacle and ultrasonic sensor is less than a certain range, turn the led on.

Hookup Guide

thumb


Test Code
Below is an example code. Open or drag below code to Mixly Blocks and upload.

thumb


What You Should See
Upload success, when the measured distance is less than 30, the LED will be turned on. Otherwise, the LED is turned off.
thumb

thumb


Little Knowledge:

  • You can modify the setting distance in the code here, so that turn on or off led according to the obstacle distance measured by ultrasonic sensor.


thumb



Resources

https://fs.keyestudio.com/KS0242



Buy from