go to main index know about us who we are and what we are provide ? we provide training on how to reach us send e-mail us








We know that the railway network of India is the biggest in south Asia and perhaps the most complicated in all over the world. There are so many different types of trains local, fast, super fast, passenger, goods.... etc. and their so many multiple routs. Although the time table is perfect it is not at all possible to maintain it. And thatís why the train accidents are becoming more and more usual. So why not we add a kind of intelligence to the train engines itself so that it tries to avoid accidents.

            The idea is whenever any engine observes a red signal on its track it will start decreasing its speed gradually and stops automatically at some distance from the signal pole. After then when it gets green signal the driver can manually start the train and go on. In the mean time when train has not stopped yet and a red signal becomes green then it crosses the signal pole with low speed and then driver can slowly increase the speed.

             So now before the driver observes the red signal the engine itself observes it and automatically starts decreasing speed and then stops. The driver can feel relax in driving because he doesnít have to take care about red signal. Even if he forgets to take any action on red signal then also we can avoid accidents by the implementation of this idea.

General description:

         What we have to do is we have to attach a transmitter with signal pole which will start transmitting signals only when the red light is on. If there is green light no transmission. The engine has a receiver which catches these transmitted signals and takes desire actions.       

           Both the transmitter and receiver are of RF type with minimum range of 2 Km. so that train can get enough time to decrease its speed and stop before the signal pole with minimum swapping distance of 100-200 mt.

            Here in our project we have used IR transmitter and receiver instead of RF for demo purpose. But same idea can be easily implemented with RF also with a little more cost.

             Lets first discuss the demonstration model.

Demonstration Model:

          The train engine runs on 24V DC motor so that we can easily vary its speed by varying applied voltage. The switching voltage is applied in step of 18 V, 15 V, 12 V and 9 V (min speed). The 230 VAC is step-down to 24 VAC by 12-0-12, 2 Ampere step down transformer. As shown in figure this 24 VAC line runs parallel with track at the top of the train. Movable tapping are taken from this line and fed to the internal circuit of engine. These tapping slides as the train runs on the track and give continuous supply to circuit. The IR sensor is placed at the top of the engine, senses the signals transmitted by IR transmitter attached to signal pole. Train track is straight and 20 ft long. Signal pole is placed at the end of track and train starts from farther end.





  • TSOP will detect the 38 KHz IR beam and gives the interrupt to 89C51.
  • 89C51 will indicate the interrupt event on first (green) LED and energizes only one particular relay through ULN chip.
  • When any of the four relay get energized the motor will get supply from it and it will start running
  • As voltage is less it will run with less speed
  • So now its the function of microcontroller to receive signal from IR sensor, decrease the speed of train gradually in four steps and then stop it. And this is done by software embedded in to 89C51.

 How the project works?

  • Initially when you switch on the supply 89C51 will switch all the relays RL1- RL4 one by one. So motor will get 9-12-15-18 V supply in steps and gradually increases its speed reaches max speed indicated by first red LED (P0.0).
  • Now if the signal is green then train will cross the pole with same pole
  • But if signal becomes red in between then IR sensor will detect IR beam and interrupts the 89C51
  • Getting first interrupt 89C51 will switch off RL4 and switch on RL3 so now motor will get 15 V supply and its speed will be decreased. Thatís indicated by second red LED (P0.1)
  • Now 89C51 will wait for some time (2 to 3 sec) and train goes on with same speed. Again if still red signal is on 89C51 will be interrupted and this time it will switch on RL2. so now motor gets 12V supply and again its speed will be decreased indicated by third red LED (P0.2)
  •  The same procedure repeats if 89C51 is interrupted third times. Now motor runs at min speed (9 V) indicated by fourth red LED (P0.3)
  • After same delay on receiving fourth interrupt all the relays will be switched off and motor is now stop so the train is also stopped. This is indicated by green LED.

