Shop OBEX P1 Docs P2 Docs Learn Events
photoresistor — Parallax Forums

photoresistor

HockeyHockey Posts: 7
edited 2006-02-13 21:08 in BASIC Stamp
I am new to the Basic stamp and having been trying new circuits with it for about a month now.· I have a project that I need some help with.· I would like to set up a 4x4 grid of photoresistors.· Using a laser pointer hitting each of the resistors, I would like to be able to tell when an object passes over the photoresistor and know which resistor the object passed over.· Can any one help get me started I do not think that the rctime command is what I want as all I am looking for is a simple 0 or 1 when a object passes thru the sensor.· So basically, I guess I just want help building a very simple break light sensor.
·
Thanks
Mike

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-13 01:38
    · You need to find out how low it will go.·

    · You could probably use·them just·like a switch array, basically (lots of info on that,·refer to·the Nuts&Volts articles over in documents at the parallax site.)

    · Photoresistors are slow, in comparison with photodiodes and phototransistors.· Cd-S, I think, are· most responsive in the yellow-green region, but I'm sure that most visible light will have an effect on them.

    · To see if you can use it as an INPUT, connect the photoresistor between Input pin and Ground and connect a resistor (2.2K) between that same input pin and VDD.· Then see if you can detect anything with an INPUT instruction (this would be a LO-going voltage when the light shines on it.)

    · You could trigger an OUTPUT with an LED attached to it to confirm response with.


    Post Edited (PJ Allen) : 2/13/2006 1:41:15 AM GMT
  • HockeyHockey Posts: 7
    edited 2006-02-13 02:01
    Ok this is what i tried.

    p2 --> to photoresister
    Vdd --> to photoresister
    photoresister --> Vss

    then ran this code:

    '{$stamp bs2}
    '{$pbasic 2.5}

    do

    debug ? in2

    loop


    i recieved this in the debug window

    in2 = 1

    then put the light on the photo resister and no change.

    Does this mean it will not work or did i screw something up in building the cirucit?

    thanks for the help so for.
    M
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-13 12:49
    · Hope you have a voltmeter -- you need to measure the voltage with the photoresistor: 1) when dark, and, 2)·when 'illuminated'.
    · In daylight they usually go down to 200ohms, which would pretty much take the input pin to 'ground'.· With a laser (laser pointer) I don't know.· Another·matter is how much of the photoresistor area is illuminated (just a tiny dot?)

    · You'll have to experiment, so you'll need the voltmeter.

    · Another experiment would be to use an ohmmeter.· Measure the photoresistor's resistance/s, out of circuit (all by itself, disconnected from anything else.)
  • HockeyHockey Posts: 7
    edited 2006-02-13 13:30
    OK i will give that a try this afternoon.

    Thanks for the ideas.

    M
  • HockeyHockey Posts: 7
    edited 2006-02-13 17:51
    Ok,

    Bad circuit building need help correcting it.· Or maybe I got lucky and this is an OK circuit

    Vdd --> photoResistor (side a)

    p2 --> photoResistor (side b) --> 220k resister --> Vss

    When I run the code from above:

    in2 = 0

    I put a laser pointer on the photoresistor i get

    in2 = 1

    Pretty much what I wanted.· But I think that is probably a bad circuit design.· Any help would be great.

    Rember the ultamate goal is a 4 x 4 matrix.

    thanks
    Mike





    ·
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-13 17:57
    This way?

    [noparse][[/noparse] see attached ]
    bmp
    111K
    PR.bmp 111.1K
  • HockeyHockey Posts: 7
    edited 2006-02-13 18:13
    Nope that is the way I had it. and I do not get a different signal w/ the laser pointer is on the photoresister or not.

    Using your diagram all i get is in2 = 1 no mater what if the laser pointer is on the photoresisotor or not.

    So I put it back to the

    Vdd --> photoResistor (side a)

    p2 --> photoResistor (side b) --> 220k resister --> Vss

    and I get a difference in signal w/ and w/ out the laser.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-13 18:49
    Did you use a 2.2K (as opposed to a 220K)?

    With the circuit you describe, you are drawing current through the photoresistor when it's on/illuminated (depending on its resistance then, it might not be such a great idea.)

    But, anyway, so long as you're happy...
  • HockeyHockey Posts: 7
    edited 2006-02-13 18:52
    i used a red red brown (which i thought was 2.2 K)


    I agree that its not a great way for the desgin but it was the only way to get it to register the input. If I could change it to the other that would be great.

    M
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-13 18:54
    red red brown = 220 ohms

    maybe you have a 4.7 k?· yellow violet red
  • HockeyHockey Posts: 7
    edited 2006-02-13 19:24
    Ohhh, now i know why I am still new to this.

    I was uing the 220 ohms. I checked and did not have a 2.2K resistor but I did have a 2K resistor (red black red) I put the circuit back to your drawing and get a one w/ no laser pointer and a 0 with the laster pointer.

    Thanks a bunch for your help.

    M
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-13 21:08
    Hockey said...
    I put the circuit back to your drawing and get a one w/ no laser pointer and a 0 with the laster pointer.
    · Yep --·when dark, the·Input is HI, the PR is at high resistance & most of the voltage is across the PR; when lit the Input goes LO,·the PR is at low resistance &·most of the voltage is across the limiting resistor.·
    · This way you aren't running a lot of current through your PR (they appreciate that.)· You could probably use a higher value limiting resistor (try 10K -- brown black orange)

    Post Edited (PJ Allen) : 2/13/2006 9:11:22 PM GMT
Sign In or Register to comment.