# buzzing sound using an H-bridge



## BMK (Sep 13, 2011)

I built a DC power package using an Arduino Nano and a L298N H-bridge. At very low speeds several DC engines have a buzzing sound until it gets to around ¼ (or less) power. Then the buzzing sound stops. I was advised to include a RC filter in the between the H-bridge and the track. The filter is comprised of a 5.1 ohm resistor in series with the track and a 100mdf capacitor across the track. This appears to solve the problem. Not sure why. My questions are, is this the right thing to do or is there some other option? Has anyone else had this problem utilizing an H-bridge and what was done to resolve it?

Brian K


----------



## gregc (Apr 25, 2015)

presumably you're driving the H-bridge with a PWM output from the Arduino and using a 2nd output to control direction.

do you know what frequency the PWM pulses are at? I thought the Arduino can generate PWM as higher than audio (> 20 kHz). Arduino Playground - PWM

it's a shame to have to put a 5 ohm resistor in series with the output. there should be no need for a filter (while it would suppress audio).


----------



## gunrunnerjohn (Nov 10, 2010)

I agree with Greg, just crank up the PWM frequency and it should help with the buzzing.


----------



## BMK (Sep 13, 2011)

I am using an Arduino NANO. 
Based on the following information it appears the NANO operates on 490Hz 
The frequency of the PWM signal on most pins is approximately 490 Hz.	

The PWM output of the NANO, to the H-bridge, is on pin 11 and the direction is via pins 9 and 10.

I reviewed the information you referenced. 
I tied to reprogram the frequency to no avail. Not sure of the code to utilize.
Any additional help would be appreciated.


----------



## gunrunnerjohn (Nov 10, 2010)

490hz explains the issue, I run my PWM for the Super-Chuffer motor drive at 15khz!


----------



## gunrunnerjohn (Nov 10, 2010)

I looked around, there are tons of articles on the Arduino and PWM. It does appear that the Arduino doesn't have the same flexibility with PWM as the Microchip PIC processor, however you can crank up the PWM a bit.

https://www.arduino.cc/en/Tutorial/SecretsOfArduinoPWM

https://etechnophiles.com/change-frequency-pwm-pins-arduino-uno/


----------



## wvgca (Jan 21, 2013)

the default frequency is 490.2 Hz on pins 3 and 11 ..
if you want to try something simple, change the PWM output to either of pins 5 or 6 to double the PWM frequency to 976.56 Hz ..
and see if that changes the 'noise' that you get ... it might be from something else ??


----------



## BMK (Sep 13, 2011)

Thank you for the reference.
I was able to add the following code to the Arduino sketch and it resolved the problem

TCCR2B = TCCR2B & B11111000 | B00000001;
// for PWM frequency of 31372.55 Hz
// No noticeable buzzing

Thank you
Brian K


----------



## gunrunnerjohn (Nov 10, 2010)

Thanks for the feedback.


----------



## wvgca (Jan 21, 2013)

glad it's solved


----------

