 # RUNNING LINEAR ACTUATOR

DEAR ALL,
I NEED programming help. Here i am trying to actuate the linear actuator.
Code algorithm like this. this code to run sun tracker without feed back .
linear actuator details: 24v 3A,600mm stroke, actuator speed 3.2mm/sec, resolution1.89 pulse/mm.

Algorithm:
TRACK TIME: 7AM ,TRACK STOP TIME:6PM, INITtime-> 6:45
initialize the linear actuator:
tracker Desire:(TSslope)+intercept, where TS=(h3600)+(m*60)+s;
tracker Actual:
in what way we can calculate tracker actual POSITION??
mode: TRACK->IN BETWEEN TRACK START TIME AND STOP TIME
STOW → above stop time and below stop time, actuator @ middle with 300mm from start/ 0center position
INIT-> when time between track time and INIT time.actuator start from-45 position length will 0mm

openloop.rar (8.31 KB)

time vs actuator.xlsx (12.7 KB)

What part do you need help with? You have an equation (that is good for one day) that defines a position. You need to know what time it is now. You have not posted any code that proves you know that.

Using now, you can determine the position. Knowing the position, you can determine the PWM value. You write that PWM value to the pin that the linear actuator driver is connected to. You haven't mentioned what kind of driver you are using. The Arduino eill NOT directly drive the actuator you mentioned.

Question is :
1)How can i calculate tracker actual angle.? Now i need formula t0 calculate tracker actual and convert it back to +45 and -45 degree. if i say go to tracker Desire position it should move from its actual position . Wr.t time.

Tracker Desire angle calculated and its graph is below:
I am assuming @ 12 PM tracker desire would be zero and @7Am as +45 degree and @ 16pm it should be -45 degree.

out.bmp (946 KB)

The angle obviously depends on the geometry of your mechanical system. It is very basic trigonometry, however you have not described the arrangement, so how can you expect help?

jremington:
The angle obviously depends on the geometry of your mechanical system. It is very basic trigonometry, however you have not described the arrangement, so how can you expect help?

I have below arrangement:
Arduino board. RTC for getting time , motor Drive to drive linear actuator.
linear actuator details: 24v 3A,600mm stroke, actuator speed 3.2mm/sec, resolution1.89 pulse/mm.

Desired angle assumption
@ 7AM : desire angle: 45 deg , actuator length: 0mm
@12pm:desire angle: 0deg , actuator length: 300mm
@18pm:desire angle: -45 deg , actuator length: 600mm
after 18 and before 7AM desire angle: 0 deg , actuator length: 300mm

Point is to calculate actual angle._How to calculate actual angle HERE._I need formula to calculate it
i wanna say within particular time, DIff of actual- desired is +/- 2 deg move actuator either forward or reverse Direction

Code algorithm like this. this code to run sun tracker without feed back .

Sorry but I think everybody is missing this point, NO ANGULAR FEEDBACK, so you do not know where you are starting from let alone where you are. If you want an ACCURATE angular position to track the sun, you will need ANGULAR FEEDBACK. Calculating what the angle should be is going to be with some errors, then even if you knew your initial position, calculating your current position will likewise have errors. I suggest you attach a potentiometer to the shaft that the panel turns on to give you ANGULAR FEEDBACK, this will solve your hardest problem.

