Arduino Uno - Messed around with PWM frequency

Hello. I'm a student working on a project which uses Arduino. Me and my project mates were trying to run a brushless motor using an Arduino Uno. We already succeed running the motor with an ESC. After that, we tried running the motor using a MOSFET driver circuit. We came across some websites that makes use of the PWM frequency to run the motor. So we tried changing the PWM frequency using these codes:

TCCR1B = TCCR1B & B11111000 | B00000001; // set timer 1 divisor to 1 for PWM frequency of 31372.55 Hz
TCCR2B = TCCR2B & B11111000 | B00000001; // set timer 2 divisor to 1 for PWM frequency of 31372.55 Hz

Code reference:

We failed to run the motor with the MOSFET driver. Now, we have a problem with the Arduino. After messing around with the timers, we could not run the motor with our ESC (which we previously could). I tried uploading a simple PWM sketch that uses potentiometer to fade or dim the LED. However, the LED did not dim properly. The brightness changed only a bit. From here, I conclude that our MOSFET driver circuit was not the problem.

Another thing I noticed was, the ATmega328 IC heats up easily even though I uploaded a simple sketch.

I also read from this link (Arduino Playground - PwmFrequency) that changing the PWM frequency could disrupt normal operations of many functions. That's where I conclude that changing the PWM frequency was the root of the problem.

I'm hoping that anyone who is familiar with this situation can share their solution or opinions here. I would appreciate it so much.

Thank you for your time, have a nice day ahead. :slight_smile:

You possibly blew up a pin (or more pins) on the Arduino. Please post a schematic (photo/scan of handdrawn one or a real one) of both the MOSFET version and the ESC version.

It's not the timers :wink: They are set to 'default' settings when you start a sketch (powerup / reset) and if you don't touch them (e.g. using the blink sketch) they will stay like that.

Hi, thank you for your reply :slight_smile: Here's the schematic for both ESC and MOSFET version of the circuit.

(For the MOSFET version, we used the same pins for Arduino Uno as drawn in the schematic and we did not use hall sensors.)

If I did blew up a pin or more, may I know if there is any way I can fix it?

You have used electronics that I've never heard about :wink: Maybe somebody else can chime in if there are mistakes or not.

You can't fix broken pins. Replace the micro (for the Uno, you can buy 328 chips with bootloader) or the complete board.

Okay sure. Thank you so much for your reply, Sir. I appreciate it. :slight_smile: