TCRT5000 infrared sensor

Module data:

1. Detection distance: 1 ~ 8mm

2. Operating voltage: 3.3 ~ 5V

3.4 Interface

 The positive supply VCC

 Signal OUT is an output, represents a measuring surface darker, 0 represents the output of the measurement face lighter

 GND negative one

working principle:

  The infrared sensor continuously emits infrared rays on the tube, when the infrared rays emitted is not reflected or reflected intensity is not big enough, the phototransistor has been in the OFF state, the module output is low, indicating the diode remains off state . It occurs when an object is detected within the detection range, and the intensity of the reflected infrared rays are sufficiently large, the saturation phototransistor, when the output is high, indicator LED is illuminated.

Precautions:

1. The infrared pipe toward the ground needs.

Adjustable resistance needs to be adjusted (on the cross module) 2. module, to find the optimal detection distance. Otherwise infrared module high probability not meet usage.

Test routines:

 1 int Val;
 2 int PIN=3;
 3 void setup() {
 4   pinMode(PIN,INPUT);
 5   Serial.begin(9600);
 6 }
 7 
 8 void loop() {
 9   Val = digitalRead(PIN);
10   if(Val = 1)
11     Serial.println("Black");
12   else
13     Serial.println("White");
14   delay(100);
15 }

 

Guess you like

Origin www.cnblogs.com/Rane/p/11925084.html