Spread the love

images



In This Project

  • We try to make prototype of Metro Trains.
  • We use 8051 as CPU.
  • The motion of Train is controlled by a DC Motor.
  • The motion of opening and closing of door is controlled by Stepper Motor.
  • LCD Display of 2*16 characters is used for displaying messages in the train.
  • The stoppage time at a station is taken to be 3 seconds.
  • The time taken by train between two consecutive stations is taken as 6 seconds.

Working Of Metro Train Prototype With 8051 Project:

When the power is turned on a message (“welcome “) is displayed on LCD. Then a message “Current station is New Delhi” is displayed and door is opened. After some delay the door is closed and car is started to move forward. A message “current station is New Delhi” is displayed also on LCD. After some time a message indicating the next station is displayed “next station is NOIDA SECT 15”. After some time the train stops and a message “current station is NOIDA SECT 15” is displayed. This process is continued for five stations. In the end a message “End of line” is displayed on LCD. This whole process is repeated until we turned off the power supply.

Basic Components

  • Power Supply
  • AT89C51 IC
  • LCD (16×2)
  • ULN2003
  • L293D
  • Stepper Motor
  • DC Motor

Why we use ULN2003 and L293D ?

  1.  ULN2003 is used to drive the Stepper Motor and L293D is used to drive the DC Motors.
  2. Stepper and DC motors work on 12v and controller work on 5v ,so ULN2003 and L293D convert level from 5v to 12v.
  3. ULN2003 and L293D also protect micro controller pin  from back emf of motors.

1. Circuit Diagram of Metro Train Prototype with 8051

metro train prototype with 8051

1. Program of Metro Train Prototype with 8051

/******************************************************
www.firmcodes.com
DEVELOPED BY:- FIRMWARE DEVELOPER
WHAT PROGRAM DO:- Program of Metro Train Prototype on lcd
******************************************************/

#include<reg51.h>
#include"delay.h"
#include"motor.h"
#include"lcd.h"
 
void main()
{
	lcd_ini();            // initilize lcd
	lcd_str(" WELCOME");  // display "WELCOME" on lcd
	delay_fv(500,500);    // halt for some time
	while(1)
	{
		cmd(0x01);   // clear lcd
     	lcd_str(" CURRENT STATION:");  // display "CURRENT STATION" on lcd
     	cmd(0xc0);                     // next line command for lcd
		lcd_str(" NEW DELHI");  // display "NEW DELHI" on lcd
		delay_fv(500,500);      // hault for some time
     	stepper_motor();        // opening and closing of door 
     	delay_fv(300,1000);     // hault for some time
		
		
		cmd(0x01);              // clear lcd
     	lcd_str(" NEXT STATION:");  // display "NEXT STATION" on lcd
     	cmd(0xc0);                  // next line command for lcd
		lcd_str(" NOIDA SECT.15");  // display "NOIDA SECT.15" on lcd
		delay_fv(500,500);          // hault for some time
     	gear_motor(1,1);            // move metro train forward 
		cmd(0x01);                  // clear lcd
     	lcd_str(" CURRENT STATION:");  // display "CURRENT STATION" on lcd
     	cmd(0xc0);                  // next line command for lcd
		lcd_str(" NOIDA SECT.15");  // display "NOIDA SECT.15" on lcd
		gear_motor(1,0);            // stop metro train  
     	delay_fv(500,500);	         // hault for some time
		stepper_motor();            // open and close the door of metro train
		delay_fv(500,500);          // hault for some time
		 
		 
		cmd(0x01);                // clear lcd
     	lcd_str(" NEXT STATION:"); // display "NEXT STATION" on lcd
     	cmd(0xc0);                 // next line command for lcd
		lcd_str(" FARIDABAD");     // display "FARIDABAD" on lcd
		delay_fv(500,500);         // hault for some time
     	gear_motor(1,1);           // move metro train forward
		cmd(0x01);                 // clear lcd
     	lcd_str(" CURRENT STATION:"); // display "CURRENT STATION" on lcd
     	cmd(0xc0);                 // next line command for lcd
		lcd_str(" FARIDABAD");     // display "FARIDABAD" on lcd
		gear_motor(1,0);           // stop metro train 
     	delay_fv(500,500);	        // hault for some time
		stepper_motor();           // open and close the door of metro train
		delay_fv(500,500);         // hault for some time
		
		
		cmd(0x01);
     	lcd_str(" NEXT STATION:");
     	cmd(0xc0);
		lcd_str(" NEW TOWN");
		delay_fv(500,500);
     	gear_motor(1,1);
		cmd(0x01);
     	lcd_str(" CURRENT STATION:");
     	cmd(0xc0);
		lcd_str(" NEW TOWN");
		gear_motor(1,0);
     	delay_fv(500,500);	
		stepper_motor();
		delay_fv(500,500);
		cmd(0x01);
		lcd_str(" END OF LINE");
		delay_fv(500,500);
		 
		}
}

