Continue to Site

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 tracking with 2 ldr..run a stepper motor

Status
Not open for further replies.
Hello!

help me..and mail me the code..thunaiblue24@gmail.com

Help us and publish what you already wrote, and tell us where it doesn't work.
And also your schematics.

I guess nobody wants do do your homework.

Dora.
 

how to set adc delay time...when it show in lcd proteus...it not fixed..freq is 20mhz..,fosc/64...and delay is 40us..my code
 
Last edited:

Hello!

how to set adc delay time...when it show in lcd proteus...it not fixed..freq is 20mhz..,fosc/64...and delay is 40us..my code

I don't understand at all what you are saying. You may consider to stop talking in Morse code and make full sentences
(you know: subject, verb, complement,etc..., beginning with a capital letter and ending with a period).

And while we are at it, nobody will be upset if you say hello and thank you.

Now tell us clearly what you already did and where you are stuck.

Dora.
 

#include<pic.h>
__CONFIG(0x3f72);
#ifndef _XTAL_FREQ
#define _XTAL_FREQ 20000000
#endif
#define step0 RD0
#define step1 RD1
#define step2 RD2
#define step3 RD3
void stepper(unsigned int);
void delay(unsigned int);
void main(void)
{
TRISA=0x01;
PORTA=0;
TRISD=0x00;
PORTD=0;
ADCON0=0x81;
ADCON1=0xC4;

//OPTION_REG=0x07;
//RBPU=0;
while(1)
{
unsigned char adc,adc_value_h,adc_value_l,adc_value;
__delay_us(50);
GO_DONE=1;
while(GO_DONE==1)
// __delay_us(20);
adc_value_h=ADRESH;
//adc=adc_value_h<<8;
adc_value_l=ADRESL;
adc_value=adc_value_h<<8|adc_value_l;
// adc_value=(int)(adc_value*204.8);
// led(adc_value);
stepper(adc_value);
}
}
void delay(unsigned int t)
{
while(t>0)
{
int i;
for(i=0;i<165;i++)
{t--;}
}
}
void stepper(unsigned int adc_val)
{


switch(adc_val)
{
unsigned int i;
case 1:
if(adc_val<100)
step0=0;step1=1;step2=1;step3=1;delay(1000);

case 2:
if(adc_val<=200)
step0=1;step1=0;step2=1;step3=1;delay(1000);
case 3:
if(adc_val<=300)
step0=1;step1=1;step2=0;step3=1;delay(1000);
case 4:
if(adc_val<=400)
step0=1;step1=1;step2=1;step3=0;delay(1000);

}

} this my code for drive stepper motor using ldr.How this code chage to if 4 LDR is using... is By window comparator method..or tell me the method..


And same code is used as sperate program adc value shown lcd..value not fixed while vary POT
 

How come u r using 2 LDR when u assigned TRISA=0x01;
If u want to us 2 LDR assign TRISA=0x03;
Why u need 2 LDRs for solar tracking? 1 LDR is enough.

Where u r fixing LDR? on the movable part or it'll fixed separately (LDR will not move)?
Based on that u need to modify ur stepper motor code.
 

How come u r using 2 LDR when u assigned TRISA=0x01;
If u want to us 2 LDR assign TRISA=0x03;
Why u need 2 LDRs for solar tracking? 1 LDR is enough.

Where u r fixing LDR? on the movable part or it'll fixed separately (LDR will not move)?
Based on that u need to modify ur stepper motor code.

Is ur right..i check for first single LDR..next Dual..for dual direction and
Not yet finished mechanical part..How could u rotate a dual axis with single LDR..where could i fix LDR movable part is better..if using 2 adc channel how could change and check 2 adc channel value....
 
Last edited:

Sun will move in one direction only. :p
so if u read the LDR whether light falling on it or not. if it is falling then panel is in right direction. otherwise u need to move it little bit or untill the LDR detects full light.

place the LDR on the movable part along with the solar panel.

put small pipe (2 to 3 inch) on the LDR. so that if the sun is straight to the LDR then the light will fall on it othewise it'll become block. :)

u need two limitswitches to detect the most and least ends.

prog flow:

read the LDR

if it is lighted do nothing

if it is dark // if the LDR is dark - reason 1. Panel not in right position & reason 2. sunset (means night)
read end limitswitch (LSW)
if end LSW is not hited move untill LDR get light
if end LSW hited move reverse untill the start LSW hit. (move to morning position)
 

Sun will move in one direction only. :p
so if u read the LDR whether light falling on it or not. if it is falling then panel is in right direction. otherwise u need to move it little bit or untill the LDR detects full light.

place the LDR on the movable part along with the solar panel.

put small pipe (2 to 3 inch) on the LDR. so that if the sun is straight to the LDR then the light will fall on it othewise it'll become block. :)

u need two limitswitches to detect the most and least ends.

prog flow:

read the LDR

if it is lighted do nothing

if it is dark // if the LDR is dark - reason 1. Panel not in right position & reason 2. sunset (means night)
read end limitswitch (LSW)
if end LSW is not hited move untill LDR get light
if end LSW hited move reverse untill the start LSW hit. (move to morning position)
thanks for ur reply
So,my code have a few changes....
could u able give schematic with limit switches
 

sorry, u can expect delay for my next post as the week end came :lol:
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top