Synchronizing Linear Actuators

Hello, I was wondering of anyone could help with a little problem I'm having. So I have 4 linear actuators that don't all extent/retract at the same speed. And I was wondering if anyone might know how to tackle this.

Currently I'm using Cytron Motor to initialize the actuators and I have wired a toggle switch so that when you flip it up it raises the motors, down lowers the motors and when its in the middle the motors stop. But like I said when I extend or retract, they're out of sync.

I didn't know if this would be something with the Pot coming from the motors (seeing as the voltage determines their relative lengths).

Thanks!

Derekbird02:
Hello, I was wondering of anyone could help with a little problem I'm having. So I have 4 linear actuators that don't all extent/retract at the same speed. And I was wondering if anyone might know how to tackle this.

Currently I'm using Cytron Motor to initialize the actuators and I have wired a toggle switch so that when you flip it up it raises the motors, down lowers the motors and when its in the middle the motors stop. But like I said when I extend or retract, they're out of sync.

I didn't know if this would be something with the Pot coming from the motors (seeing as the voltage determines their relative lengths).

Thanks!

Welcome to the Arduino forum. Synchronizing things is something you have to plan for. It does not happen just because the name plate on motors are the same and you apply the same voltage to each unit.

Are you powering them using PWM from the Arduino? If so, you can make each actuator motor take a single step at the same time.

Paul

Is there any pot or encoder or other feedback inside the actuator? Can you give us a datasheet link for that?

Sometimes these actuators will have space to put a pot or encoder inside. If you don't want to repurchase to get the feedback version, it may be possible to modify the ones you have.

The next alternative is to buy 4 linear potentiometers. You can get them in a size/shape which looks a lot like a linear actuator.

Then you need 4 separate motor drivers. To select a motor driver you need to know the maximum current the actuator requires. Sometimes this is listed as stall current. It can be 4× the normal current.

Then you need to do some programming with the Arduino to read 4 feedbacks and send 4 motor control signals.

MorganS:
Is there any pot or encoder or other feedback inside the actuator? Can you give us a datasheet link for that?

Sometimes these actuators will have space to put a pot or encoder inside. If you don't want to repurchase to get the feedback version, it may be possible to modify the ones you have.

The next alternative is to buy 4 linear potentiometers. You can get them in a size/shape which looks a lot like a linear actuator.

Then you need 4 separate motor drivers. To select a motor driver you need to know the maximum current the actuator requires. Sometimes this is listed as stall current. It can be 4× the normal current.

Then you need to do some programming with the Arduino to read 4 feedbacks and send 4 motor control signals.

Yes there are potentiometers input for the linear actuators. I didn't know if it would be as simple as reading the values from the Pots (seeing as the represent their respective lengths), mapping them to a same value range, and if their not equal then move which ever one is behind while not moving the one that is ahead. I had found some source code that looks like that is what I need but I was looking for a second opinion on the matter. I have linked the images of the code below. Thanks!

Pictures of code are useless. Post the actual code. Use the full-size reply box which has the </> code button available.

For the fastest possible movement, I'd plan on running them all at maximum speed and then slow down any one which is ahead.

