SEW Winch Control - Cable Cam Project

Hi All
I have set out on a rather difficult project given my level experience and expertise in electronics and programming. To keep things short and sweet it all starts with taking control of SEW’s “MOVITRAC B” with an Arduino… of course…

The image of the X10 “plug” comes from page 229 of the MOVITRAC B System Manual
[url=http://bever.bg/BG/Documentation/EN/INVERTERS/Actual%20Types/Movitrac%20B/System%20M

This thread speaks of controlling a digital pot that has a voltage higher than that of the Arduino itself, which also requires an additional power supply, which is one way i can take control of this feature. So my one question is do you think I could use the 10V output this drive provides for the adjustment as the power supply i need for the digital pot?

My other question revolves around using the control of the Current if S11 is flicked to the bottom position. I have tried to do searches that covers this as an option with no luck.

The ultimate purpose of this plug/pot is to control the speed the drive makes the motor run at. Clockwise and Counter Clockwise directions are controlled by a separate 24V switching circuit.

Please let me know if you need me to dig out more info from the user manual if you require more info.

Yes, using the device's own 10V output as the reference voltage for a potentiometer input is the correct way to do it. That's what the image you attached shows.

Look up "current loop". It's a popular method of controlling industrial equipment as it's immune to voltage spikes and most other kinds of interference you get in an industrial plant. Reading current loop signals (like from a sensor) is a simple matter of one resistor and an Arduino's analog input. Producing current loop signals is a little more involved. There's probably lots of specialised chips to do this.

Current loops are often specified as 4-20mA, which will map to the actual range of values being measured. This means that if the current goes below 4mA to zero, the reading is invalid, so you know that the wire is disconnected.

Hi, Thread you linked doesn't work. What you are talking about is a standard analog speed control input with picture x10.jpg

A digital pot, is an internal counter, that imitates a pot, that you use two digital inputs to increase and decrease the value of. This counter value is then used as your setpoint speed for the movitrac to respond to.

See page 107 Motor Potentiometer.

Tom..... :)

The link that is not working is as follows: http://forum.arduino.cc/index.php?topic=143216.0 I will most likely use LM324 as mentioned towards the end of the thread.

I am struggling in getting something working and am hoping someone can point me to some online tutorials or a few projects where someone has done something similar. My aim is to control this digital pot with a joystick. It will in the end actually be a two axis joystick controlling two separate motors for 2D control of an object. However what I need to study further is a combination of mapping and if statements... I think... My Joystick in the center position will put out a value of about 512, although the cheap one I am using that has been gutted from an old RC Tx bounces a bit above and a bit below that. So when I move the stick to +Y axis, I want to map those value as (0, 510, 0, 255) to a PWM pin say Pin3 possibly here I use an if statement then map the -Y values form the Joystick (515, 1023, 0, 255) to say Pin10.

Thanks in advance G

Hi,

Is this to be used in an industrial situation? So you want the arduino to be the speed and direction setting interface with the joystick and the Movitrac?

What do you want the joystick to do? Left increase speed, Right decrease speed, Centre speed stays at selected speed. OR Left motor CW with increasing speed, Right CCW with increasing speed, Centre motor OFF

Tom..... :)

Affirmative Tom. I want one joystick to control 2 separate movitrac speed drives which in turn control two separate sew motors/winches.

At centre all values are low and zero. Except pin2 will be HIGH and Pin 7 will be HIGH.

When when the joystick is moved to Y+: Pin 6 goes HIGH = CW on motor A Pin 5 gets PWM signal from 0 to 255 = ultimately 0 to 10v in the movitrac for CW speed.

When when the joystick is moved to Y-: Pin 10 goes HIGH = CCW on motor A Pin 5 gets PWM signal from 0 to 255 = ultimately 0 to 10v in the movitrac A for CCW speed.

When when the joystick is moved to X+: Pin 9 goes HIGH = CW on motor B Pin 3 gets PWM signal from 0 to 255 = ultimately 0 to 10v in the movitrac B for CW speed.

