Ks0120 keyestudio EASY plug Infrared Obstacle Avoidance Sensor

From Keyestudio Wiki
Jump to: navigation, search
EASY plug Obstacle Avoidance Sensor


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


  • 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 to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.

Upload the Code

Copy and paste below code to Arduino IDE and upload.

const int sensorPin=6;// the sensor pin
const int ledPin=13;// the LED pin
int sensorState=0;// variable for reading the sensor status
void setup(){
void loop() {
// read the state of the sensor value:
// if it is, the sensorState is HIGH:

What You Should See

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


Download the PDF:

Download the Code:

Buy from