After this interrupts will be disabled. So now when red signal becomes green driver must reset the controller to start the train again.





 The complete pseudo code with necessary comments is as given

 org 00h

       mov r0,#01h                      ; initialize the counter to count no. of interrupts

       sjmp over                          ; jump above the interrupt subroutine

 org 0013h                              ; interrupt 1 subroutine location

       mov ie,#00h                      ; disable interrupt first

       clr p0.0                              ; interrupt indication on green led

       inc r0                                 ; increment counter

       acall delay                         ; call 0.1 sec delay

       setb p0.0                            ; reset green led

       cjne r0,#02h,nxt2              ;if counter is 2 then decrease speed be one step (15 V)

       mov p0,#0fbh

       mov p1,#04h                     ; give indication on second red led

       sjmp out

nxt2: cjne r0,#03h,nxt3           ; if counter is 3 then decrease speed be two step (12 V)

       mov p0,#0f7h

       mov p1,#02h                     ; give indication on third red led

       sjmp out

nxt3: cjne r0,#04h,nxt4          ; if counter is 4 then decrease speed be three step (9 V)

       mov p0,#0efh

       mov p1,#01h                     ; give indication on fourth red led

       sjmp out

nxt4: cjne r0,#05h,out             ; if counter is 5 then stop the train  

       mov p0,#0feh

       mov p1,#00h                     ; indicate it by green led.

 out:   acall dely                       ; call 2 sec delay every time when speed is changed

       mov ie,#84h                      ; enable interrupt again

       reti                                   ; return from interrupt

 over:mov p1,#01h                  ; main program starts from here starts train with min speed

       acall dely                           ; and gradually increase it to max in four step

       mov p1,#02h                     ; with 2 sec delay in between

       acall dely

       mov p1,#04h

       acall dely

       mov p1,#08h

       mov p0,#0fdh

       mov ie,#84h                      ; enable the interrupt

here: sjmp here                        ; continue loop


       mov r6,#64h                       ; 0.1 sec delay

  lop2:mov r5,#0FAh



       djnz r5,lop1

       djnz r6,lop2



       mov r7,#15h                         ; 2 sec delay

  lop5:mov r6,#64h

  lop4:mov r5,#0FAh



       djnz r5,lop3

       djnz r6,lop4

       djnz r7,lop5




















Diodes in4001,




IC 7805



Optocoupler PC817







Tr 558



Motors 12v



IC base 20 pin



Crystal 12 Mhz



Resiatncec 10k






Cap 10Ķf



Connecting wires



Ir sensors





Keil compiler or UMPS for programming

Window xp





exists which allows us to communicate with the vast 3 control lines as well as either 4 or 8 I/O lines for the data bus. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus. If a 4-bit data bus is used, the LCD The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus. If a 4-bit data bus is used, the LCD will require a total of 7 data lines (3 control lines plus the 4 lines for the data bus). If an 8-bit data bus is used, the LCD will require a total of 11 data lines (3 control lines plus the 8 lines for the data bus).

The three control lines are referred to as EN, RS, and RW.

 will require a total of 7 data lines (3 control lines plus the 4 lines for the data bus). If an 8-bit data bus is used, the LCD will require a total of 11 data lines (3 control lines plus the 8 lines for the data bus).

The three control lines are referred to as EN, RS, and RW.

The EN line is called "Enable." This control line is used to tell the LCD that you are sending it data. To send data to the LCD, your program should first set this line high (1) and then set the other two control lines and/or put data on the data bus. When the other lines are completely ready, bring EN low (0) again. The 1-0 transition tells the 44780 to take the data currently found on the other control lines and on the data bus and to treat it as a command.

The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as a command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data being sent is text data which should be displayed on the screen. For example, to display the letter "T" on the screen you would set RS high.

The RW line is the "Read/Write" control line. When RW is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are write commands--so RW will almost always be low.

Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7.




For microcontroller programming and PCB designing

Innovative project solutions

SCO-54, New Grain Market

Gill road ludhiana