Ks0120 keyestudio EASY plug Infrared Obstacle Avoidance Sensor: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
==EASY plug infrared obstacle avoidance sensor==
[[image:ks0120图.jpg|thumb|600px|right|EASY plug Obstacle Avoidance Sensor]]
<br>[[File:ks0120-1.png|500px|frameless|thumb]]<br>


==Introduction==
==Introduction==
Infrared obstacle avoidance sensor is equipped with distance adjustment function and is especially designed for wheeled robots. This sensor has strong adaptability to ambient light and is of high precision. It has a pair of infrared transmitting and receiving tube. When infrared ray launched by the transmitting tube encounters an obstacle (its reflector), the infrared ray is reflected to the receiving tube, and the indicator will light up. A robot mounted with the sensor can sense changes in the environment. <br>
Infrared obstacle avoidance sensor is equipped with distance adjustment function and is especially designed for wheeled robots.<br>
Note: this module needs to be used together with EASY plug control board.<br>
This sensor has strong adaptability to ambient light and is of high precision. It has a pair of infrared transmitting and receiving tube. <br>
When infrared ray launched by the transmitting tube encounters an obstacle (its reflector), the infrared ray is reflected to the receiving tube, after a comparator circuit processing, the indicator will light up. <br>
You can adjust the detection distance by rotating the potentiometer knob, the effective distance range of 2~40cm. <br>
They can be widely used in robot obstacle avoidance, avoidance car, line count, and black and white line tracking and many other occasions.<br>
This module should be used together with EASY plug control board.


<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==
* Interface: Easy plug
* Working voltage: DC 3.3V-5V
* Working voltage: DC 3.3V-5V
* Working current: ≥20mA
* Working current: ≥20mA
* Working temperature: -10℃—+50℃
* Working temperature: -10℃ to+50℃
* Detection distance: 2-1000px
* Detection distance: 2~40cm
* Output signal: TTL voltage
* Output signal: TTL voltage
* Effective Angle: 35°
* Effective Angle: 35°
* Size: 51*16.5mm
<br>
* Weight: 7g


==Technical Details==
* Dimensions: 52mm*17mm*18mm
* Weight: 6.2g


==Connection Diagram ==
<br>
<br>[[File:ks0120-2.png|500px|frameless|thumb]]<br>
==Connect It Up==
Connect the EASY Plug obstacle detector sensor and LED module to control board using RJ11 cables. Then connect the control board to your PC with a USB cable.
<br>[[File:避障灯.jpg|600px|frameless|thumb]]<br>


<br>
==Test 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 9.1.png|600px|frameless|thumb]]<br>


==Sample Code==
<br>
<pre>
==What You Should See==
const int sensorPin = 3;    // the number of the sensor pin
<br>[[File:ks0398 9-1.png|600px|frameless|thumb]]<br>
const int ledPin =  13;      // the number of the LED pin
<br>
int sensorState = 0;        // variable for reading the sensor status
Done uploading the code, when the sensor detects an obstacle, the led is turned on.
void setup() {
<br>[[File:ks0398 9-2.png|600px|frameless|thumb]]<br>
  pinMode(ledPin, OUTPUT);     
  pinMode(sensorPin, INPUT); }
void loop(){
  // read the state of the sensor value:
  sensorState = digitalRead(sensorPin);
  // if it is, the sensorState is HIGH:
  if (sensorState == HIGH) {   
    digitalWrite(ledPin, HIGH); 
  }
  else {
      digitalWrite(ledPin, LOW);
  }}


</pre>


