Pages: [1]   Go Down
Author Topic: Critical Velocity Motor Controller & Arduino  (Read 732 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys--

We're having some issues with controlling the speed of our motor using a Critical Velocity Motor Controller.

Parts:
- Arduino duemilanove
- Critical Velocity Motor Controller - 5.5-36V and 15A
- A PMDC 36V, 12.8A motor (350W)

The manual for the controllers say that in order to control the motor speed, we can just pulse the Up and Down lines on the controller:
http://www.robotshop.ca/content/PDF/datasheet-SPD-2115B-EDS.pdf

But by using this code, we can't achieve that. The motor either runs at full speed or at zero speed when the up and down lines are pulsed respectively.

Code:
 int RUp = 3;                     //Right Motor Speed Up
int RDown = 5;                   //Right Motor Speed Down
int REnable = 7;                //Right Motor Disable

void setup()
{
 pinMode(REnable, OUTPUT);   // sets the digital pin as output
 pinMode(RUp, OUTPUT);       // sets the digital pin as output
 pinMode(RDown, OUTPUT);     // sets the digital pin as output
 digitalWrite(REnable, HIGH);   // Raise Right Motor speed by 0.4%
 analogWrite(RUp,10);
}

void loop()
{

}
 


So at this point, we have no control of the motor speed. It either goes max speed or zero speed with this code.

I think the frequency of the Arduino is too high for the controller. The controller is at about 200Hz. And the Arduino at about ~400Hz. So the arduino is sending pulses so many times that the controller just ends up running the motor at max speed and at min speed.

How can we change the frequency the arduino outputs at? Can someone help please?

Thanks.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 300
Posts: 26219
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How can we change the frequency the arduino outputs at?
Isn't the 200Hz the output frequency of the controller?

Have you got the jumpers set correctly?

If you feed PWM to the UP pin, it'll reach max speed very quickly and stay there.

You need to pass individual pulses to  UP  until you reach the desired speed. (bottom of page 2) - it clocks on rising edges.

Code:
digitalWrite(REnable, HIGH);   // Raise Right Motor speed by 0.4%
Wrong.
« Last Edit: March 05, 2010, 03:06:02 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey you're right. We got it working by pulsing the up signal high, doing a delay, then pulsing it low.

And we put this code in a for-loop to be able to control the number of pulses.

Btw another is that we didn't realize that we had to reset the signals on all of the pins every time we made a change to the code. Because the old settings of the pins still stay on the MCU even when u change the code and recompile.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 17
Posts: 2884
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
another is that we didn't realize that we had to reset the signals on all of the pins every time we made a change to the code. Because the old settings of the pins still stay on the MCU even when u change the code and recompile

I think it more likely that the ESC remembers the settings, rather than the Arduino!
Logged

Per Arduino ad Astra

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looking over that manual you linked to there appears to be two ways to control the speed of the motor with that PWM motor controller.

1. Pulsing the up and down digital inputs on the controller. This allows one to use two manual monentary switches or as you are doing two digital outputs pins from an Arduino.

2. If accepts a analog voltage from an external pot. Or if you used a Arduino PWM output pin followed with a low pass filter (a resistor/cap) you could control speed using the Arduino analogWrite() commands.

 Both methods have the same basic limitation, your Arduino has no idea what the actual speed of the motor is at anytime. That is, there is no speed feeback information avalible to the Arduino. One could attach a optical or magnetic speed sensor to the motor shaft and read the pulses directly into the Arduino and then calculate the speed. This could then be used in your Arduino sketch to decide when and how much to increase or decrease the speed commands to the PWM controller.

Lefty
Logged

Pages: [1]   Go Up
Jump to: