Discussion in "Software" started by    ajit    Jan 4, 2014.
Sat Jan 04 2014, 11:02 AM
I am trying to write code for tracking application.I have Designed with feedback sensor which is working fine. I am trying to run same thing without feedback.
component used: RTC,linear actuator, arduino board. motor Driver

Linear actuator: 24v Dc,3A,3.2mm/sec speed , resolution 1.89 pulse /mm.
application: single axis tracker
tracker start time:7Am , tracker stop time:18 pm
Desired degree assumed: 7Am as -45 deg , 0 degree around 12:30 and 45 degree around 18pM

Desire degree equation:
TS=(3600*hour)+(60*SEC);
Desire_Degree=(TS*slope)+intercept;
static float slope= 0.00227272727273;
static float intercept=- 102.272727273;

Problem in calculating actual position: since we don't have feedback we don't know actuator position
for that i am considering:
step1:
we know above statement tracker has to run for 11 hour,660min,39600 sec
resolution=1.89 pulse /mm
for 600mm movement=600*1.89 pulses=1134
39600/1134=34.92sec
i.e means for every 34.92 sec it gives 1 pulse. /* here i don't how mm it will move, and convet it to actual angle*/

step2:

We know 600mm has to be traveled 660min i.e(10/11)mm/min
time=distance/speed=(10/11*3.2)=0.284 sec per min
if i wanna move for every 2 sec =2/0.284=7.04 minutes ie means it moves for every 7 min
angle= ((3 * position) / 20) - 45
or
position =((angle + 45) * 20) / 3
we know position = 3.2 * time;
angle =((96 * time) / 200) - 45;
how to calculate ton time of actuator??
is there any way we can do coding simple.?
let me know changes made in below code to calculate Actual Position of actuator

```
double Desire_Degree;
unsigned int TS;
static float slope= 0.00227272727273;
static float intercept=- 102.272727273;
static int length;
double Actual_Degree;
static int h;
static int m;
double Actual_postion;
static float ACT_SPEED=3.2;

void setup()
{
h=7;
m=30;

Serial.begin(9600);
}
static int time_interval;

void loop()
{
calc_min();
//Desire degree calculation
if(h<23)
{
TS=(3600*h)+(60*m);
Desire_Degree=(TS*slope)+intercept;

//Actual anngle calculation
time_interval=(10)/(11*ACT_SPEED)*(25/88);
// length=(TS*3.2);
length =(0.0151466666667*TS - 381.504);
Actual_Degree=((3 *length) / 20) - 45;

Actual_postion=((Actual_Degree + 45) * 20) / 3;

// actual_deg=((3*length)/200)-45;
Serial.print("HH-MM: ");
Serial.print(h);Serial.print(":");Serial.println(m);
Serial.print("Desired Degree:");
Serial.println(Desire_Degree);
Serial.print("Actual Degree:");
Serial.println(Actual_Degree);
Serial.print("length:");
Serial.println(length);
Serial.print("Actual pos:");
Serial.println(Actual_postion);
Serial.println(".................................");

}
delay(1000);
}

void calc_min()
{

if(m<60)
{
m=m+5;
}else if(m==60)
{
m=0;h=h+1;
}
}

```

In above code i consider all parameter as constant . So code may no work

[ Edited Sat Jan 04 2014, 11:03 AM ]
Sun Jan 05 2014, 07:54 PM
What is " resolution 1.89 pulse /mm." ?
Without some sort of feedback you can't do it.
Which Linear actuator are you using ?.

[ Edited Sun Jan 05 2014, 08:20 PM ]
Mon Jan 06 2014, 04:10 AM

What is " resolution 1.89 pulse /mm." ?
Without some sort of feedback you can't do it.
Which Linear actuator are you using ?.

ExperimenterUK

I am using PJM 350 model.why i cant do it without feedback. I don't need give me exact length. during calculation.
The idea is simple, but i could not able to put in c code
to determine actual angle you can say
initial length =0, final length=0;
problem calculate delta_time;
delta length=(speed* delta_time);
final length/ degree= converted form of +/-45 degree
initial length=final length
Mon Jan 06 2014, 08:52 PM