Sorry, this is new to me. And yea I think that this code is doing just that.

 1 //Sync Acuators
  2 
  3 //Variables
  4 int Act0Up = 2;                          // Sends signal to Coil side of relay to move actuator 0 UP
  5 int Act1Up = 3;                          // Sends signal to Coil side of relay to move actuator 1 UP
  6 int Act0Down = 4;                        // Sends signal to Coil Side of relay to move actuator 0 DOWN
  7 int Act1Down = 5;                        // Sends signal to Coil Side of relay to move actuator 1 DOWN
  8 int KeyUp = 6;                           // Reads signal from keylock switch. If high it will be used to move the actuators UP
  9 int KeyDown = 7;                         // Reads signal from keylock switch. If high it will be used to move the actuators DOWN
 10 int ActPot0 = A0;                        // Reads signal from potentiometer in actuator 0 (left side when looking at back of trailer).
 11 int ActPot1 = A1;                        // Reads signal from potentiometer in actuator 1 (right side when looking at back of trailer).
 12 int ActPot0Val;                          // Variable to save the value of the potentiaometer from ActPot0
 13 int ActPot1Val;                          // Variable to save the value of the potentiaometer from ActPot1
 14 int ActPot0MapVal;                       // Variable to store the new map value of the potentiameter
 15 int ActPot1MapVal;                       // Variable to store the new map value of the potentiameter
 16 int LimitUp;                             // Limit to be set to stop the actuators from extending to far
 17 int LimitDown;                           // Limit to be set to stop the actuators from retracting to far
 18 int i=0;
 19 const int buffer = 9;                    // Buffer for the actuators to equal out 
 20 
 21 void setup() {
 22 
 23   pinMode(Act0Up, OUTPUT);
 24   pinMode(Act1Up, OUTPUT);
 25   pinMode(Act0Down, OUTPUT);
 26   pinMode(Act1Down, OUTPUT);
 27   pinMode(KeyUp, INPUT);
 28   pinMode(KeyDown, INPUT);
 29 
 30   digitalWrite(Act0Up, LOW);
 31   digitalWrite(Act1Up, LOW);
 32   digitalWrite(Act0Down, LOW);
 33   digitalWrite(Act1Down, LOW);
 34   digitalWrite(KeyUp, LOW);
 35   digitalWrite(KeyDown, LOW);
 36 
 37   ReadPots();
 38   Serial.begin(9600);
 39   delay(250);
 40 }
 41 
 42 void loop() {
 43 
 44   Serial.print("i value : ");
 45   Serial.println(i);
 46   ReadPots();
 47 
 48   if(digitalRead(KeyUp) == HIGH){
 49   Up();
 50   }
 51   else{
 52   digitalWrite(Act1Up, LOW); 
 53   digitalWrite(Act0Up, LOW);
 54   }
 55 
 56   if(digitalRead(KeyDown) == HIGH){
 57   Down();
 58   }
 59   else{
 60   digitalWrite(Act1Down, LOW); 
 61   digitalWrite(Act0Down, LOW);
 62   }
 63 }
 64 
 65 void ReadPots() {
 66   ActPot0Val = 0;
 67   ActPot1Val = 0;
 68   
 69   for(i = 1; i < 4; ++i){
 70   ActPot0Val = ActPot0Val + analogRead(ActPot0);
 71   ActPot1Val = ActPot1Val + analogRead(ActPot1);
 72   }
 73 
 74   ActPot0Val = ActPot0Val / 4;
 75   ActPot1Val = ActPot1Val / 4;
 76   Serial.print("Actuator0 AVG: ");
 77   Serial.println(ActPot0Val);            // Prints to the Serial Monitor the value of the POT 0
 78   Serial.print("Actuator1 AVG: ");
 79   Serial.println(ActPot1Val);            // Prints to the Serial Monitor the value of the POT 1
 80   delay(25);
 81   
 82   ActPot0MapVal = map(ActPot0Val, 58, 743, 0, 608);
 83   ActPot1MapVal = map(ActPot1Val, 59, 746, 0, 608);
 84 
 85   Serial.print("Actuator0 MV: ");
 86   Serial.println(ActPot0MapVal);            // Prints to the Serial Monitor the mapped value of the POT 0
 87   Serial.print("Actuator1 MV: ");
 88   Serial.println(ActPot1MapVal);            // Prints to the Serial Monitor the mapped value of the POT 1
 89   delay(25);
 90 }
 91 
 92 
 93 
 94 
 95 void Up(){                                  // If the Up keylock switch is activated then it will move the actuators Up
 96     if (EqualLR()&&EqualRL()){
 97     digitalWrite(Act1Down, LOW); 
 98     digitalWrite(Act0Down, LOW);
 99     digitalWrite(Act1Up, HIGH); 
100     digitalWrite(Act0Up, HIGH); 
101     }
102     else {
103     EqualizeUP();  
104     delay(5);
105    }
106 }
107 
108 void Down(){                                // If the Down keylock switch is activated then it will move the actuators Down
109     if (EqualLR()&&EqualRL()){
110     digitalWrite(Act1Up, LOW); 
111     digitalWrite(Act0Up, LOW); 
112     digitalWrite(Act1Down, HIGH); 
113     digitalWrite(Act0Down, HIGH); 
114     }
115     else {
116     EqualizeDOWN();
117     delay(5);  
118     }
119 }
120 
121 void EqualizeUP(){
122     if(ActPot0MapVal > ActPot1MapVal){
123     digitalWrite(Act0Up, HIGH);
124     digitalWrite(Act1Up, LOW);
125     }
126 
127     if(ActPot0MapVal < ActPot1MapVal){
128     digitalWrite(Act0Up, LOW);
129     digitalWrite(Act1Up, HIGH);
130     }
131 }
132 
133 void EqualizeDOWN(){
134     if(ActPot0MapVal > ActPot1MapVal){
135     digitalWrite(Act1Down, HIGH);
136     digitalWrite(Act0Down, LOW);
137     }
138 
139     if(ActPot0MapVal < ActPot1MapVal){
140     digitalWrite(Act1Down, LOW);
141     digitalWrite(Act0Down, HIGH);
142     }
143 }
144 
145 boolean EqualLR(){
146   return abs((ActPot1MapVal - ActPot0MapVal) < buffer);
147 }
148 
149 boolean EqualRL(){
150   return abs((ActPot0MapVal - ActPot1MapVal) < buffer);
151 }

Delays are not like grains of sugar to be scattered around the code making it sweeter. Treat them like giant boulders that get in the way of doing stuff.

Use the BlinkWithoutDelay method to limit how often the serial printing happens.

Use analogWrite() to slow down sn actuator without stopping it dead. You may need to change motor control pins to get them all on PWM-capable pins.

Hi,
Are the linear actuators ALL the same part number?
Can you post a link to data/specs of the actuators.

The pots that are fitted will provide position feedback that can be used to synchronize their movement.

Yes there are potentiometers input for the linear actuators. I didn't know if it would be as simple as reading the values from the Pots (seeing as the represent their respective lengths),

Does this mean they are of different full extended lengths?

Thanks... Tom... :slight_smile:

By the way posting code with added line numbers doesn't help - it doesn't compile and it isn't recognized by code editors.

Copy and paste the code verbatim please.

To do the synchronization smoothly probably requires PID loop control of the motor drive to each motor, its definitely not trivial.

Synchonized movement is probably easier to do mechanically or with stepper motor actuators - what are you trying to do?