Electronic – Light sensor using Photo Transistor

phototransistorsensor

How can I design a circuit which utilizes a photo-transistor to make a light sensitive switch that is when there is no light in room, the led connected to the photo-transistor lights up and when there is light in room, the led connected to Phototransistor turns off? Any schematic or circuit diagram would be really helpful.

Here is the link but I am using photo-transistor but this circuit is for LDR, so how can I use photo-transistor in this circuit?

enter image description here

Here is my Implementation on breadboard. Please tell me if this is correct. I tried to make the two lines in parallel. I suspect my connectionof base of the transistor with resistor is wrong, correct me if I am wrong.SORRY I DID NOT HAVE ANY OTHER SOFTWARE TO SHOW MY IMPLEMENTATION SO PLEASE NEVER MIND :).

enter image description here

Best Answer

The circuit you show should work as it is, since it is already for a phototransistor. Just leave your base lead floating.

EDIT - the breadboard circuit you have added looks correct (though it's hard to read..) so go ahead and try it. If it doesn't work let us know. Maybe change the resistor to 2k or larger if you are worried about blowing the LED.

Just to note this circuit will work fine, although Steven's suggestion is "preferable" in general. I would maybe not change things till you have it working.
The reason the circuit is usually not the best way to do this is because it relies upon Hfe, which can vary quite widely in a transistor and is subject to temperature changes. This means the base resistor must be chosen according to the particular transistor used.

The reasons it is picked for this circuit are as it uses 1 less resistor (for size purposes, see picture below) Also this circuit is designed for a 3V cell like a CR2032, which has a high internal resistance and generally cannot supply enough current to damage the LED (so it's like having a series resistor in place) The original project page explains all this.

CR2032 light sensor

So if you are intending to eventually power this circuit from something else other than a coin cell, then you should go for the common emitter circuit Steven describes. The site you got the above circuit from also has an example of such a circuit:

Common emitter light sensor

To help with the breadboard I just threw together the little circuit shown in your question. I only had an IR phototransistor but it doesn't matter much for this, it still works the same. Anyway here are a couple of pictures of it working, hopefully you can see how the connections go:

phototransistor light

The phototransistor base is floating, and I swapped the 1k for a 22k in my circuit to bias it correctly (I arrived at this value roughly, see below) and used a BC337 npn. Since the BC337 has lots of gain the 22k works well for the base current.
To give an idea of why the 22k resistor, the BC337 I'm using has a gain of around ~400, and the voltage it will see is 3V - (Vled + collector-emitter drop) -> 3V - (1.8V + 0.7V) = ~0.5V. So 0.5V / 22k = 23uA into the base.
The gain for the BC337-40 is typically 400, so 23uA * 400 = 9.2mA. The min/max gain given in the datasheet is 250-630, so the actual max LED current could vary from ~6mA to 14mA, which is within maximum LED current (20mA) My actual measured maximum current was 10mA, so this fits with the above calculations.
The power rails are on the right, red for +V and black for ground.

With the lights turned down a bit:

phototransistor dark

It actually works very well, off in normal light and starts turning on as soon as I start dimming the lights. You may have to try a few different values of resistor in your circuit to arrive at your desired setting.