I am powering my mega8535 via the usb(5V) port on the PC. The program uses PWM to dim 6 LED's in series running at 24V. I am using a N-FET to switch them. The issue I'm having is the PWM is inducing noise back into the PC and any audio from the PC has a hum at the frequency of the PWM. Can any one point out a good circuit to stop the noise injection on the 5V rail. Should I use an inductor between the PC and the micro. Further more should I have an inductor on both the 5V rail and the ground?
Inductors will help but basically you need more capacitance across your supplies. Start of with 100uF and add more if you still have a problem. Bothe the 24V supply and the 5V supply need extra capacitance on them.
thanks for the help. I did put a 1000U 25V electrolytic cap across the 5V rail and it did make any difference, plus I hav 4x 100nF caps around the micro for decoupling.
For anyone interested, here's the fix to the PWM noise injection back into the PC via the USB cable:
I placed a 100nH inductor in series between my PCB ground and the USB ground. I then put a 220nF decoupling cap between the USB ground and USB 5V, which filtered the 31.25KHz noise from the PWM.
Hi,
Thats good to know, I will try some inductors as I have had similar noise problems in other circuits which I have solved with a 7805 regulator as a buffer between the two circuits. I am assuming the inductor is smaller, lighter and cheaper than a 7805 and two caps.
I got sick of the Arduino trying to power my PC, so i took apart the USB cable and wired a diode (so it can only power the board 1 way, not power the mouse, keyboard etc, which it was doing) ... the .7voltage drop is a concern if you don't have an external power supply for the board.
While I am glad you got it working, connecting grounds together with an inductor is not recommended. This implies you have a large ground signal and you would be better solving that fault than papering over the cracks in this way.
Filtering both sides of an "Analog" Power Supply for high noise environments is common but only in Very Low noise applications and as Mike pointed out counter-intuitive... That having been said., It looks like you are trying to beat a ground loop (that's why the parts are used, BTW). I do have one recommendation and that is to look carefully at your grounding... Use a Star topology where all ground returns go to the same point. If you have heavy currents being drawn by the PWM AND they are flowing through your PC ground you will have an issue especially If the 24V Power supply has any continuity to earth ground. Connect the 24V stuff together and connect the control wiring and one ground return lead to the Arduino. The best method for that type of noise is to keep the PC disconnected from the Arduino except when you are programming it.
Next best is to use a "Common Mode" Choke which is one of those big 20 - 25 mm clamshell ferrite things and sometimes you might need a bigger one to enable you to coil the cable and loop it through the ferrite remembering that it must be 2 - 4 turns around not a "Hank" of wire clamped by the device. Third only because of the difficulty is to use a commercial two winding common mode choke like what would be used for mains filtering on a regular mains switcher and a couple of 100 nF caps across either end of the winding's, Fourth is the method you chose and it is BAD because in the case of an accident the coil MUST be able to conduct the fault current without failing itself. I must point out as Mike was trying to that the consequences of that coil failing would be extreme. If the choke failed your whole fault current is available to the USB Data+ and Data- connections and would be really bad news.
You could increase the pwm frequency higher
althought at 31Khz its well above your hearing range of 21Khz already
Optically isolating the supplies may help, tho not really necessary