When when the joystick is moved to X-: Pin 11 goes HIGH = CCW on motor B Pin 3 gets PWM signal from 0 to 255 = ultimately 0 to 10v in the movitrac B for CCW speed.

I will try post a some pics from my phone of my bread board which i am bust testing with.

See image below?

Hi,
Fine, the usual joystick units have a switches integrated into the base, one for x axis and one for the y axis.
They operate in the neutral of the joystick throw for about + or - 3Deg, to provide a signal to the controller to disable the unit, this avoids inching of the motors while in neutral position.

Tom… :slight_smile:

Yeah there are a number of joysticks available that have built in switches as an additional signal for that reason. In a future version of this build I would like to have this joystick wireless so as not to be tethered and limited to a certain from the winch which is my reason for bringing those inputs into the Arduino.

Hi, I would be looking into safety, that is making sure you have valid signals from your joystick, power supply is correct, etc. The joystick should not be able to output 0V or the full voltage that it is using. That way if you have an open circuit in any of the joystick wiring the output will go to 0V or Vcc, and you can test for that to cause a safety lockout.

Tom.... :)

Could those with a bit of time please go through my sketch and give me some guidance as to what i could do better and where things could be a bit more streamline.
Given that I have only been writing code for two weeks without a single class, feel free to go easy on me…

I hope a photo of the breadboard layout will suffice

//Joystick Inputs:
const int updownInPin = A4;        // Analog input pin that "up down stick" is attached to
const int leftrightInPin = A5;     // Analog input pin that the "left right stick" is attached to
const int estopInPin = A2;         // Activate and deactivate the "E-Stop"
const int lockoutInPin = A3;       // Activate and deactivate the "E-Stop"
const int faultInPin = 12;         // Reset any Faults on the drive may encounter

//Signal Outputs to Vairiable Speed Drives:
const int upOutPin = 6;          // UP LED or Clock Wise for drive A
const int downOutPin = 10;       // DOWN LED or Counter Clock Wise for drive A
const int leftOutPin = 11;       // LEFT LED or Clock Wise for drive B
const int rightOutPin = 9;       // RIGHT LED or Counter Clock Wise for drive B
const int faultOutPin = 4;       // Fault Reset
const int estopOutPin = 2;       // Emergency Stop 

//PWM Outputs to Drives:
const int updownOutPin = 5;      // Analog input pin that "Up Down JStick" is attached to
const int leftrightOutPin = 3;   // Analog input pin that "Left Right JStick" is attached to

//for information only
const int centreOutPin = 7;

int updownJSValue = 0;               // value read from the "up down Joy Stick"
int leftrightJSValue = 0;            // value read from the "left right Joy Stick"
int updownoutputValue = 0;           // value output to the PWM (analog out)
int leftrightoutputValue = 0;        // value output to the PWM (analog out)
int estopState = 0;
int lockoutState = 0;
int faultState = 0; 

void setup() {
  Serial.begin(9600);    
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, INPUT_PULLUP);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);
  pinMode(A4, INPUT);
  pinMode(A5, INPUT);
  }

