Problem with potentiometer @ PWM=32KHZ only

Hello,

I am working on a project and I need to fade leds with a potentiometer.
I am using an arduino nano, I read an analog input and use output PWM to control the led circuit. My first issue is my board is making audible noise due to resonance in the circuit.

I manage to get rid of the noise by increasing the PWM frequency, but when I set frequency to 32KHZ (no audible noise at all), my analog read is not smooth at all. It is like 0 or 1 and I get full brightness or no brightness at all.

Everything is working @4khz by using TCCR2B = TCCR2B & 0b11111000 | 0x02; but I still get some audible noise so I would like to use 32khz .

Any thought please ?

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Is there a reason for such a high PWM frequency?

What board is making the noise?

How have you got your project powered?

What are the specs of the LEDs you are controlling?

Thanks.. Tom... :slight_smile: