- This topic has 3 replies, 2 voices, and was last updated 11 years, 7 months ago by
rasu shrestha.
-
AuthorPosts
-
August 10, 2013 at 8:49 pm #2587
rasu shrestha
Participanti am trying to drive stepper motor through l293d, the program runs and the stepper motor takes a few step but the l293d gets very heated up very soon. what could be the solution? can we get a heat sink for the l293d as well??? plz help!
August 12, 2013 at 5:06 am #10315AJISH ALFRED
ParticipantHi Rasu,
The problem is there in your code.
In your code, increase the off time delay. If you don’t get it, don’t worry please post your code here.
August 12, 2013 at 5:06 am #10316AJISH ALFRED
ParticipantHi Rasu,
The problem is there in your code.
In your code, increase the off time delay. If you don’t get it, don’t worry please post your code here.
August 17, 2013 at 5:42 pm #10331rasu shrestha
Participantwe used l298 instead of the l293d and so the over heating problem is now solved and the motor is running fine but it often gives problem still. its not running as according to our project specifications. we are trying to make a solar tracker, and we are using three LDRs as teh sensors. as soon as any one of the sensor gets light the solar panel should be directed to that direction. here’s my code! it would be very helpful if my mistakes are pointed out! thank you#include<reg51.h>
#include<stdio.h> //port2 for load(stepper motor)::port1 for ldrs(sensors)el#define high 1;#define low 0;sbit ldr1=P1^0; //initializing the bit of port 3sbit ldr2=P1^1;sbit ldr3=P1^2;int position; //global variable to detect the position of the stepper motorvoid T0delay();//time delay while trackingvoid T0delay1(void);//time delay while moving fast to the required positionvoid clockd();//for tracking the position of the lightvoid clock(); //for clockwise from position1 to 2 or 2 to 3only while detecting the positionvoid clock1(); //for clockwise from position 1to 3void anticlock1();//from position 2 to 1void anticlock3();//for position 3 to 2int check(); //to check the position of the stepper to return the position of steppervoid main(void){unsigned int stepper_motor;P3=0xFF; //initialize as inputposition=0x00; //position=0 in firstP2=0x00;while(1){if(ldr1==1 & ldr2==0 & ldr3==0) //when ldr1 gets light{stepper_motor=check(); //to check the position of stepper motor in which step it is in and the value is returned from the functionif(stepper_motor==1) ///if position 1 then move complete rotation{T0delay();//just time delay}else if(stepper_motor==2){anticlock1(); //move to the position 1T0delay1();}else{anticlock1(); //if position 3 then moce anticlock and move complete rotationT0delay1();}while(ldr1==1){//while ldr1 gets light only whole rotation should continueclockd(); //start tracking one step function called and this is continued until ldr1 gets lightposition++;//each movement position is increasesif(position==24) //if the complete rotation complete den only move anticlockwise rotation{anticlock1();//return back to original position}}}else if(ldr1==0&ldr2==1&ldr3==0){stepper_motor=check();if(stepper_motor==1){clock(); //move fast to the position 2 then start trackingT0delay1();}else if(stepper_motor==2){T0delay1();}else{anticlock3(); //to go back to the 2nd positionT0delay1();}while(ldr2==1){//continue to rotate when ldr2=1clockd();position++;if(position==24){anticlock1();}}}else if(ldr1==0&ldr2==0&ldr3==1) //when light falls on 3rd ldr{stepper_motor=check();if(stepper_motor==1){clock1(); //move fast to the position 3 then start trackingT0delay1();}else if(stepper_motor==2){clock(); //move fast to the pisition 3 then start trackingT0delay1();}else{T0delay1();}while(ldr3==1){clockd();position++;if(position==24){anticlock1();}}}else if(ldr1==1&ldr2==1&ldr3==0)//both ldr receives{stepper_motor=check();if((stepper_motor==1)&&(stepper_motor==2)) //while steppermotor is in position 1 ana 2{T0delay1();}else{anticlock1();//go back to position 1T0delay1();}while(ldr1==1&ldr2==1){ //tracking continues until light is on the ldr 1 and 2clockd();position++;if(position==24){anticlock1();}}}else if(ldr1==1&ldr2==0&ldr3==1){stepper_motor=check();if((stepper_motor==1)&&(stepper_motor=))
{T0delay1();}if(stepper_motor==2){anticlock1();T0delay1();}while(ldr1==1&ldr3==1){clockd();position++;if(position==24){anticlock1();}} }else if(ldr1==0&ldr2==1&ldr3==1){stepper_motor=check();if((stepper_motor==2)&&(stepper_motor=))
{T0delay1();}else if(stepper_motor==1){clock();T0delay1();}while(ldr2==1&ldr3==1){clockd();position++;if(position==24){anticlock1();}}}else if(ldr1==1&ldr2==1&ldr3==1){clockd();position++; //whenever it is start rotatingif(position==24){anticlock1();}}//for no light search for the light by rotating left and rightif(ldr1==0&ldr2==0&ldr3==0){;//stationar position}}//while}//mainint check(){int stepper_motor1;if(0<=position&&position<=8 )//to determine the position of motor.from step 1 to 8 it is in 1 position and from step 9 to 16 it is in 2 position and fron step 17 to 24 it is in position3{stepper_motor1=1;}if(9<=position&&position<=16){stepper_motor1=2;}if(17<=position&&position<=24){stepper_motor1=3;}return stepper_motor1;}void clockd()//function for clockwise rotation from position{P2=0x01;T0delay();P2=0x04;T0delay();P2=0x02;T0delay();P2=0x08;T0delay();}void anticlock1() //function for anticlockwise from 2 to 1{unsigned int count;for( count=position;count>=0;count–){position=count;P2=0x08;T0delay1();P2=0x02;T0delay1();P2=0x04;T0delay1();P2=0x01;T0delay1();}}void anticlock3() //anticlock from 3 to 2{unsigned int count;for( count=position;count>=8;count–){position=count;P2=0x08;T0delay1();P2=0x02;T0delay1();P2=0x04;T0delay1();P2=0x01;T0delay1();}}void clock() //function for half clockwise from position 1 to 2{unsigned int count;for( count=position;count<=8;count++){position=count;P2=0x01;T0delay1();P2=0x04;T0delay1();P2=0x02;T0delay1();P2=0x08;T0delay1();}}void clock1() //function for little clockwise from position 1 to 3{unsigned int count;for( count=position;count<=16;count++){position=count;P2=0x01;T0delay1();P2=0x04;T0delay1();P2=0x02;T0delay1();P2=0x08;T0delay1();}}void T0delay1(void) //delay by using timer{TMOD=0x01; // timer 0, mode 1TL0=0xFD; // load TL0TH0=0x4B; // load TH0 for 0.050 secTR0=1; // turn on Timer0while (TF0==0); // wait for TF0 to roll overTR0=0; // turn off timerTF0=0; // clear TF0}void T0delay(void) //delay by using timer{int j;for(j=0;j<=10;j++){TMOD=0x01; // timer 0, mode 1TL0=0xFD; // load TL0TH0=0x4B; // load TH0 for 0.050 sec now for 2 sec delayTR0=1; // turn on Timer0while (TF0==0); // wait for TF0 to roll overTR0=0; // turn off timerTF0=0; // clear TF0}} -
AuthorPosts
- You must be logged in to reply to this topic.