void loop() {

//Fault reset:
faultState = digitalRead (faultInPin);
if (faultState == LOW){
  digitalWrite (faultOutPin, HIGH);
  }
  else {
    digitalWrite (faultOutPin, LOW);
    }

// E-Stop and push botton Lock Out Feature
estopState = digitalRead (estopInPin);
lockoutState = digitalRead (lockoutInPin);
  if (estopState == HIGH && lockoutState == HIGH){       
    analogWrite (estopOutPin, LOW);
    updownJSValue = analogRead(updownInPin);
    leftrightJSValue = analogRead(leftrightInPin);

//Signal for UP to go HIGH:
    if (updownJSValue >=10 && updownJSValue <=508){
      digitalWrite (upOutPin, HIGH);
      updownoutputValue = map(updownJSValue, 507, 100, 0, 255);
      analogWrite (updownOutPin, updownoutputValue);
    }
    else{
      digitalWrite (upOutPin, LOW);
    }

//Signal for LEFT to go HIGH:
    if (leftrightJSValue >=10 && leftrightJSValue <=508){
      digitalWrite (leftOutPin, HIGH);
      leftrightoutputValue = map(leftrightJSValue, 507, 100, 0, 255);
      analogWrite (leftrightOutPin, leftrightoutputValue);
    }
    else{
      digitalWrite (leftOutPin, LOW);
    }

//Signal for DOWN to go HIGH:
    if (updownJSValue >=517 && updownJSValue <1013){
      digitalWrite (downOutPin, HIGH);
      updownoutputValue = map(updownJSValue, 518, 900, 0, 255);
      analogWrite (updownOutPin, updownoutputValue);
    }
    else{
      digitalWrite (downOutPin, LOW);
    }

//Signal for RIGHT to go HIGH:
    if (leftrightJSValue >=517 && leftrightJSValue <=1013){
      digitalWrite (rightOutPin, HIGH);
      leftrightoutputValue = map(leftrightJSValue, 508, 900, 0, 255);
      analogWrite (leftrightOutPin, leftrightoutputValue);
    }
    else{
      digitalWrite (rightOutPin, LOW);
    }

//Indidcation Joystick is in Centre Position
    if (updownJSValue >508 && updownJSValue <517) {
      digitalWrite (centreOutPin, HIGH);
    }
    else if (leftrightJSValue >508 && leftrightJSValue <517) {
      digitalWrite (centreOutPin, HIGH);
    }
    else{
      digitalWrite (centreOutPin, LOW);
    }
  }
  else {
  analogWrite (updownOutPin, 0); 
  analogWrite (leftrightOutPin, 0);
  digitalWrite (estopOutPin, HIGH);
  digitalWrite (centreOutPin, HIGH);
  digitalWrite (upOutPin, LOW);
  digitalWrite (downOutPin, LOW);
  digitalWrite (leftOutPin, LOW);
  digitalWrite (rightOutPin, LOW);
  
  }
Serial.print(" U D PWM = " );                       
Serial.println(updownoutputValue);      
Serial.print("U D JoyS = " );                       
Serial.println(updownJSValue);
Serial.print(" L R PWM = " );                       
Serial.println(leftrightoutputValue);      
Serial.print("L R JoyS = " );                       
Serial.println(leftrightJSValue);
Serial.print("  E-Stop = " );                       
Serial.println(estopState);
Serial.print("Lock Out = " );                       
Serial.println(lockoutState);
Serial.println();

  delay(10);
}

It starts out great with a good set of const ints but then you don't use them in setup()! Once you have defined them, always use them.

Your indentation is a little off. It's hard to find the opposite brace that belongs with if (estopState == HIGH && lockoutState == HIGH){  It also helps if you put a comment in the else block since it's more than a page away. For example:

  } else {
    //either e-stop or lockout is low: shut down operation

Take out the delay at the end. This loop should run quickly to get the best responsiveness. If this is just to reduce the amount of serial debugging data, the use the millis() technique in Blink Without Delay to only produce this output once or twice per second.

That is an EXTREMELY NICE breadboard layout. The only advice I have for that is it appears the connection between the two ground rails on the board depends on the switch at the top. If you remove that switch for any reason then the thing stops working. I always put two wires on my breadboards and push them down beside the board, since they are virtually a permanent part of the breadboard.

Thank you for your constructive comments.

How do I proceed to the next step being a system that can “learn a move or a track”. Obviously I will need to add encoders to the system so the Arduino knows where the carridge is in its 2D flight path. I would want to define a “home” position a “start” position and an “end” position. As the carridge tracks from start to end positions the height of the carridge will change. The first one or two runs would be a learning curve for the operator done manually thereafter I would like to have the ability to smooth out the track and get a more steady flightpath… does this make sense?
I add an image that shows the rigging setup, controls and positions of different elements. The rigging system is more suited to long distance runs at high speeds with much smaller inputs to maintain a constant height of the carridge off the ground.