Hello, the circuit that I am trying to make with the Lm358 circuit is an automatic nightlight circuit with a photo resistor, I will have circuit below.
I know that R3 and D2 create a voltage divider that feeds into the non-inverting input of the op-amp and Potentiometer VR1 i believe is there for a reference voltage that feeds into the inverting input ? also i believe you can adjust Vr1 to set different lighting conditions?
My question is why does the Led turn on when the photo resistor is covered, can someone explain in an easy to understand way exactly what is happening to the op amp?
The resistance of the LDR is very high when covered, resulting in almost full battery voltage (through R3) on the +input of the opamp.
When the +input of the opamp is higher than the -input (trimpot setting), the opamp outputs a HIGH.
Which drives the base, which switches the transistor/LED on.
Leo..
There are two voltage dividers, the pot and the LDR/R3 arm.
The opamp is being used as a comparator (for some reason a comparator isn't used).
If the non-inverting input (labelled +) is at a higher voltage than the inverting input (-),
by even a few millivolts, the opamp (or comparator)'s output will rise up towards the supply rail.
opamps and comparators both have very high open-loop voltage gains (a million or so), so the output
change will look like sudden switching even when the light level changes fairly slowly.
Hi,
Get your DMM out and measure the voltages on pins 2 and 3 when you cover and uncover the LDR.
Tom...
Its been a long time since I worked with an LM358 and I don't recall the actual minimum output voltage. However I'm pretty sure the output being a PNP will not go much below 0.8 Volts. This level can turn on your BC547.
You could:
-
add a diode or two in series with the LM358 output.
-
add a resistor from the base of the BC547 to ground, perhaps 5k or so.
The datasheet recommends using a pull-down resistor on the LM358 output for this reason. There is an
in-built 50uA current sink to help pull the output down according to the datasheet, which ought to turn off
the NPN, but pretty slowly. A 2k pulldown on the output of the LM358, or better on the base of the BC547
will bring the LM358 fully within its working range I think.
I'd recommend chosing a better opamp instead, the LM358 is a very poor performer by
any modern standards, or even a comparator, since this is a comparator circuit really,
and use a PNP transistor on the output (comparators are usually NPN open collector output
and thus best boosted with a PNP transistor to higher currents.