KS0352 Keyestudio KEYBOT Programmable Robot 3-way Line Tracking Sensor
Keyestudio KEYBOT Programmable Robot 3-way Line Tracking Sensor
Overview
This Keyestudio three-way tracking sensor needs to be used together with the EASY plug Control board V2.0. The module is connected to the SPI interface with only one wire, which is very convenient and simple. The module comes with two round holes, easy to fix it on other devices.
It is also an infrared sensor. The component used here is TCRT5000 infrared tube. The working principle is to use the different reflectivity of infrared light to color, converting the strength of the reflected signal into a current signal.
During the detection, black is active at HIGH level, and white is active at LOW. The detection height is 0-3 cm. We have integrated three groups of TCRT5000 infrared tubes on a single board, more convenient for wiring and control. By rotating the adjustable resistance part, you can adjust the sensitivity of the sensor.
Parameters
- Operating Voltage: 3.3-5V(DC)
- Output Signal: Digital Signal
- Detection Height: 0-3cm
Details Display
Connect it Up
Below connect this 3-way tracking sensor and three LED modules to keyestudio Easy-plug control board V2.0, shown below. Let’s do a simple test.
Example Code
Upload the code below to the board:
int S1 = 10; // define the S1 tracking sensor as pin D10 int S2 = 11; //define the S2 tracking sensor as pin D11 int S3 = 12; // define the S3 tracking sensor as pin D12 int led1 =7; //define led1 as pin D7 int led2 =8; // define led2 as pin D8 int led3 =9; // define led3 as pin D9 void setup() { pinMode(S1, INPUT); // define tracking sensor S1 as INPUT mode pinMode(S2, INPUT); // define tracking sensor S2 as INPUT mode pinMode(S3, INPUT); // define tracking sensor S3 as INPUT mode pinMode(led1,OUTPUT);//define led1 as OUTPUT mode pinMode(led2,OUTPUT);//define led2 as OUTPUT mode pinMode(led3,OUTPUT);//define led3 as OUTPUT mode } void loop() { if( digitalRead(S1)==LOW) // read the state of sensor S1, if detects a white paper, it is at LOW. { digitalWrite(led1, HIGH); // led1 lights } else // or else { digitalWrite(led1, LOW); // led1 off } if( digitalRead(S2)==LOW) // read the state of sensor S2, if detects a white paper, it is at LOW. { digitalWrite(led2, HIGH); // led2 lights } else // or else { digitalWrite(led2, LOW); // led2 off } if( digitalRead(S3)==LOW) // read the state of sensor S3, if detects a white paper, it is at LOW. { digitalWrite(led3, HIGH); // led3 lights } else // or else { digitalWrite(led3, LOW); // led3 off } }
Example Result
After wiring and uploading the code, when use a black object to block the three groups of TCRT5000 infrared tube, three external LED modules do not light. If pick up a white object to cover three groups of TCRT5000 infrared tube, three external LEDs light up.
Resources