Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

solar tracker using 8051

Status
Not open for further replies.

niranjan23

Member level 5
Joined
Jan 22, 2012
Messages
94
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
2,109
hello..

I want to do single axis solar tracker by using 8051 and with DC motor and LDR as sensor..I choose this project as my final year project...

can any one help for circuit diagram and assembly code for this

And I want three function in it

1st is solar tracking as usual (east to west)
2nd when panel move completely to west it gets back it's initial position (sun rises)

I have 10 RPM DC motor, 12V/10W solar Cell

Please help me for circuit and Assembly code .....
 

ebclr

Member level 2
Joined
Feb 27, 2013
Messages
42
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,288
Activity points
1,537
Use 2 LDR. conect both one side on the 5V and the other side on a 1K resistor to gnd.

The motor objective is to make both LDR voltages to the same level, case one os greater than other simply turn the motor and compare again.

This idea is simple and Works extremmly well, You can do without 8051 and only one opamp and a transistor, but also can be done by software on a microprocessor





I <<<< Piece off black plastic +- 10 cm long
I
I
I
I
___Ldr1___I __LDr2
 

niranjan23

Member level 5
Joined
Jan 22, 2012
Messages
94
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
2,109
thankyou ...very much ...it is very simple ...but if I want to do with 8051 ...what will be the assembly code...???
 

pratti

Member level 3
Joined
Jun 15, 2013
Messages
56
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
471
i want to use 3 ldr and is it necessary to send the signal through interrupt signal or generally through port1 we can send the signal
 

niranjan23

Member level 5
Joined
Jan 22, 2012
Messages
94
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
2,109
i want to use 3 ldr and is it necessary to send the signal through interrupt signal or generally through port1 we can send the signal

It is more easy with Ports... any ports..!! and program also easy.......dont go to interrupts

make one transistor circuit as show you previously and connect with port 1 pins....and make port programming...
 

pratti

Member level 3
Joined
Jun 15, 2013
Messages
56
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
471
my code goes like this bt i want ur help in this code and i need to complete it within 2 dys


while(0<count<=60|0<count1<=15)) //while tracking the sun to determine the position of stepper motor or moving fast to search the light
{
stepper_motor=1
}
while(60<count<=120|15<count1<=45)
{
stepper_motor=2
]
while(120<count<=180|45<count1<=60)
{
stepper_motor=3
}