<br>
==Controlling Motor ==
<br>
In the previous section, we use the obstacle detector sensor to control the LED on and off. Now, let’s try another play, controlling the motor rotating.
<br>
'''Hookup Guide'''<br>
<br>[[File:避障电机.jpg|600px|frameless|thumb]]<br>
<br>
'''Test Code'''<br>
<br>[[File:ks0398 9.2.png|600px|frameless|thumb]]<br>
<br>
'''What You Should See'''<br>
Done uploading the code, when the sensor detects an obstacle, the fan motor rotates. Otherwise, fan motor stops.
<br>[[File:ks0398 9-3.png|600px|frameless|thumb]]<br>
<br>
<span style="color: red">'''Troubleshooting:'''</span> <br>
* '''Compiling Fails ?'''<br>
This happens sometimes, the most likely case is a library file not added.  You should be sure that all the libraries are added to the libraries directory of Arduino-1.8.5. Shown below.<br>
<br>[[File:ks0398 9-4.png|600px|frameless|thumb]]<br>
<br>[[File:ks0398 9-5.png|600px|frameless|thumb]]<br>
* '''Program Not Uploading?'''<br>
This happens sometimes, the most likely case is a confused Board and serial port, you should firstly select your proper board and port.
<br>[[File:ks0398 9-6.png|600px|frameless|thumb]]<br>
<br>
<br>
==Resources ==
==Resources ==


https://fs.keyestudio.com/KS0120


'''PDF'''
<br>
 
https://drive.google.com/open?id=1CfudUxfXcDV7kbMPmSvEVgnUe9ERA3jw


==Buy from ==
==Buy from ==
'''Official Website'''
*[https://www.keyestudio.com/new-keyestudio-rj11-easy-plug-infrared-obstacle-avoidance-sensor-module-for-arduino-starter-steam-p0095-p0095.html '''Official Website''']
 
http://www.keyestudio.com/keyestudio-easy-plug-infrared-obstacle-avoidance-sensor-module-for-arduino-starter.html


*[https://www.aliexpress.com/store/product/New-Keyestudio-EASY-plug-Infrared-Obstacle-Avoidance-Sensor-Module-for-Arduino-Starter/1452162_32643747472.html?spm=2114.12010612.8148356.48.56374ba78C0BNr  Shop on aliexpress ]




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

Latest revision as of 16:22, 7 January 2021

EASY plug Obstacle Avoidance Sensor

Introduction

Infrared obstacle avoidance sensor is equipped with distance adjustment function and is especially designed for wheeled robots.
This sensor has strong adaptability to ambient light and is of high precision. It has a pair of infrared transmitting and receiving tube.
When infrared ray launched by the transmitting tube encounters an obstacle (its reflector), the infrared ray is reflected to the receiving tube, after a comparator circuit processing, the indicator will light up.
You can adjust the detection distance by rotating the potentiometer knob, the effective distance range of 2~40cm.
They can be widely used in robot obstacle avoidance, avoidance car, line count, and black and white line tracking and many other occasions.
This module should be used together with EASY plug control board.


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

  • Working voltage: DC 3.3V-5V
  • Working current: ≥20mA
  • Working temperature: -10℃ to+50℃
  • Detection distance: 2~40cm
  • Output signal: TTL voltage
  • Effective Angle: 35°


Technical Details

  • Dimensions: 52mm*17mm*18mm
  • Weight: 6.2g


Connect It Up

Connect the EASY Plug obstacle detector sensor and LED module to control board using RJ11 cables. Then connect the control board to your PC with a USB cable.
thumb


Test Code

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

thumb


What You Should See


thumb

Done uploading the code, when the sensor detects an obstacle, the led is turned on.
thumb



Controlling Motor


In the previous section, we use the obstacle detector sensor to control the LED on and off. Now, let’s try another play, controlling the motor rotating.
Hookup Guide

thumb


Test Code

thumb


What You Should See
Done uploading the code, when the sensor detects an obstacle, the fan motor rotates. Otherwise, fan motor stops.
thumb

Troubleshooting:

  • Compiling Fails ?

This happens sometimes, the most likely case is a library file not added. You should be sure that all the libraries are added to the libraries directory of Arduino-1.8.5. Shown below.

thumb

thumb

  • Program Not Uploading?

This happens sometimes, the most likely case is a confused Board and serial port, you should firstly select your proper board and port.
thumb


Resources

https://fs.keyestudio.com/KS0120


Buy from