Brick-ReflectiveTrackSensor

From ArduinoInfo
Jump to: navigation, search

Reflective Track Sensor Electronic BrickReflectiveSensorXinda-500.jpg

(Available HERE:)

This Reflective Track Sensor Electronic Brick has an Infrared LED and Photodetector pointing away from the PC Board top.

NOTE: The pinout of this brick is NOT the same as our standard 3-pin cables. Use separate wires (like those shown, taken from a CableMaker strip). Or a Flat-to-Separate Cable.

ReflTrackBrick-500.jpgThis acts like a simple switch when it gets close to a reflective / white / light object. You can adjust the sensitivity with the potentiometer. It uses a LM393 Comparator chip and TRCT5000 sensor for clean outputs.

Sensitivity: About 1 inch (2.5cm) from white paper, about 1 cm from a person's finger.

Here is a sample Software Sketch you can cut and paste to test it:

/* YourDuino Electronic Brick Test: 
 Single Track Reflective Sensor AB-010201
 terry@yourduino.com */

/*-----( Declare Constants )-----*/
#define SWITCHPIN 3
#define LEDPIN    13  // The onboard LED

/*-----( Declare Variables )-----*/
int  switch_state;  /* Holds the last state of the switch */

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  pinMode(LEDPIN, OUTPUT);

}/*--(end setup )---*/


void loop()   /*----( LOOP: RUNS CONSTANTLY )----*/

// This module is ACTIVE LOW when a reflection is seen
{

  switch_state = digitalRead(SWITCHPIN);
  if (switch_state == LOW)
  {
    digitalWrite(LEDPIN, HIGH);
  }
  else
  {
    digitalWrite(LEDPIN, LOW);
  }
}/* --(end main loop )-- */

/* ( THE END ) */