Phototransistor adjustments

Discussion in 'The Projects Forum' started by TexasTony, Jun 10, 2011.

  1. TexasTony

    Thread Starter Active Member

    Jul 15, 2010
    Hi guys,

    Playing with a new feature. I want to use a phototransistor to sense dawn and dusk. I have it wired to an input of my microcontroller (5v levels) with an internal pullup (250 nA). The part I used is this: .

    My problem is that it takes a whole lot of sun to trigger it. So basically it's not sensitive enough. But not being familiar with phototransistors, I'm not sure what in the spec for these parts would define that sensitivity.

    I know I can get the sensitivity adjustment if I use a true 3-legged phototransistor and adjust it with resistors. My problem is that I only have 2 wires from the sensor to the microcontroller, so that's something I'd really like to avoid.

    I'm also considering using a photoresistor. Any suggestions?
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    The two wires should do it. As you are using the internal pull-up to connecting this to your micro keep in mind these are notoriously inaccurate, you can get a ton of variance out of the current. And at 5V, 250uA is only a 20K resistor. That is way too much for the ammount of light you are sensing.

    While the device you already have should work anyway, I once used a CDS photoresistor to detect when a fridge was open by sensing the light. It was kinda a just-for-fun circuit but it actually worked for years off a coin battery.

    I made the sensor for low current when off with a "high value" resistor to VCC, the CDS to ground, and a digital input between them. I don't have the circuit in front of me, and didn't record the resistor value in my notes, but I remember it being something like 500K or greater (maybe a few megs).

    What you may want to try is turning off the internal pullup and using a high value external resistor. The tough part is getting up early enough to make a measurement of how much voltage comes out when the sun is coming up. More resistance means more sensitivity (less sun to turn it on).
  3. TexasTony

    Thread Starter Active Member

    Jul 15, 2010
    Thanks Ernie!

    That sounds like a good thing to try. You're right, the uC has a 50-400 uA sourcing power. So it can have a big range... oops!

    I'll disable that internal pullup and start at 500k ohms & see what happens...

    thanks again...
  4. someonesdad

    Senior Member

    Jul 7, 2009
    Or just go to Radio Shack and get some CdS photocells -- you can get a package of them for a few bucks.