while(p3=1) //when port 3 gets any signal ie when it get ldr get light
{

if(ldr1==1&&ldr2==0&&ldr3==0) //when signal came from 1st ldr
{
if (stepper_motor==1) //when motor is in the east postion
{
clockwise(); //rotate clockwise in a full 180
}
else if(stepper_motor==2) //when motor is in the middle position and ldr1 gets light
{
clockwise2(); //rotate clockwie from middle so only half rotation is required
}
else
{
clockwise3(); //rotate clockwise from west for little time only
T0delay(); //wait in west for sometime
anticlockwise();//move back to east fo the next day
T0delay(); //wait their for some time
rest(); //rest
}

if(ldr1==0&&ldr2==1&&ldr3==0) //when light falls on 2nd ldr
{

if(stepper_motor==1)
{
clock();
}
elseif(stepper_motor==2)
{
clock1();
}
else
{
clock2();
T0delay();
anticlockwise();
T0delay();
rest();
}
if(ldr1==0&&ldr2==0&&ldr3==1) //when light falls on 3rd ldr
{

if(stepper_motor==1);
{
clock();
}

else if(stepper_motor=2)
{
clock1();
}

else
{
clock2();
T0delay();
anticlockwise();
T0delay();
rest();

}
while(ldr1==0&&ldr2==0&&ldr3==1)
{

if(stepper_motor=1);
{
clock();
}

else if(stepper_motor=2)
{
clock1();
}

else
{
clock2();
T0delay();
anticlockwise();
T0delay();
rest();
}
if(ldr1==1&&ldr2==1&&ldr3==0)//both ldr receives light
{

if(stepper_motor==1)
{
clock();
}
elseif(stepper_motor==2)
{
clock1();
}
else
{
clock2();
T0delay();
anticlockwise();
T0delay();
rest();
}


}
if(ldr==1&&ldr2==0&&ldr3==1)
{
if(stepper_motor==1)
{
clock();
}
elseif(stepper_motor==2)
{
clock1();
}
else
{
clock2();
T0delay();
anticlockwise();
T0delay();
rest();
}
if(ldr1==0&&ldr2==1&&ldr3==1)
{
if(stepper_motor==1)
{
clock();
}
elseif(stepper_motor==2)
{
clock1();
}
else
{
clock2();
T0delay();
anticlockwise();
delay();
rest();
}

if(ldr1==1&&ldr2==1&&ldr3==1)

{
if(stepper_motor==1)
{
clock();
}
elseif(stepper_motor==2)
{
clock1();
}
else
{
clock2();
T0delay();
anticlockwise();
T0delay();
rest();
}
}

} //WHILE1
}//MAIN






while(p3=0)//for no light search for the light by rotating left and right
{
if(ldr1==0&&ldr2==0&&ldr3==0)
{
for(i=1;i<4;i++) //for four times rotation continues
{
if(stepper_motor=1) //when stepper motor is in east position and no light falls

{
clockfast(); //rotate clockwise
}
elseif
{
stepper_motor=2
{
clockfast1(); //rotate half clockwise
}
else
{
stepper_motor=3
{
clockfast2(); //rotate little clockwise
}
T0delay1(); //wait for smtine in west position
anticlock(); //rotate anticlockwise
clockfast(); //rotate clockwise
T0delay1(); //wait fir smtime
rest(); //rest position
}
clock() //function for clockwise rotation
{
P2=0X11;
T0delay(56);
P2=0X22;
T0delay(56);
P2=0X44;
T0delay(56);
P2=0X88;
T0delay(56);
}

anticlock() //function for clockwise
{
P2=0X88;
T0delay(75);
P2=0X44;
T0delay(75);
P2=0x22;
T0delay(75);
P2=0X11;
T0delay(75);
}
}
clock1(); //function for halg clockwise
{
for(count=1;count<=90;count++)
p2=0x11;
T0delay(56);
p2=0x22;
T0delay(56);
p2=0x44;
T0delay(56);
p2=0x88;
T0delay(56);
}
clock2(); //function for little clockwise
{
for(count=1;count<=45;count++)
p2=0x11;
T0delay(56);
p2=0x22;
T0delay(56);
p2=0x44;
T0delay(56);
p2=0x88;
T0delay(56);
}
rest() //at rest position
{
p2=0x00;
T0delay(56);
p2=0x00;
T0delay(56);
p2=0x00;
T0delay(56);
p2=0x00;
T0delay(56);
}

clockfast() //function for clockwise rotation
{
P2=0X11;
T0delay1(56);
P2=0X22;
T0delay1(56);
P2=0X44;
T0delay1(56);
P2=0X88;
T0delay1(56);
}
clockfast1(); //function for halg clockwise
{
for(count=1;count1<=45;count++)
p2=0x11;
T0delay1(56);
p2=0x22;
T0delay1(56);
p2=0x44;
T0delay1(56);
p2=0x88;
T0delay1(56);
}
clockfast2(); //function for little clockwise
{
for(count=1;count1<=15;count++)
p2=0x11;
T0delay1(56);
p2=0x22;
T0delay1(56);
p2=0x44;
T0delay1(56);
p2=0x88;
T0delay1(56);
}





//delay(unsigned int time) //delay function
//{
//unsigned int i,j;
//for(i=0;i<time;i++)
//for(j=0;j<1275;j++)
//}




void T0Delay() //delay by using timer
{

TMOD=0×01; // timer 0, mode 1

TL0=0×00; // load TL0

TH0=0×35; // load TH0

TR0=1; // turn on Timer0

while (TF0==0); // wait for TF0 to roll over

TR0=0; // turn off timer

TF0=0; // clear TF0

}




void T0Delay1() //delay by using timer
{

TMOD=0×01; // timer 0, mode 1

TL0=0×00; // load TL0

TH0=0×35; // load TH0

TR0=1; // turn on Timer0

while (TF0==0); // wait for TF0 to roll over

TR0=0; // turn off timer

TF0=0; // clear TF0

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top