problem calculate delta_time;
delta length=(speed* delta_time);
final length/ degree= converted form of +/-45 degree
initial length=final length

ajit.nayak87

The problem is "speed."
It will vary with load, wear on the actuator and voltage.
Also there is start up acceleration to consider.
You can probably get acceptable results by a type of trial and error.
e.g.
Set up the full solar tracker.
Move from one stop to the other using 1 second pulses, 1 second apart.
Count the pulses.
Now space out the pulses to fill 12 hours.

Note the number of pulses needed each day and adjust the spacing.

Tue Jan 07 2014, 04:31 AM

problem calculate delta_time;
delta length=(speed* delta_time);
final length/ degree= converted form of +/-45 degree
initial length=final length

ajit.nayak87

The problem is "speed."
It will vary with load, wear on the actuator and voltage.
Also there is start up acceleration to consider.
You can probably get acceptable results by a type of trial and error.
e.g.
Set up the full solar tracker.
Move from one stop to the other using 1 second pulses, 1 second apart.
Count the pulses.
Now space out the pulses to fill 12 hours.

Note the number of pulses needed each day and adjust the spacing.

ExperimenterUK

Can you put it in code
Tue Jan 07 2014, 09:41 PM

Can you put it in code

ajit.nayak87

This code is much simpler that the code you already posted.
Pseudo code goes something like...

Run motor backwards until it hits the start of travel switch
while(1)
{
Run motor forward for one second.
Stop motor for one second.
increment count
if at end of travel ,exit loop
}
//save count as StepCount

for daily use..
count =StepCount
while(count)
{
Run motor forward one for one second.
Stop motor for 5 minutes //12 hours/StepCount

if at end of travel
{ //less steps are needed so adjust StepCount and gap
exit while loop
}
decrement count
}

//If not at end of travel, more steps are needed so adjust StepCount and gap

[ Edited Wed Jan 08 2014, 01:32 AM ]

### Information

Powered by e107 Forum System

#### Conversation

Sun Dec 08 2019, 04:50 PM
Marti Ogrady
Take advantage of this great service today:
Thu Nov 21 2019, 12:30 PM
raj2555
how to interface 8051 microcontroller with NRF24L01+ module
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.

### Recent

#### Comments

nabiha_anaya
Sun Dec 08 2019, 09:16 AM
ananyagupta
Tue Dec 03 2019, 07:53 AM
wells
Mon Nov 25 2019, 08:25 PM
auwal
Tue Nov 19 2019, 03:13 PM
ANKITPATEL
Mon Nov 18 2019, 11:00 AM
Casmir
Wed Nov 13 2019, 06:25 AM
DeepakBGattani
Mon Nov 11 2019, 01:31 PM
Jeanbusatta
Sun Nov 10 2019, 04:42 AM

#### Online

Guests: 50, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38108
Newest member: nabiha_anaya
Forum Activity
##### Posted By ilylily07
Sun Dec 08 2019, 01:24 PM
Hi .im humbly ask for your advice as i wrongly pur...
##### Posted By nabiha_anaya
Sun Dec 08 2019, 09:19 AM
My teacher assign me a project on "voice control h...
##### Posted By ExperimenterUK
Fri Nov 29 2019, 04:24 AM
" Is it possible to interface a fingerprint scanne...
##### Posted By ilylily07
Thu Nov 28 2019, 03:50 PM
You will not find any code for an 8051 as no one w...
##### Posted By ExperimenterUK
Tue Nov 26 2019, 05:44 PM
You will not find any code for an 8051 as no one w...
##### Posted By ilylily07
Tue Nov 26 2019, 04:13 AM
I tracked down a OV7670 data sheet.The OV7670 puts...
##### Posted By ExperimenterUK
Tue Nov 26 2019, 12:08 AM
I tracked down a OV7670 data sheet.The OV7670 puts...
##### Posted By ilylily07
Mon Nov 25 2019, 04:38 PM
The 8051 has too little memory to do anything us...
##### Posted By ExperimenterUK
Tue Nov 19 2019, 10:44 PM
The 8051 has too little memory to do anything us...
##### Posted By ilylily07
Mon Nov 18 2019, 09:54 AM
0v7670 camera interfacing with stc 8051.using asse...