lcd.h

sbit rs=P1^0;
sbit rw=P1^1;
sbit en=P1^2;
sfr lcd=0x80;
void lcd_display(unsigned int x)  // lcd display fuction
{
	unsigned int i;
	lcd=x;
	rs=1;
	rw=0;
	en=1;
	for(i=0;i<100;i++);
	en=0;
}

void cmd(unsigned char m)  // lcd command fuction
{
	unsigned int i;
	lcd=m;
	rs=0;
	rw=0;
	en=1;
	for(i=0;i<10;i++);
	en=0;
}

void lcd_ini()   // lcd initilize 
{
	cmd(0x38);
	cmd(0x0e);
	cmd(0x01);
	cmd(0x06);
	cmd(0x90);
}	
void lcd_str(unsigned char *str)   // display string on lcd
{
	while(*str!='\0')   
	{
	  lcd_display(*str);
	  str++;
	}
}


motor.h

sbit a1=P2^0;
sbit a2=P2^1;
sbit a3=P2^2;
sbit a4=P2^3;
sbit m11=P2^4;
sbit m12=P2^5;
sbit m21=P2^6;
sbit m22=P2^7;
void stepper_motor()
{ 
	 unsigned int i;
	
	 for(i=0;i<5;i++)   // forward direction
	 {
	     a2=a3=a4=0;
		 a1=1;
	     delay_ff();
	     a1=a3=a4=0;
	     a2=1;
	     delay_ff();
	     a1=a2=a4=0;
	     a3=1;
	     delay_ff();
	     a1=a2=a3=0;
	     a4=1;
	     delay_ff();
   }
   
   delay_fv(1000,100);
   for(i=0;i<5;i++)  // reverse direction
	 {
	     a2=a3=a1=0;
		 a4=1;
	     delay_ff();
	     a1=a2=a4=0;
	     a3=1;
	     delay_ff();
	     a1=a3=a4=0;
	     a2=1;
	     delay_ff();
	     a4=a2=a3=0;
	     a1=1;
	     delay_ff();
   }
}

void gear_motor( int p,int q)
{
	     if(p==1 && q==1)   // forward motion of train
	     {
	       m11=1;
	       m12=0;
	       m21=1;
	       m22=0;
		   delay_fv(500,1000);
         }
		else if(p=0 && q==1) // train stop
		{
		   m11=0;
	       m12=0;
	       m21=0;
	       m22=0;
           delay_fv(100,1000);				 
        }
		else if(p=1 && q==0)  // train stop
	     {
		   m11=0;
	       m12=0;
	       m21=0;
	       m22=0;
		   delay_fv(100,1000);
         }
	     else if(p==0 && q==0)  // backward motion of train
	     {
		      m11=0;
			  m12=1;
			  m21=0;
			  m22=1;
			  delay_fv(100,1000);
       }
   
 }

delay.h

void delay_ff()   // full fixed delay
{
    unsigned int i,j;
    for(i=0;i<110;i++)
    for(j=0;j<153;j++);
}

void delay_pf(unsigned int x)  // partially variable delay
{
	unsigned int i,j;
	for(i=0;i<x;i++)
	for(j=0;j<153;j++);
}

void delay_fv(unsigned int x,y)  // fully variable delay
{
	 unsigned int i,j;
	for(i=0;i<x;i++)
	for(j=0;j<y;j++);
}

PROTEUS File for SIMULATION(Password Of RAR file is :-firmcodes.com)

download (1)

Comming Soon…

how to write a 4 page paper