I am building a steady current source which delivers steady current (0-20mA) to an LED. The brightness of the LED (current) is controlled through a potentiometer's voltage and a voltage follower as shown in the picture below. Further, I want to blink (modulate) this LED with a square pulse frequency of 2kHz using a switch between the transistor gate and the voltage follower output.
The problem is that every time the switch closes, spikes are produced at the base and as a result at the source. Even when I reduce the current of the LED to 1mA (example picture 2), the spikes don't go away. Only when I set the current of LED to 0 do the spikes dissapear.
So the question is how can I remove/reduce these spikes? Is there some way?
[
Answer
One way would be to use a SPDT switch, add a series resistor to the inverting input:
simulate this circuit – Schematic created using CircuitLab
Real switches have a certain amount of charge injection so a little more finesse may be required in a real implementation. A series resistor to the gate would slow the switching edges a bit, but in that case a capacitor from the output to the inverting input of the op-amp may be required for stability.
Some op-amps take longer than others to recover from saturation, so you could also just shop around for a different op-amp. Offhand, however, I don't have any useful suggestions- usually I try to avoid this situation.
Edit: Here is a really simple way to do this:
No comments:
Post a Comment