photoresistor and POT command
wolff
Posts: 43
I'm trying to read light levels using a photoresistor and POT command (p-resister in series with .1uF cap) I get rather strange results. This is probably because the p-resistor range is way greater then the recommended 5-50K range. Can anyone show me an easy way to constrain the resistance range of the photoresistor?
THANKS ALL!
THANKS ALL!
Comments
What's the range of your resistor? You can use a smaller cap with a larger resistor. Did you use the SCALE command?
From http://www.tjhsst.edu/~jleaf/tec/stamp/sttutor1.htm :
Pot
Pot pin, scale, variable
The POT command allows the stamp to check for changes in resistance attached to a particular pin. A pin is connected to a variable resistance then to a capacitor and the other side of the capacitor is connected to the negative buss bar.
POT 2, 75, b2 This checks the resistance connected to pin 2 and saves the result in variable b2.
To use the POT statement, it is first necessary to find the scale value. Press ALT/P and select and enter the pin number. Vary the resistance full range and record the lowest number shown in the SCALE window. This is the number to use in the POT command. Press the space bar and note the READING window is now highlighted. Vary the resistance through the full range and record the highest and lowest numbers. These are the numbers which will be stored in the variable specified in the POT command. The resistances may be a thermistor, photo resistor, potentiometer, etc.
In the following program, the SCALE value and READING value will not be the same as yours.
START:
Dirs=00000000
Pins=00000000
FIRECHECK:
Pot 1, 100, b2
If b2>130 then START
For b3= 1 to 10
Sound 0,(90,100)
Next b3
Low 0
Goto FIRECHECK
"The resistor range goes from full open to fully closed (and all in between.)"
It's more like "megohms" (dark) and hundreds of ohms (light).
You could place a resistor in parallel with the "photoresistor": 50K ought to do it.