# voltage divider and op amp

when ldr is in dark, all voltage drop is across the ldr, so how does voltage at inverting input becomes negative when it is supposed to be 0V or (x)mV?

and when ldr is in light, all voltage drop is across resistor R1, so why voltage at inverting input is -7V?

note: i tried this on livewire simulator and got these values negative and -7V

• in your schematic, the B1/R1/R2 circuit does not have a connection to the ground (common) of the remainder of the circuit Nov 1, 2015 at 13:37

You have no feedback on your op-amp circuit and it is running with 'infinite' (well, very high) gain and basically operating as a comparitor.

The way the op-amp works is that if the + input is higher than the - input then the output will go high and vice versa.

Look up 'inverting op-amp circuit' and you will find plenty of circuits showing how to adjust the gain of the circuit to give desired results.

• From the led connected to the output it maybe that this is the intention. The issue that the op has is nothing to do with feedback, its that his ldr circuit is not referenced to the rest, which causes the inverting input to be floating and the simulator is giving strange results. Nov 1, 2015 at 13:59
• @loganf, that's a good point. Ground the bottom of R1. Nov 1, 2015 at 14:13
• if i ground it, the led explodes in dark :S
– ali
Nov 1, 2015 at 14:15
• B1 voltage looks too high. If R2 resistance drops below R1 value the voltage on the input to op-amp - will exceed it's supply voltage of +15. This should destroy the op-amp and maybe the LED. Drop the voltage on B1 to 15V at most. Update the schematic so we can check your work. Nov 1, 2015 at 14:32
• i got it, the ldr should connect with +15v and the resistor with -15V. in this way, vo would be +15v or -15V due to open loop gain. thnks anyways :)
– ali
Nov 1, 2015 at 17:07

In the circuit shown below, V3 simulates the output of your R1 R2 voltage divider, which can vary about zero volts substantially.

Since it seems that you want the opamp to work like a comparator and have the LED either ON or OFF, R3 and R4 comprise a voltage divider which will set the trip point for the opamp, which will determine when the LED turns on, or off, as the light falling on the LDR causes its resistance to change.

I have the trip point set at zero volts, so when the voltage from your R1 R2 divider goes more positive than zero volts the LED will turn OFF. and when it's more negative than zero volts it'll turn ON.

Also, since the output of your opamp can swing between -15 and +15 volts, when it gets to -15 volts the reverse voltage on the LED can destroy it, so to keep that from happening you can just insert a regular diode in series with the LED and its ballast resistor. I've added the LTspice circuit list after the schematic, so if you like, you can play with the circuit.

Version 4
SHEET 1 896 680
WIRE 560 0 80 0
WIRE 560 48 560 0
WIRE 528 64 304 64
WIRE 688 80 592 80
WIRE 528 96 368 96
WIRE 688 112 688 80
WIRE 80 160 80 0
WIRE 160 160 80 160
WIRE 368 160 368 96
WIRE 368 160 240 160
WIRE 400 160 368 160
WIRE 560 160 560 112
WIRE 560 160 480 160
WIRE 304 208 304 64
WIRE 688 208 688 192
WIRE 80 320 80 160
WIRE 304 320 304 288
WIRE 560 320 560 160
WIRE 688 320 688 272
WIRE 80 432 80 400
WIRE 304 432 304 400
WIRE 304 432 80 432
WIRE 560 432 560 400
WIRE 560 432 304 432
WIRE 688 432 688 384
WIRE 688 432 560 432
WIRE 80 480 80 432
FLAG 80 480 0
SYMBOL voltage 80 304 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value 15
SYMBOL voltage 560 416 R180
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value 15
SYMBOL res 672 96 R0
SYMATTR InstName R1
SYMATTR Value 750
SYMBOL diode 672 208 R0
WINDOW 0 43 32 Left 2
WINDOW 3 21 63 Left 2
SYMATTR InstName D1
SYMATTR Value 1N4148
SYMBOL LED 672 320 R0
SYMATTR InstName D2
SYMATTR Value NSCW100
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL res 496 144 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R4
SYMATTR Value 10K
SYMBOL res 256 144 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R3
SYMATTR Value 10K
SYMBOL voltage 304 304 R0
WINDOW 3 24 96 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value PULSE(-15 15 0 1s 1s 0 0 1)
SYMBOL Opamps\\LT1007 560 16 R0
SYMATTR InstName U2
SYMBOL res 288 192 R0
SYMATTR InstName R2
SYMATTR Value 100k
TEXT 94 456 Left 2 !.tran 3 uic