Tom...... :) (See I didn't get on my soapbox about superior sunsensor tracking..)

TomGeorge:

Code algorithm like this. this code to run sun tracker without feed back .

Sorry but I think everybody is missing this point, NO ANGULAR FEEDBACK, so you do not know where you are starting from let alone where you are.
If you want an ACCURATE angular position to track the sun, you will need ANGULAR FEEDBACK.
Calculating what the angle should be is going to be with some errors, then even if you knew your initial position, calculating your current position will likewise have errors.
I suggest you attach a potentiometer to the shaft that the panel turns on to give you ANGULAR FEEDBACK, this will solve your hardest problem.

Tom… (See I didn’t get on my soapbox about superior sunsensor tracking…)

I already done the program with feedback and successfully it is working. Now I wanted to reduce my sensor cost.We know that Sun elevation angle almost 0 around 12pm-12:30. Here i am assuming that principle. I move actuator on basis of Speed it move .We know that with actuator we can move max 45 deg to -45 deg. So morning i assume it taken 45 deg .We know( speed =distance/ time) if youknow mm to be moved we can calculate deg .

AMPS-N: Point is to calculate actual angle._How to calculate actual angle HERE._I need formula to calculate it i wanna say within particular time, DIff of actual- desired is +/- 2 deg move actuator either forward or reverse Direction

Perhaps you'd have an easier time using MultiMap(). Your in[] would be the hour of the day and your out[] would be the desired actuator length.

Perhaps you’d have an easier time using MultiMap(). Your in would be the hour of the day and your out would be the desired actuator length.
[/quote]

I am not using any analog sensor to read the value.I wanna simple as simple possible. And example program you mentioned , How they take in/out values.

Modified algorithm below:

**Desired angle calculation:**y = -0.00227272727273x + 102.272727273 where x= (3600hour)+(minute60)
Actual angle calculation:
Linear actuator speed = 3.2mm/sec and when i convert to mm/min =0.0192.
linear actuator has to run from 7AM to 18pm . i.e approximately 11 hour/660 min . so i need formula that convert mm to degree format. Degree must be +45 deg to -45 deg . Which give me Actual angle per minute.

length distribution of actuator in mm : y = 0.0151466666667x - 381.504. How do i covert these MM in to degree format of +45 to -45.

``````static int hh;
static int mm;
static int ss;
signed int  degree;
unsigned int TS;

static float slope= 0.00227272727273;
static float intercept=- 102.272727273;
signed int length;

void setup()
{
Serial.begin(9600);
hh=06;
mm=45;

}

void loop()
{
calc_min();
if(hh<24)
{
signed int legth;
Serial.print("HH-MM: ");
Serial.print(hh);Serial.print(":");Serial.println(mm);
TS=(3600*hh)+(60*mm);
Serial.print("TS:");
Serial.println(TS);
degree=(TS*slope)+intercept;
length = (0.0151466666667*TS) - 381.504;
Serial.print("Desired Degree:");
Serial.println(degree);
Serial.print("legth:");
Serial.println(length);
Serial.println("..................");
}
delay(1000);

}
void calc_min()
{

if(mm<60)
{
mm=mm+5;
}else if(mm==60)
{
mm=0;hh=hh+1;
}
}
``````
``````Serial.print("legth:");
Serial.println(length);
``````

Ass-biter. At that point, you really do have a variable in scope called "legth", but you're actually printing the value of the global "length", despite what you label it.

AWOL:

``````Serial.print("legth:");
``````

Serial.println(length);

``````

Ass-biter.
At that point, you really do have a variable in scope called "legth", but you're actually printing the value of the global "length", despite what you label it.
``````

If you see full code i am calculating the length in MM. the code is not complete. Here this length has to be converted to Degree like Desired angle does.
My question here is How can i convert my Length in mm into degree to get my actual angle depend on speed i.e 3.2mm/sec,0.192 mm/min when distributed over 11 hour of track

How can i convert my Length in mm into degree to get my actual angle depend on speed

That'll depend on the geometry of this stuff is all connected together, won't it?

AWOL:

How can i convert my Length in mm into degree to get my actual angle depend on speed

That'll depend on the geometry of this stuff is all connected together, won't it?

can you help me to solve this geometry???

In the eight or so minutes between my last post and your knee-jerk response, couldn't you have thought about what details another person might need to help you? And, in thinking about it, you might have come closer finding your own solution.

AWOL: In the eight or so minutes between my last post and your knee-jerk response, couldn't you have thought about what details another person might need to help you? And, in thinking about it, you might have come closer finding your own solution.

ya i know , But i need get some math equation ,it could solve my problem. I need simple formula that convert my MM into degree. If you know answer just help it out.Else give link where i can find my solution .So i could do it myself

Another eight minutes and still no details. Good luck with your project.