Download Netscape! |
Light Direction SensingBeing a proud Basic Stamp 2 owner, I thought I'd include the circuits I build with it on my site... The first Fully-Functionnal circuit I built with it was a circuit that blinks two LEDs according to the direction light comes onto its sensors... This circuit has no particular use, if not serving as a sensor for a mobile robot... I thought I'd include it anyways, for those of you who can find a use for it... The following circuit was built on a solderless breadboard and it will read the resistance of the two CdS cells and compare them. Depending on which cell most of the light comes on, one LED will light accordingly. The sensors were placed on a separate breadboard to allow better positionning. the sensors were placed close together and separated with a cardboard sheet to eliminate unwanted light. the circuit is built as follows: For those of you who would want to find an infrared source, you can replace the CdS cells with the following circuit, Q1 being and infrared phototransistor. The LEDs were triangular-shaped, pointing in the direction the light was coming from. Program listing: rightres var word 'variablesleftres var word main: HIGH 0 'make pins 0 and 1 HIGH to discharge capacitors HIGH 1 PAUSE 1 'wait for capacitors to discharge RCTIME 0,1,rightres 'get discharge time from both CdS cells RCTIME 1,1,leftres rightres=rightres/10 'divide by ten to eliminate excess precision leftres=leftres/10 IF rightres>leftres THEN rightLED IF leftres>rightres THEN leftLED GOTO main 'loop rightLED: HIGH 15 'turn first LED on PAUSE 100 'custom time... LOW 15 'turn first LED off PAUSE 100 RETURN 'go back to program leftLED: 'same but with other LED HIGH 14 PAUSE 100 LOW 14 PAUSE 100 RETURN 'go back to program Martin-Luc Girard |
|
Any comments? E-Mail the Webmaster |