Shop OBEX P1 Docs P2 Docs Learn Events
photoresistor and POT command — Parallax Forums

photoresistor and POT command

wolffwolff Posts: 43
edited 2013-04-05 20:54 in General Discussion
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!

Comments

  • ercoerco Posts: 20,256
    edited 2013-04-04 17:43
    A good old BS1 question!

    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
  • wolffwolff Posts: 43
    edited 2013-04-04 18:48
    The resistor range goes from full open to fully closed (and all in between.) That is the problem. I know how to use the POT function but the RC circuit is really only set up for a resistance between 5-50K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2013-04-05 19:21
    Depending what's in your stock box, you could try a lower value capacitor till you hit it right.

    "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.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-04-05 20:54
    Just FYI. Cross posting is not allowed in the forums. You have this same thread in the Sensors forum.
Sign In or Register to comment.