Author Topic: Linear actuator Movement  (Read 740 times)

0 Members and 1 Guest are viewing this topic.

Offline ajit.nayak87Topic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
    • Skype -
Linear actuator Movement
« on: January 03, 2014, 05:23:46 AM »
Dear all,

I wanted to run linear actuator for solar tracking application.  I am trying to run predefined position of actuator.
tracking is between 7AM to 18 PM. i.e TS=(3600*hour)+(60*min) .i.e 25200 to 64800 Seconds  or 660 minutes.
Linear actuator:          24v ,3.2mm/sec speed, 600mm stroke.
Desired angle calculation:

static float slope= 0.00227272727273 ;
static float intercept=- 102.272727273;

Actual angle calculation
here i am assuming pos as constant, since it vary with time it has to be changed.
 pos=(TS*0.0166666666667)- 480;
Actual_Degree =((3 * pos) / 20) - 45;
How can vary my time in below equation. I wanna replace Ts with time so i get position it has moved. SO i get relvant degree.

actual angle calculation part:
600mm stroke and total time 660 mm (7Am-18pm)
time *speed =(10/11)
time=(25/88) sec per minute
if i wanna move 2s . time = 2*(88/25);

angle= ((3 * position) / 20) - 45
position = ((20 * angle) / 3)+ 300

since position = 3.2 * time

Code: [Select]
unsigned int TS;
static float slope=0.0025 ;
static float intercept=- 117;

signed int Desire_Degree;
signed int Actual_Degree;
static int pos;

void setup()

void loop()
  Serial.print("HH-MM: ");
  //Desire degree calculation
  Serial.print("Desired degree:");

void  Calc_actual()
   static unsigned long prev_time=0;
  static unsigned long time_intv=0;
  // static int time=176/25;
  pos=(TS*0.0166666666667)- 480;
  //Actual_Degree =((96 * pos) / 200) - 45;
  Actual_Degree =((3 * pos) / 20) - 45;

unsigned long getDeltaT(unsigned long st){

  unsigned long deltaT=0;
  unsigned long currTime=millis();
  /*Serial.println("inside utils");

  if(currTime < st)
    deltaT = (2^32-1) - st + currTime;
    deltaT = currTime - st;
   /* Serial.println("inside utils deltaT");
  return deltaT;


void calc_min()

}else if(m==60)

Best Regards


Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: Linear actuator Movement
« Reply #1 on: January 03, 2014, 11:07:26 AM »
There are parts of your problem that are not quantified.

How does linear movement turn into angle? Is this a linear or parabolic relation? If you have a linear actuator driving a rod around a rotational joint, it's parabolic, and you may need to compensate for that.

Also, your control loop may be simpler if you can keep two values: "Where I am" and "Where I want to be." You can re-calculate "where I want to be" based on absolute time each time through the loop, and then compare to "Where I am," and make a change if the difference is large enough.

Also, if you are expecting to do this work based on dead reckoning over many hours, with frequent starts and stops, then the specified speed in mm/s is not going to help you, because the actual speed you will get from each small burst of movement is going to be dominated by load and acceleration, not max unloaded speed. And load changes with things like "wind" and "temperature." Thus, your best bet is to get an encoder that can measure where your load is currently located, which will make the system self-correcting.

Offline CJAlbertson

  • Jr. Member
  • **
  • Posts: 24
  • Helpful? 1
Re: Linear actuator Movement
« Reply #2 on: January 13, 2014, 03:36:33 PM »

You are making this harder than it needs to be.  The track the sun all you need is a simple loop that runs (say) once per every few seconds.  It does this:

While(1) {
  time = what time is it?
  angle = What angle should I point to for the time
  What length should the actuator be to get that angle
  get current length (perhaps from a variable or an encoder
  move (desired length - current length)

  wait a few seconds // motor will last longer if you wait longer here

If you plan to run with no encoder then periodically you need to find the exact position.  So on start up every day run the motor one step shorter, the check for a limit switch.  Keep going untillthe switch changes state.  Now you know your zero location.

the function that moves the motor must always update "current location"
Chris A. in So. Cal.


Get Your Ad Here