0
\$\begingroup\$

I am trying to control/fade a couple of High Power LEDs, these are basically 12V 18W LEDs inside a nice package.

I want to use an Arduino and a N-Channel MOSFET to adjust the brightness.

I tested the LEDs by directly driving them from a bench power supply and controlling the brightness by adjusting the voltage (between 0-12V) and it worked just fine.

I then moved on and used the N-Channel MOSFET to control the LEDs by setting an arduino PWM-pin to the Gate-pin. I am not at all an expert but I think that should do it and it indeed works.

Setting the PWM from the Arduino controls the MOSFETs Gate and adjusts the brightness but here is the strange thing that happens. The LEDs are constantly making a whining noise when I lower the PWM. Now the noise is actually not that bad but I am worried that the LEDs will eventually die out because something is certainly not right.

enter image description here

Any idea on what I am doing wrong? Please don't suggest that I should move on to other ways of driving these LEDs as I don't have access to much electronics.

\$\endgroup\$
  • 1
    \$\begingroup\$ Please post the schematic instead of the wiring diagram. Fritzing can provide both, and schematics are of more use and easier to read. \$\endgroup\$ – JRE Feb 25 '16 at 13:07
  • 1
    \$\begingroup\$ What is your PWM frequency? If it is in the audio range then that may explain the whine you are hearing. \$\endgroup\$ – Steve G Feb 25 '16 at 13:11
  • \$\begingroup\$ I am just setting a PWM value between 0-255 which is 0-100% duty cycle. \$\endgroup\$ – theAlse Feb 25 '16 at 13:20
  • 1
    \$\begingroup\$ You may want to edit your question and rephrase it. The whining isn't because you are driving the LEDs with the MOSFet, but because you are driving it with a PWM signal. \$\endgroup\$ – JRE Feb 25 '16 at 13:29
  • \$\begingroup\$ As others have pointed out increasing the PWM frequency might help. That requires setting some registers directly. Tutorials exist. Another worse way would be to connect a capacitor in parallell (not in serial) with the lamp. A capacitor would smooth out the voltage spikes which could help. The capacitor must tolerate at least double the voltage you are working with, and not be connected baclwards. \$\endgroup\$ – fredrik.hjarner Feb 25 '16 at 15:20
3
\$\begingroup\$

That LED has a constant current source inside of it. That is why it is rated for 9-32 Volts.

It is probably the current limiting circuitry that is making noise.

PWM makes pulses.

When you controlled the brightness with the potentiometer and the MOSFet, you could lower the voltage to below the limits that the regulator in the light could handle - it would get dimmer. That would be in the range from 0 to 9Volts. Above 9Volts, the brightness should pretty much remain stable - if the notes on the web site are to be trusted.

Using the PWM signal from the Arduino is turning the power to the light on and off completely. This is often done to dim LEDs. By using a fast pulse rate with very short on time, the LED is only lit for a very short time and appears dimmer - but it is still being driven with its full voltage and current.

I don't know what that unit has for a regulator, but it seems to have at least one inductor or maybe a capacitor. These can whine when driven with a pulsed signal.

The short of it is that it probably won't hurt the LEDs but may destroy the current regulator.


That thing also seems to have been produced by some El Cheapo chinese manufacturer, so no guarantees that it will live long anyway.


I don't think you can (easily) fix the whining. That light isn't made to be dimmed. It is made to provide a constant light output over a wide range of input voltages. The regulator in the light isn't made to run on voltages under 9V, and it isn't made to be pulsed.

\$\endgroup\$
  • \$\begingroup\$ thanks and I understand your answer and the logic but how should I go about controlling these LEDs if I want to eliminate the whining. \$\endgroup\$ – theAlse Feb 25 '16 at 13:32
  • \$\begingroup\$ "Average" human audio range is 20-20,000Hz, so there are rare cases of people picking up possibly as high as the 'duino's 31.25K, or very likely that with such a low base-frequency, the PWM seckndary overlay frequency is creating 'constructive interference' at a lower mixed frequency that's within the 'average' human range. \$\endgroup\$ – Robherc KV5ROB Feb 25 '16 at 13:34
  • \$\begingroup\$ You won't be able to eliminate the whining while using those LED modules. Drive the LED's directly (no modules.) \$\endgroup\$ – rdtsc Feb 25 '16 at 14:29
  • \$\begingroup\$ The module likely has a controller that can accept a PWM signal on an enable pin. But the controller will almost always have no part number or silk-screening indicating which pin is which. \$\endgroup\$ – Passerby Feb 26 '16 at 8:11
2
\$\begingroup\$

According to official documentation of analogWrite() function, which you're most probably using, the frequency of the PWM signals on most arduino pins is 490 Hz. This is well inside the audible range, meaning it may be transformed to sound when applied to certain components (typically inductors).

If the sound doesn't annoy you, it's probably fine to ignore it. Otherwise, you'll have to design some sort of low-pass filter. I'm having a hard time imagining how to design such filter efficiently though. Another solution would be to find LEDs which make less noise.

\$\endgroup\$
1
\$\begingroup\$

In about 99.5% of cases, when you hear a PWM or SMPS controlled device "whining" it's actually a design problem of the PWM/SMPS itself, where its switching frequency was allowed to cross into the audible frequency range.

If you get your PWM controller to operate at >100KHz, you should eliminate any noise that you can hear.

For more info on the subject, here's an article where someone copied a few related posts from another SE site.

\$\endgroup\$
1
\$\begingroup\$

The Whining is caused by the low frequency of the PWM signal. You need to have at least 1.5 Khz. Right now its at 45 hz. You need to up the freq to at least 1.5 khz

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.