Motor Noise question between Arduino to DC Bushed Motor

Hi Folks,

I have a simple question that may have been already answered. I have a H-Bridge MOSFET Driver circuit that takes a microcontroller PWM signal and amplifies it to a 12V PWM signal used to drive a 4A 12V DC Brushed Motor.

We have it working on a PIC16F microcontroller and it works great keeping a constant "8V" looking signal (PWM wave), but it can also dial down to lower "voltages" and higher ones as well. The problem is that I do not have the PIC code for it.

When I remove the PIC16F and replace it with an Arduino and use Pin 3 or 5 to output a PWM signal, it also works just like above, however the difference is when using the Arduino, I hear a high-pitch whine. When doing the exact same thing with the exact same circuit and motor, but on the PIC16F, I don't hear the whine.

What am I doing wrong, and how to I make the Arduino not make the whine? Just using this basic code:

void setup() {
pinMode(3, OUTPUT);
}
void loop() {
analogWrite(3, 166);
}

The MOSFET Driver circuit is based on the Linear Technologies LT1158:
http://cds.linear.com/docs/en/datasheet/1158fb.pdf

The PIC was probably using a PWM frequency higher than you can hear. Google "arduino pwm frequency" for lots of information, and ideas on how to change the frequency on the Arduino.

The default PWM rates on the Arduino are about 1kHz and 500Hz, depending on which timer. You can
change the rate but if you change the rate for timer0 (pins 5 and 6 on Uno) then millis(), micros() and delay()
will no longer work right.

I suspect you want 16kHz to put the whine beyond the range of hearing (20kHz if you are young!),
so will need to find out about configuring timers1 or 2 as appropriate