Go Down

Topic: PWM frequency problem (Read 708 times) previous topic - next topic

Mazen21

Hello,
I just bought an arduino mega ADK, and a couple of motors, http://www.robot-electronics.co.uk/htm/emg30.htm,
I want to control the speed of those motors with PWM but it seems that I can't change the PWM frequency, So is there any library that can help me here.
I'm using L298 for motor interfacing.
I have another issue, is it a problem to power the arduino from the PC while controlling motors.
thanks

johnwasser

Why do you feel you need to change the PWM frequency?

You can power the Arduino from the same 12v source as your motors.  Connect +12v to the Vin pin or to the DC power jack.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

MarkT

But the normal caveat applies - if your supply isn't able to supply the motor's max current requirements the Arduino will likely crash.  Also you want to be sure there are no high voltage spikes on the supply that might overload the Arduino's regulator.


As for PWM frequency I don't think there's a specific library but it can be done by reprogramming the relevant timer module directly.  If you want millis() and micros() to still work don't modify timer0.
[ I won't respond to messages, use the forum please ]

Mazen21


Why do you feel you need to change the PWM frequency?

I used to work with PIC microcontroller and I used to test the best frequency that work with the motor cause it seemed to me through my personal experience that every motor has a specific pwm frequency that works great with it


You can power the Arduino from the same 12v source as your motors.  Connect +12v to the Vin pin or to the DC power jack.


I didn't want to do that, I don't know exactly how much current the motor will require and I don't know the max current that the 5v regulator in my arduino will support. I'm really new with arduino  :~


As for PWM frequency I don't think there's a specific library but it can be done by reprogramming the relevant timer module directly.  If you want millis() and micros() to still work don't modify timer0.

I searched in the arduino site but I can't find any data sheet of arduino Mega ADK can you give me a link please.
Thank you all for your help.

Destined

the jeremy blum arduino tutorial on youtube on motors and PWM might be of use too you.

Mazen21


the jeremy blum arduino tutorial on youtube on motors and PWM might be of use too you.

Thank you for your suggestion, I found his tutorial very interesting and amusing, and I think I found what is my problem, I didn't wire the arduino GND to the L298 GND so the the motor and the arduino don't have the same reference. I will try that as soon as I get to the lab tomorrow,
Thank you all for your help.

Mazen21

Thank you all for your help, the Motors work great

Go Up