Noise in the power supply when I use analogWrite

I'm trying to control led strip lights with TIP 120 transistors. I am using a 12V 6.5 Amp power supply. Everything is working, but when I use analogWrite I can hear noise in the power supply. The noise disappears when I use digitalWrite. So, I think there is a relation between analogWrite and noise.
The connection is good since all is fine.

The noise is due to the PWM modulation from analogWrite, and the irregular power draw from the supply. It might help to increase the frequency of the analogWrite PWM.

Firstly, thanks for your fast answer. Now I could understand. The more the value in analogWrite is the more in noise increases. But, could you explain me a little more about your last sentences. To compare the code, i am using writePWMvoltage in MATLAB. It is similar as analogwrite but with MATLAB there is not noise.
Is there a similar function in Arduino IDE?.

I would like to control the intensity of lights with matlab but I cannot compile in microcontroler. So, I have to use Arduino IDE.
Thanks in advance.

Sorry, I don't know what writePWMvoltage does in MATLAB.

There are good tutorials on how analogWrite works on Arduino, like this one: https://www.arduino.cc/en/pmwiki.php?n=Tutorial/SecretsOfArduinoPWM and as I said, it is possible to change the PWM frequency to reduce the noise.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.