Pages: [1]   Go Down
Author Topic: PWM frequency problem  (Read 694 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8974
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Shannon Member
****
Karma: 220
Posts: 12700
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-confuse

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.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 67
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you all for your help, the Motors work great
Logged

Pages: [1]   Go Up
Jump to: