Hi,
I'm working on a constant current circuit to drive a high power LED. I'm basically feeding a pwm signal through a rc low pass filter to the non-inverting input of an opamp. The ouput of the opamp drives the gate of a mosfet and the inverting gets the feedback from a shunt resistor on the mosfet source.
Everything works fine when generating the signal from a frequency generator. However when i feed the signal from a micro controller (Atmega328p) i get a lot of noise, about 15mv peak to peak, which is unacceptable given that I'm aiming for 1mv precision.
I have all recommended bypass caps installed:
10uF and 1uF on the input and output of the 7805.
.1uF on all ics between vcc and ground.
I have tried increasing the capacitance on the ICs and it goes down a little but still within unacceptable levels.
The only thing that has worked so far taking the noise down to 1mv peak to peak is putting a resistor in series at the micro vcc to form a low pass filter. However i can only go so high with the resistor given that it will limit the current to the micro and stop functioning.
Also this works fine when i disconnect power and ground from pins 20,21,22 and only leave 7,8. Same story with the other ones, i have to use a low pass filter to remove the noise completely.
There seem to be 2 overlapping noise frequencies, 1uS and .5uS from what i can tell.
I was hoping you guys could shine some light or give some recommendations.
I'm attaching the schematic and the pictures of the breadboard.
Thanks a lot in advance, i appreciate the help.