Circuit for Photoresistor with high sampling rate
B_Gulliver
Posts: 4
I was wondering if anyone knew how to make a circuit on the basic stamp that would allow me to sample light intensity detected by a photoresistor faster than the example presented in the "What's a Microcontroller" manual.
Imagine an application in which a piece of reflective tape is placed on a rotating shaft. A small circuit is created that shines an IR LED at the shaft and a photoresister is connected to the basic stamp that detects the reflection of the IR light off the tape during each revolution. I would like to monitor for a momentary spike in light intensity, however the event might only last 1ms. Using a timer, I can calculate shaft RPM. I've followed the example in the book, and even after removing the "Pause 100" line, the refresh rate of the photoresister appears slow. It seems that when the light intensity is low (and the RCTIME time is high) it takes about 500ms+ to recharge the capacitor. Is there a more direct approach to using a photoresister without the use of a capacitor that gives a reading of the light intensity faster?·
(Figure 7-2) Photoresistor RC-time Circuit Schematic
P2 ----/\/\/
+
+
···· (220 Ohm)··· |········ |
················· |········ |
········ (Photeresistor)··· =· (0.01 uF)
················· |········ |
················· |········ |
················· +
+
················· |
················· |
················ Vss
Example Program: TestPhotoresistor.bs2 on Page 192 - What's a Microcontroller?
' {$STAMP BS2}
' {$PBASIC 2.5}
time····· VAR···· Word
DO
·· HIGH 2
·· PAUSE 100
·· RCTIME 2, 1, time
·· DEBUG HOME, "time = ", DEC5 time
LOOP
Imagine an application in which a piece of reflective tape is placed on a rotating shaft. A small circuit is created that shines an IR LED at the shaft and a photoresister is connected to the basic stamp that detects the reflection of the IR light off the tape during each revolution. I would like to monitor for a momentary spike in light intensity, however the event might only last 1ms. Using a timer, I can calculate shaft RPM. I've followed the example in the book, and even after removing the "Pause 100" line, the refresh rate of the photoresister appears slow. It seems that when the light intensity is low (and the RCTIME time is high) it takes about 500ms+ to recharge the capacitor. Is there a more direct approach to using a photoresister without the use of a capacitor that gives a reading of the light intensity faster?·
(Figure 7-2) Photoresistor RC-time Circuit Schematic
P2 ----/\/\/
+
+
···· (220 Ohm)··· |········ |
················· |········ |
········ (Photeresistor)··· =· (0.01 uF)
················· |········ |
················· |········ |
················· +
+
················· |
················· |
················ Vss
Example Program: TestPhotoresistor.bs2 on Page 192 - What's a Microcontroller?
' {$STAMP BS2}
' {$PBASIC 2.5}
time····· VAR···· Word
DO
·· HIGH 2
·· PAUSE 100
·· RCTIME 2, 1, time
·· DEBUG HOME, "time = ", DEC5 time
LOOP
Comments
The COUNT command is used to count the number of pulses per a unit time to determe RPM.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
StampPlot - Graphical Data Acquisition and Control
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
I'm very impressed with the Basic Stamp community and their ability to help others. Keep up the great work!