Add capacitors close to noise source(right across pin of PIC). 1,10 and 100nF in parallel.
Also Breadboard have large capacitance between 2 rows of pin. Try to put ground next to PWM pin.
Use short leads, as stray inductance plays large role. Also try to create star ground point.
I agree, Where did you place the .1Uf cap? At the supply? If it work's at all in reducing the noise, then you are on the right track.
Dave Purola,
N8NTA
EN82fn
On larger projects I may use over a dozen 0.1 uF (and one or two 0.01 uF) caps to filter board noise. I also add 10 uF and 100 uF caps near the power supply. I filter both the input to the LM7805 and the output. I use a 47 or 100 ohm resistor between my power source and voltage regulator to further filter the power supply. Invariably, whenever I'm getting unexpected behavior, it's often due to insufficient capacitive filtering. In other words, wherever you think, then add another one or two.
Like someone suggested above. You should try to increase the frequency of your PWM. A 1khz square wave will have strong harmonics at 3khz, 5khz and 7khz. Thats right in the middle of the audio range. Then you start stepping thru the duty cycle, this will alternate between odd and even harmonics.
Easy fix unless I'm missing something
Change this
to thisCode:PWM 1, Duty, 1000
Code:PWM 1, Duty, 20000
Bookmarks