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

stupid photoresistor question

blittleblittle Posts: 19
edited 2007-09-21 10:12 in BASIC Stamp
I know this is dumb and very elementary but..
Is there a simple way to set a pin high with a photoresistor without resorting to adding a capacitor and using rctime?
I'm basically using a white led and the photoresistor to isolate an industrial 17vdc sensor.
It works using the aforementioned rctime and just checking if time < 50, but it's a slow response and seems like it shouldn't be necessary.
I attached the quick sketch of what I was trying (that obviously doesn't work).

The photoresistor value changes between 13Kohm to 350ohm when active. What's the simplest way to detect this?
313 x 203 - 2K

Comments

  • D FaustD Faust Posts: 608
    edited 2007-09-19 22:16
    I think that you could connect the photoresitor in between Vdd and the stamp pin.· You would want to add another resistor in series somewhere.· By cahnging the value of this resistor, the threshold will go up or down.· Do not use a value lower than 220 ohm, because if your photoresistor goes to minimun resistance you might fry the pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-09-20 16:25
    Hi blittle, your schematic is correct you just need to alter the value of the 10K resistor. Replace it with a lower value such as 2.2K. In addition to adding the 2.2K if you add a variable resistor also of 2.2K ( virtually replacing the 10K with 4.4K ) you will be able to adjust the threshold or turn on value.

    The aim is to have the junction of your voltage divider at logic level 0 in a dark condition ( between 1v and 1.2v should be good ) and as the light falls on the photoresistor the voltage at the junction of the divider will rise to logic level 1.

    Divider voltage = R2/R1+R2 * V

    Jeff T.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2007-09-20 16:37
    Why not just use an optoisolator?

    Do you have to see the white LED as well?
    Use a photo transistor.

    Photoresistors are inherently slow. A photo transistor is fast.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • blittleblittle Posts: 19
    edited 2007-09-20 16:47
    I _just_ got my hands on a SFH615 optocoupler pillaged from an old printer. [noparse]:)[/noparse]
    I just got it working 2 seconds ago and it seems to be working good, though the response isn't great. The response is probably being held down by the debug calls though. Just gotta tweak a little.
    Thanks!
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2007-09-21 10:12
    Kramer said...
    Why not just use an optoisolator?

    Do you have to see the white LED as well?
    Use a photo transistor.

    Photoresistors are inherently slow. A photo transistor is fast.

    Kramer - you can see an infrared LED using a digital camera or camera phone. That's how I test my circuits.

    Works with TV remotes too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
Sign In or Register to comment.