I made a circuit for LED Driving (current controlling), based on this circuit. Everything works fine except that the LED is suddenly blinking when the circuit is turning on and off. How can I prevent this blinking?
Without the actual circuit and component values, it is hard to assess the problem you are facing. However, I could think of a possible reason and another very unlikely one, and a solution for it.
During turn-on \$C_2\$ starts to be charged, once the output of the voltage divider formed by the potentiometer \$R_6\$ is above the inverting input of the comparator, the latter will try to turn on the mosfet. At this moment an in-rush current will flow through the LED. If either the comparator is not fast enough (small bandwidth) or the feedback is too slow (maybe due to poor layout and parasitics), the control loop will not react fast enough to pull down the gate of the mosfet. If the battery cannot supply the necessary current, it will be drawn from the pre-charged capacitors \$C_3\$ and \$C_2\$ (mostly from \$C_3\$ because of its relatively lower \$ESR\$). This will in turn lower the supply voltage of opamp if there is enough resistance between it and the power supply, which might drive the opamp out of its operating point for a short time.
- Add a capacitor (\$\approx 100nF ... 10\mu F \$) between the output of the comparator and the source end of the mosfet. This will speed up the feedback.
- Replace the opamp with a faster one (bigger bandwidth)
- Replace the mosfet with one with a lower gate capacitance, therefore a faster response time.
- Add a rectifier or schottky diode between the LED an and the capacitors, preventing the LED from drawing current from the caps.
- In case you are using a long cable between the LED/laser and your circuit, try to reduce its length, since its parasitic inductance can form together with the upper capacitor \$C_1\$ a LC tank, which might lead to oscillations.