Go Down

Topic: Victor 883 motor controllers (Read 3745 times) previous topic - next topic

irethedo

Has anyone successfully been able to drive Victor 883 motor controllers with the Arduino?

It has been hit and miss for me where I was able to get the Victor spinning a motor once but can not do it consistently. Is there a timing or value limit on this device that affects how the arduino needs to control it?

Typically, the victor operates with a pwm of 0 for full reverse and 127 for neutral and 255 for full forward but I am wondering if the arduino has the capability of driving the victor at its extremes or if there is a range that it can only drive the victor. (i.e. 80 - 200 PWM)

The other question is whether there needs to be some sort of a delay on the arduino or not when controlling the victor.

Any info on this is appreciated

Aeturnalus

I'm fairly certain the Victor uses RC "PWM", which isn't really PWM in the Arduino sense.  Use the Servo library instead, and uses writeMicroseconds between 1000 (full rev) and 2000 (full fwd), with 0 at 1500.  Experiment a bit - use a potentiometer to figure out the correct values for everything. 

PWM in Arduino refers to duty-cycle modulation, giving a square-wave output suitable for directly driving LEDs and/or motor H-bridges, while the Victor is expecting RC pulses, which are a 1ms to 2ms pulse every 20ms, where the pulse length is proportional to the joystick position (a form of PPM).  The Servo library will handle it all for you.

irethedo

Thanks for the info!

Is there a white paper or some document available that describes the
Servo Library, its commands, and how to use it?

Aeturnalus

http://www.arduino.cc/en/Reference/Servo is the reference page for the Servo Library.  It is admittedly somewhat awkward to be referring to a motor controller as a servo, but it's the easiest way to generate the correct output.  

Basic usage is as such:

Code: [Select]

#include <Servo.h>

#define VICTOR_PIN // the pin that the victor's signal line is attached to

Servo victor;

void setup() {
 victor.attach(VICTOR_PIN);
}

void loop() {
 victor.writeMicroseconds(1000); // drive full reverse
 delay(1000); // wait a second to see the effect
 victor.writeMicroseconds(2000); // drive full forwards
 delay(1000); // wait a second to see the effect
}

zoomkat

If your motor controller takes standard RC servo PPM control signals, you might try the below code for testing.

Code: [Select]

// zoomkat 10-4-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// for IDE 0019 and later
// Powering a servo from the arduino usually DOES NOT WORK.

String readString;
#include <Servo.h>
Servo myservo;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);
  myservo.attach(7);  //the pin for the servo control
  Serial.println("servo-test-21"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(1); 
    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      readString += c; //makes the string readString
    }
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string
    int n;
    char carray[6]; //converting string to number
    readString.toCharArray(carray, sizeof(carray));
    n = atoi(carray);
    myservo.writeMicroseconds(n); // for microseconds
    //myservo.write(n); //for degees 0-180
    readString="";
  }
}
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

irethedo

#5
Apr 22, 2011, 04:38 am Last Edit: Apr 22, 2011, 05:26 pm by irethedo Reason: 1
My code was initially set up to write a PWM to a PWM output pin with 0 as full reverse, 127 as neutral and 255 as full forward.

Can I somehow set the timer so that it only outputs pulses in a 1ms - 2ms range so that I can use the analogwrite with the PWM value to control the victor

OR

Is there an easy way for me to convert the 0 - 255 values to 1000 - 2000 milisecond values needed for use with the servo write  command (which will require a PWM of 127 to calculate to 1500 microseconds)?

Which is easier and does anyone have any tips on how to do this?

thanks

Aeturnalus

Use the map(x, in_min, in_max, out_min, out_max) function:

Code: [Select]

myServo.writeMicroseconds(map(originalPWM, 0, 255, 1000, 2000));

irethedo

#7
Apr 23, 2011, 02:40 pm Last Edit: Apr 23, 2011, 04:27 pm by irethedo Reason: 1
Quote
myServo.writeMicroseconds(map(originalPWM, 0, 255, 1000, 2000));


That is simply brilliant and works very well at scaling my PWM values to what is required for the
victors - Thank you!


Aeturnalus

No problem - I hope your project is successful!

Go Up