(SKU:RB-02S003)Mini IR Detector Photoelectric Sensor

From ALSRobot-Wki
Jump to: navigation, search
Mini红外避障传感器01.jpg

Contents

overview

This Mini IR Detector sensor module is researched and produced by Harbin Alseon Robotics Technology Co., Ltd. .The Mini IR Detector sensor module is a distance adjustable sensor. It has high adaptability to ambient light with high accuracy. It comes with transmitter and receiver. The transmitter transmits certain frequency IR and when IR hits into obstacles, it reflects and is received by the receiver and indicator lights up. After being processed by circuit, signal output port outputs digital signal and then detect the distance through potentiometer. The Detecting distance range is 2-40cm. Working voltage range is 3.3v-5v. For the wide rang of fluctuation of voltage, it can be applied to various microcontroller.

Technical parameters and performance

  1. Working voltage: DC 3.3V-5V
  2. Working current: 20mA
  3. Working temperature: -10°C-+50°C
  4. Detecting distanc: 2-40cm
  5. IO port: 4coil port (-/+/S/EN)
  6. Output signal: TTL (low voltage with obstacles, high voltage without obstacles)
  7. Adjust mode: multi-turn resistance
  8. Effective angle: 35°
  9. Dimensions: 28mm x 23mm
  10. Weight: 5g

using method

Pin definition

  • EN (sensor enable): set high, the sensor does not work; set a low, sensor work.
  • S (reflective signal output): when the EN set is low, if the object is not detected, the S port remains high; if the object is detected, the S port is set low.
  • +:external power supply Vcc.
  • -:External power supply GND.
Mini ir detector.jpg
  1. sensor interface: 4 circuit board, labeled EN, S, +, -. Respectively is the sensor enable port, the detection signal output port, Vcc, GND.
  2. enable jumper cap: when the user wants to let the sensor has been in the work of the state. In other words, the user does not need to automatically control the sensor is working, then can the jumper cap in gill, EN pin can and do not take any line. When the user wants to control their own sensors are working to remove the jumper cap, en Port is connected to the user's own controller port.
  3. distance adjustment potentiometer is used to adjust the sensor to detect the distance, when users need to adjust the detection distance, using a screwdriver adjustment potentiometer, according to the direction of the arrow rotation (clockwise) is the detection distance decreases, rotating in the opposite direction detection distance increases.
  4. frequency adjust potentiometer is used to generate 38KHz frequency: Fang Bo. Under normal circumstances, in the factory the resistance good tune without user adjustment. But due to the different or vibration of the external environment, to receive the reflected signal, then the user can fine tune the potentiometer 2, until there are obstacles to received signal, indicating lamps (LED) light can.


Connect Icon

Bzjx123.jpg

Step 1: wiring.
Before connecting the first, according to the need to determine whether the need to control the sensor to port. If you do not select a control port, the jumper cap is inserted in the double row needle, then only need cable connection s, +, - three port, pay attention to positive and negative pole power don't reversed. If you choose to control sensor enable, unplug the jumper cap and put it where it can be found, then need to use cable to connect en, s, +, - four ports. EN and S ports are generally connected to the I/O port of the controller. +, - received Vcc and GND.
Step 2: fixed.
According to the passage diameter of 3mm connections (pillars, screws, bolts) fixed. The installation height of the sensor and the color of the reflected color determine whether a reliable signal can be obtained. If the sensor installation is low, the infrared emission tube raise some, or with small directional tubes (such as heat shrinkable tube) set to the infrared emission tube. In order to avoid the error free, do not install the sensor on the robot's motion mechanism, except for special needs.
Step 3: programming.
According to the true value table of the port state, it is used for programming.

Mini红外避障传感器03.jpg


Sample code

int bizhangPin = 2;
int ledPin =  13;     
int buttonState = 0;        
void setup() {
  pinMode(ledPin, OUTPUT);      
  pinMode(bizhangPin, INPUT);     
}

void loop(){
  buttonState = digitalRead(bizhangPin);
  if (buttonState == LOW) {       
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    digitalWrite(ledPin, LOW); 
  }
}

Program effect

  1. pinout diagram module according to connect the probe module, do not take the wrong;
  2. At this time lights off, the corresponding output (S) output TTL low level;
  3. obstacle avoidance module of infrared probe alignment walls or other obstacles, distance 2~40cm centimeters in, when the indicator light, corresponding output (s) TTL outputs high level;

Application Routine

Test of Mini infrared obstacle avoidance sensor module
We use the Arduino controller and 2WD car to do this test, to use the hardware device is as follows:
1 Arduino Controller x 1
2 Arduino sensor expansion board x 1
3 Mini infrared obstacle avoidance sensor module x 3
4 2WD car x 1
5 sensor bracket x 1
6 general 3P sensor connection line x 3
7 DuPont line
8 USB data communication line x 1
From the two through the adjustment frequency and adjustable potentiometer, to fit our detection distance. There are obstacles in the low level, no obstacle to the high level. The jumper cap plug is always let sensor work, it can pull through the control enable end to the sensors are working.

int pinI1=8;
int pinI2=9;
int speedpin=11;
int pinI3=6;
int pinI4=7;
int speedpin1=10;
int IRR=3;
int IRM=4;
int IRL=5;
void setup()
{
  pinMode(pinI1,OUTPUT);
pinMode(pinI2,OUTPUT);
  pinMode(speedpin,OUTPUT);
  pinMode(pinI3,OUTPUT);
  pinMode(pinI4,OUTPUT);
  pinMode(speedpin1,OUTPUT);
  pinMode(IRR,INPUT);
  pinMode(IRM,INPUT);
  pinMode(IRL,INPUT);
}
void advance(int a)
{
     analogWrite(speedpin,a);
     analogWrite(speedpin1,a);
     digitalWrite(pinI4,LOW);
     digitalWrite(pinI3,HIGH);
     digitalWrite(pinI1,LOW);
     digitalWrite(pinI2,HIGH);
}
void right(int b)
{
     analogWrite(speedpin,b);
     analogWrite(speedpin1,b);
     digitalWrite(pinI4,HIGH);
     digitalWrite(pinI3,LOW);
     digitalWrite(pinI1,LOW);
     digitalWrite(pinI2,HIGH);
}
void left(int c)
{
     analogWrite(speedpin,c);
     analogWrite(speedpin1,c);
     digitalWrite(pinI4,LOW);
     digitalWrite(pinI3,HIGH);
     digitalWrite(pinI1,HIGH);
     digitalWrite(pinI2,LOW);
}
void stop()
{
     digitalWrite(pinI4,HIGH);
     digitalWrite(pinI3,HIGH);
     digitalWrite(pinI1,HIGH);
     digitalWrite(pinI2,HIGH);
}
void back(int d)
{
     analogWrite(speedpin,d);
     analogWrite(speedpin1,d);
     digitalWrite(pinI4,HIGH);
     digitalWrite(pinI3,LOW);
     digitalWrite(pinI1,HIGH);
     digitalWrite(pinI2,LOW);
}
void loop()
{
    int r,m,l;
    r=digitalRead(IRR);
    m=digitalRead(IRM);
    l=digitalRead(IRL);
    if(l==HIGH &&m==HIGH && r==HIGH)
    advance(120);
    if(l==LOW &&m==LOW  && r==LOW )
      {
        back(120);
        delay(300);
        right(100);
        delay(100);
      }
    if(l==LOW &&m==HIGH  && r==LOW )
      {
        back(120);
        delay(300);
        right(100);
        delay(100);
      }
    if(l==HIGH  &&m==LOW  &&  r == HIGH  )
          {
        back(120);
        delay(300);
        right(100);
        delay(100);
      }
    if(l==LOW && m==LOW  && r ==HIGH )
    right(100);
    if(l==LOW && m==HIGH  && r ==HIGH)
right(80);
    if(l==HIGH && m==LOW  && r == LOW )
    left(100);
    if(l==HIGH && m==HIGH  && r==LOW )
    left(80);
  }

Product recommendation

Buy address:Mini IR Detector Photoelectric Sensor

Personal tools
Namespaces

Variants
Actions
Navigation
Tools