op amp non-inverting input isn't working?

simulate this circuit – Schematic created using CircuitLab

Why in above schematic if i left the non-inverting input floating or connected to 1V or 3.3V the LED stays ON and current doesn't change with increasing/decreasing the Vref voltage?

Also LED current increases with increasing voltage and it's not constant...

Table 1 (when 3mm LED and transistor is connected):

Vref | Op-amp out | Emitter |  VBE
-----+------------+---------+--------
0.0 V|    2.96    |  2.75   |  0.81
0.5 V|    1.16    |  4.48   |  0.66
1.0 V|    1.68    |  3.96   |  0.68
2.0 V|    2.77    |  2.93   |  0.75
3.0 V|    2.98    |  2.75   |  0.80


• What's the forward voltage of the LED? What happens if you apply 0.1 V at Vref? – The Photon Sep 20 '19 at 14:43
• Can you publish some numbers? I've added a table for you to fill in. Note that deleting the component designations makes it much more difficult to discuss - even on a simple circuit. – Transistor Sep 20 '19 at 14:43
• @Transistor i filled that table. connected the second PSU ground to 5V ground and then positive to the Vref. – ElectronSurf Sep 20 '19 at 15:03
• Disconnect the components connected to the op-amp output and connect the output straight back to the inverting input. Repeat the measurements and see if the op-amp is working. You should get the same voltage out as on the non-inverting input. – Transistor Sep 20 '19 at 15:10
• Either that or wiring error. The emitter voltages should be 0.7 V less than the op-amp output. There is something very wrong with your setup. Post a photo. – Transistor Sep 20 '19 at 15:18

When Vin- matches applied input Vin+ the current in Rs matches the LED. Thus 100mV/mA= 100 Ohms for a max of 5V-Vce-Vf =2~3V thus 20~30mA.

When Vin+ is floating I assume the constant LED on is due to reactive leakage of wire signal , from stray noise such as 50 Hz? Line noise where 0.01 uA leakage into say 10MOhm (OpAmp) is 1V and is possibly more then clipped by supply voltage diodes. With AC stray noise duty cycle would be 50% on a floating control input. V(in+)

Thus Vin+ is voltage controlled yet be a low impedance relative to Zin = 10M. So even 100k would be adequate. Shunt cap of 100pf may be necessary in that case if there were large RF EMI signals. So a lower impedance control is preferred.

• There seems to be some vague connections to Q1 and LED brightness during tests. If Emitter voltage was this high and the transistor was correctly connected , the 3mm LED might get too hot with >20mA current. Verify your VBE and estimate LED brightness. LED current can be measured with a 1 ~ 10 ohm drop resistor from 5V – Tony Stewart Sunnyskyguy EE75 Sep 20 '19 at 17:46
• yeah i measured the LED current it's around 18mA, it's my second day playing with an op-amp and learning slowly. yesterday i think i had wrong wiring that may caused this damage to the op-amp... – ElectronSurf Sep 20 '19 at 18:39
• Next time use custom short wire jumpers and make layout much smaller like the schematic – Tony Stewart Sunnyskyguy EE75 Sep 20 '19 at 20:15
• OAout= Op Amp out= Vb. , Vemitter = Ve. Thus the difference = Vbe – Tony Stewart Sunnyskyguy EE75 Sep 20 '19 at 20:17
• So this should be a non inverting unity gain with Negative feedback Out to Vin- and Vref = Vin+. If output does not follow input Vin+ and supply connections are correct, then it is not functional. – Tony Stewart Sunnyskyguy EE75 Sep 20 '19 at 21:27

There were lots of problems with the original circuit. You've made some changes, but it's still a bit wonky.

Assuming your LED is that 3mm green LED that appears to be on the breadboard, your current should not exceed about 15-20mA tops. The forward voltage will be around 2.5V.

The LM358 op-amp has an output that can swing down to 0V on a 5V supply but cannot go higher than a few volts. Since Vbe is 0.7V or so we should limit the voltage across the sense resistor R1 to something reasonable, say 0.5V. So R1 = 0.5V/0.02A = 25 ohms. That is chosen so that there's enough voltage for the LED but the voltage is much higher than the few mV offset of the LM358.

Now divide your 3.3V maximum Vref down to 0.5V with something like 10K/1.8K and apply that to the non-inverting input. The 1.8K to GND will also deal with the input bias current if you disconnect the input.

The compliance of the resulting current sink at 20mA out is about 5V - 0.1V - 0.5V = 4.4V so the 2.5V LED has plenty of margin.

Maximum dissipation of the transistor into a short is 4.5V * 0.02A = 90mW which is fine. Leaving the LED open will cause the op-amp to attempt to drive 20mA into the transistor base, which it can do without damage at room temperature.

This particular circuit will likely work without the cap/R2 but the pair improves stability.

Unless you connected power to the LM358 backwards and it got hot, it's unlikely you have damaged it, they're pretty rugged devices. However, your measurements do not look good. Check the wiring first, and try another op-amp.

• side question; "it's still a bit wonky.", what improvement i can do to this circuit? the purpose is to make an constant current LED driver. – ElectronSurf Sep 20 '19 at 20:11
• Follow each of the suggestions below that sentence. ;-) – Spehro Pefhany Sep 20 '19 at 20:25

If you don't connect the input, the bias current will drive it to one of the rails, in this case probably the positive one. It's about equivalent to connecting it to the supply.

Otherwise, the voltage on the - input should track the voltage on the + input. If you're looking for changes in the current by watching to see if the LED brightness changes, you might not even be able to detect it...your perception of brightness is logarithmic, and you're looking at about 10dB from 1V to 3.3V. Measure the voltage at the junction of R1 and R2, and verify that it's tracking Vin.

• Thanks for the answer, it seems i damaged the the op-amp. – ElectronSurf Sep 20 '19 at 15:20