Electronic – How to filter noise from fan

fannoise

I try to make controller for 12V fan, where I can vary voltage from 3V to 12V on this fan. It works OK, but it makes electrical noise on 12V power line.
How could I get rid of it? How to filter it, or how to modify my circuit?
enter image description here
this is the noise:
enter image description here

UPDATE:
Fan draws 220mA @ 12V, 60mA @ 3V.
This is the modified circuit, according to answers. Noise is lowered down to ~20mV peak-peak:
Added 100nF across pins 1 and 2 of opamp, 100nF cap across power pins of opamp, 2200uF cap from 12V to ground.

UPDATE2:
I put 3k resistor from Q1 emitter to ground and removed capacitor that was directly on fan connector (there is just 2200uF on 12V line). This lowered noise once again.

Best Answer

Nothing dramatic going on here. You just need to install some basic bypass capacitors on the power supply feed and the op-amp feedback path.

Insert a .1uF capacitor from pin 1 to pin 2 of the op-amp. This will stabilize the op-amp so it is not prone to oscillation burst. Replace C1 with a .1uF capacitor and move the 100uF capacitor (+) lead to the 12 volt power supply, as close to the mosfet as possible. To prevent odd behaviour install a .1uF capacitor directly across the power supply pins of the op-amp.

Take readings again and the servo-control loop should be stable with little or no noise on the 12 volt line.

EDIT 1: OP made final(?) changes which included a .1uF across the op-amp pins 1 and 2, 100uF across the diode/motor, and adding a 2,200uF capacitor across the 12 volt to ground power feed. The result is a noise drop from 3V p-p on the 12 volt line to 18mV p-p. This is an improvement of 166 times lower, or 44.436 dB lower, as a voltage ratio.

EDIT 2: OP removed C1 and installed a 3K resistor in the emitter of Q1, leaving other parts the same. Reports lower noise level but did not give values.