# Dimming Bulbs Causes Power Supply Buzz

**URL:** <https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744>\
**Category:** General Guidance\
**Created:** [February 5, 2022, 10:44pm UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744 "2022-02-05T22:44:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![WesleyTx](https://avatars.discourse-cdn.com/v4/letter/w/f04885/32.png) [@WesleyTx](https://forum.arduino.cc/u/WesleyTx)\
**Post date:** [February 5, 2022, 10:44pm UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/1 "2022-02-05T22:44:59Z")

</div>

I completed a project wherein I used shift registers and MOSFETs to control a display composed of 12V incandescent bulbs and, thanks to [the help I got from this forum](https://forum.arduino.cc/t/controlling-an-array-of-12v-incandescent-bulbs/945300), it's working great.

I have only one problem. When I dim the bulbs (using the Output Enable pin on the shift registers), it causes my 12v power supply to buzz annoyingly. It's loudest when most of the bulbs are on and when they're dimmed to about 50%.

Any suggestions on how exactly to eliminate it? I've attached the schematic. (Only two bulb channels are shown, for clarity.)

 ![Schematic](https://europe1.discourse-cdn.com/arduino/original/4X/7/f/1/7f19888cf4388e96cbcf1b2647cc620fb3cab6c0.png)

---

<div class="post-metadata">

**Author:** ![Railroader](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/railroader/32/274550_2.png) [@Railroader](https://forum.arduino.cc/u/Railroader)\
**Post date:** [February 5, 2022, 11:00pm UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/2 "2022-02-05T23:00:29Z")

</div>

What is the power rating of the power supply? Sorry, too late for reading the 26 earlier posts.  
What is the bulb data? Know that cold bulbs pull quite some current when powered up. It's similar to a capacitive load.

---

<div class="post-metadata">

**Author:** ![bluejets](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/bluejets/32/1013044_2.png) [@bluejets](https://forum.arduino.cc/u/bluejets)\
**Post date:** [February 5, 2022, 11:02pm UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/3 "2022-02-05T23:02:16Z")

</div>

Code......?????  
As you found, dimming can cause buzzing from the switching of the mosfets.  
This was eveident right from day 1 of someone trying dimming or speed control of any kind.  
There are probably answers out there but I am not familiar with them being a simple fix.  
Perhaps think along the lines of higher frequency switching beyond human hearing levels.

---

<div class="post-metadata">

**Author:** ![WesleyTx](https://avatars.discourse-cdn.com/v4/letter/w/f04885/32.png) [@WesleyTx](https://forum.arduino.cc/u/WesleyTx)\
**Post date:** [February 5, 2022, 11:34pm UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/4 "2022-02-05T23:34:21Z")

</div>

It's a 15A power supply. The 12V bulbs pull about .3A each. I made sure the power supply was more than sufficient for all the bulbs, plus the board, with overhead.

---

<div class="post-metadata">

**Author:** ![WesleyTx](https://avatars.discourse-cdn.com/v4/letter/w/f04885/32.png) [@WesleyTx](https://forum.arduino.cc/u/WesleyTx)\
**Post date:** [February 5, 2022, 11:40pm UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/5 "2022-02-05T23:40:14Z")

</div>

The only code related to the dimming is simply

```cpp
void setBrightness() {
  int level = analogRead(brightPin);
  level = map(level, 0, 1023, 0, 255);
  analogWrite(outputEnablePin, level);
}

```

where **brightPin** is connected to a potentiometer and **outputEnablePin** is the pin connected to the OE pin on the shift register.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [February 6, 2022, 1:56am UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/6 "2022-02-06T01:56:16Z")

</div>

Modern switching power supplies do make noise (coil whine) at different loads.  
And the cheaper or open-frame types could make more noise.  
Nothing much you can do about that, apart from putting it into an enclosure.

```cpp
void setBrightness() {
  analogWrite(outputEnablePin, analogRead(brightPin >> 2);
}

```

Did you try a PWM pin with a different base frequency?  
Leo..

---

<div class="post-metadata">

**Author:** ![johnerrington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnerrington/32/340106_2.png) [@johnerrington](https://forum.arduino.cc/u/johnerrington)\
**Post date:** [February 6, 2022, 7:52am UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/7 "2022-02-06T07:52:59Z")

</div>

> [@WesleyTx](#):
>
> my 12v power supply

In the absence of info on the PSU we are working in the dark. (Sorry).

Assuming its a SMPS PSU I could well imagine that the PWM square wave has harmonics that would not please the SMPS. I'd try a BIG capacitor to smooth the current demand.

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [February 6, 2022, 8:41am UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/8 "2022-02-06T08:41:54Z")

</div>

Try a large, maybe 4700μF, capacitor across the 12V supply as physically close to the MOSFET source (-ve) and the lamp positive supply as possible.

---

<div class="post-metadata">

**Author:** ![6v6gt](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/6v6gt/32/225488_2.png) [@6v6gt](https://forum.arduino.cc/u/6v6gt)\
**Post date:** [February 6, 2022, 9:15am UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/9 "2022-02-06T09:15:26Z")

</div>

> [@Wawa](#):
>
> Did you try a PWM pin with a different base frequency?

Yes, have a look at: [https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/](https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/) . Your board isn't mentioned but this shows that the PWM frequency can be pin dependent. You can also configure timers to use other frequencies.

---

<div class="post-metadata">

**Author:** ![WesleyTx](https://avatars.discourse-cdn.com/v4/letter/w/f04885/32.png) [@WesleyTx](https://forum.arduino.cc/u/WesleyTx)\
**Post date:** [February 6, 2022, 7:39pm UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/10 "2022-02-06T19:39:32Z")

</div>

Using an Adafruit ItsyBitsy 32u4 (5v). Having trouble finding the frequency of the PWM pins for that board. Hesitant to mess with the timer, because the whole function of the circuit is time-based.

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [February 6, 2022, 7:42pm UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/11 "2022-02-06T19:42:33Z")

</div>

> [@WesleyTx](#):
>
> Hesitant to mess with the timer

Personally I encourage people to mess with things, in my opinion it's one of the joys of the hobby. What have you got to lose if it screws things up? You can always put it back and you'll have learned something.

Go on, mess until the cows jump over the moon. Or something.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [August 5, 2022, 7:42pm UTC](https://forum.arduino.cc/t/dimming-bulbs-causes-power-supply-buzz/955744/12 "2022-08-05T19:42:37Z")

</div>

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