Circuit noise decoupling - Page 1
Forum section: electronics / beginners

author: swat3d
author_rank: Contributor
timestamp: April 22, 2016, 02:07:42 am
content: 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.

author: Audioguru
author_rank: Super Contributor
timestamp: April 22, 2016, 02:43:17 am
content: Simply get rid of the breadboard with stray couplings and resistances between all the circuit grounds and use a properly layed out pcb with a ground plane on one side. The positive supply tracks should be wide.

author: swat3d
author_rank: Contributor
timestamp: April 22, 2016, 03:20:18 am
content: Ok. Really will it make that much of a difference? We are talking almost 20mv of noise. I really didn't want to order boards until I had the design tested. How do you guys go about testing a design if a breadboard is that inaccurate?

author: janekm
author_rank: Unknown
timestamp: April 22, 2016, 07:13:05 am
content: Well it's not the 80s any more... PCBs cost nothing compared to engineer time (even at the hobby level, arguably).In the 80s, one would have probably done some sort of point-to-point wiring on top of a copper plane. Or just a home-etched PCB.

author: tggzzz
author_rank: Super Contributor
timestamp: April 22, 2016, 07:24:14 am
content: What is the peak current, and what is the transition time? Rule of thumb is that 1mm of wire is a 1nH inductor.Then calculate V=Ldi/dt.Don't use solderless breadboards, ensure good groundplanes, think where currents will flow. For prototyping, use "dead-bug" and "manhatten" techniques.

author: swat3d
author_rank: Contributor
timestamp: April 22, 2016, 01:51:56 pm
content: Alright! I guess I underestimated how bad breadboards can be. I'll get the pcbs prototyped right away!

author: Cerebus
author_rank: Super Contributor
timestamp: April 25, 2016, 12:16:10 am
content: Quote from: swat3d on April 22, 2016, 01:51:56 pmWhoa Nelly!Looking at your 2nd oscillograph it looks a lot more like oscillation to me. If it were me I'd investigate that before moving on to a PCB prototype. If nothing else try a dead bug layout on a bare copper board prototype first to make sure that you've not got stability issues.Do not underestimate how fast the edges of microprocessor signals can be and how much wideband noise this can spray forwards into your circuit, they can prevoke bad behaviour that you won't see from more civilised signal sources. I regularly see ringing on MCU outputs that's too little to bother digital circuitry but is plenty enough to upset analogue circuitry. Funnily enough I saw exactly this the other day on a (slightly more sophisticated) PWM to analogue converter that I was building. In that case a 220R series terminating resistor made the problem disappear. Mine was driving a CMOS analogue switch in a switched integrator and the ringing was breaking through the switch's internal gate capacitance into the analogue output.A quick diagnostic test to see if it's your current layout or the actual MCU signal that is the problem is to leave the MCU running but disconnect just the PWM source and try driving the filter with the sig-gen again. It the output is clean you've got stability issues, if it's still noisy then it's noise from the MCU coupled in via poor layout.Another note - your layout is BIG with long leads. You've almost tried to gather up as many parasitics from your board and environment as possible. Keep things compact and leads SHORT especially near sensitive points such as Op Amp inputs and FET gates. That lead from your Op Amp to your FET is begging to collect rubbish, as is the long lead from your filter to the Op Amp input.