7/30/98
Automated Model Railroad
EGR 450 Design Project
by Brent Olthof
 
 
 
    As the technology of automated controls advance, so does the complexity of model railroading.  The layout, which began as an electrically controlled train system with manually thrown switches, has been converted in this project to an automated switching and control system. The lighted display panels, train sensors, and preprogrammed train paths have become today's standards for a "state of  the art" model railroad.

    To keep up with today's technology I have designed a control system which can be switched by an operator manually or automatically by three different programmed track modes.  These programmed modes work by dark activated sensors in the track which the train activates by crossing.  Dual stamp 2 chips are used for controlling the modes of this project.  These small and versatile chips can be networked or added to infinitely accommodate any desired train layout.
 

    The programs used for this layout include three different modes; forward, match, and reverse.  All three modes use the matching mode as their base.  The matching mode matches the state of the feeding track making the train derail proof.  The sensor before the switch signals the switch to the correct path.  The track will then switch to the lane from which the train is coming so that it will not derail.

    The forward and reverse modes build on the match mode by also switching the track at every Y-track.  The sensor before the Y tells the track to switch states alternating the train's path.  The forward mode is designed for counterclockwise train movement whereas the reverse mode is programmed for a clockwise moving train.  These modes’ alternating of track paths make them ideal for multi-train layouts.

    The input circuitry incorporates both a switch and sensor into a single input for the stamp 2 chip (schematic shown below left).  An LED from this input is mounted on the control panel.  This LED will illuminate when the switch is pushed or the train is in position over the sensor.  This acts as a graphical interface between the sensors and switches and the control panel.  The key component in the dark activated sensor is a photo-transistor.  There are 14 sensors throughout the track, accounting for 14 of the inputs.  Two other inputs on the stamp 2 chip are needed for the 3 mode selections.  The schematic for this relay triggering device is shown below followed with a map of the track layout sensors.
 
 
 

 
    The output circuitry uses an LED in series with a 5V 250 ohm relay.  The relay enables the 16 volts of AC power needed for the movement of the switch.  The LED is mounted inside the control panel to facilitate debugging of  the circuitry.  There are twelve outputs used for the six switches of this system.
 
 
    The "brains" behind this control system are the dual stamp 2 chips which are configured as shown below.  The controlling programs shown below checks the state of the switch when the sensor has detected a train or the operator pushes the switch.  If the switches state is incorrect the program then gives the switch a short pulse.

#1 Stamp 2 and #2 Stamp 2 Programs
 

 
    The outer control panel contains many features including: sensor state lights, switch state lights, switch push buttons, a sensor on/off switch, and a 3-mode switch.
 
 
Located near the top of the inside control panel is the input circuitry with more sensor circuits located below right.  Below and left of the sensors are the voltage regulators, responsible for feeding the sensors 9 volts DC and the stamp 2 chips 5 volts DC.  Located in the middle of the inner control panel are two stamp 2 chips.  At the bottom of the panel are the output circuits.
 
 
 
    From the control panel several wires feed out to the photo transistors (located throughout the track), motorized switches, and switches state. International NJ INC. switches were used (part #6000).  For undertable mounting part #6003 was needed.

Control Panel Wiring Diagram
 

 
 
 
 
    This model railroad control system is an excellent system due to its small size and the possibilities for expansion.  With added sensors the programming possibilities increase.  Another impressive addition to this system would be a computerized graphical interface in a language such as visual basic.  Whatever the application, this controller can be easily modified to meet its needs.
 
 
#1 Stamp 2 and #2 Stamp 2 Programs:
 
 forward var byte                    'Stamp #1
sensor_1R var byte
sensor_2 var byte
sensor_2L var byte
sensor_2R var byte
sensor_4 var byte
sensor_4L var byte
sensor_4R var byte
switch1 var byte
switch2 var byte
switch4 var byte

input 0
input 1
input 2
input 3
input 4
input 5
input 6
input 7
output 10
output 11
output 12
output 13
output 14
output 15

scan:
     button 1,1,255,255,sensor_1R,1,switch_1R
scan1:
     button 2,1,255,255,sensor_2,1,switch_2
scan2:
     button 3,1,255,255,sensor_2L,1,switch_2L
scan3:
     button 4,1,255,255,sensor_2R,1,switch_2R
scan4:
     button 5,1,255,255,sensor_4,1,switch_4
scan5:
     button 6,1,255,255,sensor_4L,1,switch_4L
scan6:
     button 7,1,255,255,sensor_4R,1,switch_4R
goto scan

switch_1R:
     IF switch1 = 2 THEN scan1                'continue if switch 1 is left
     switch1 = 2                                         'set switch 1 state
     high 11                                               'pulse switch 1R
     pause 50
     low 11
     goto scan1

switch_2:
     button 1,1,255,255,sensor_1R,1,forward_2L     'continue if sensor 1R off
     IF switch1 = 1 THEN forward_2L                  'continue if switch 1 is right
     switch1 = 1                                                    'set switch 1 state
     high 10                                                           'pulse switch 1L
     pause 50
     low 10
forward_2L:
     button 0,1,255,255,forward,0,scan2                 'continue if forward mode
     IF switch2 = 1 THEN forward_2R                'continue if switch 2 is right
     switch2 = 1                                                  'set switch 2 state
     high 12                                                        'pulse switch 2L
     pause 50
     low 12
     goto scan2
forward_2R:
     switch1 = 2                                                 'set switch 2 state
     high 13                                                       'pulse switch 2R
     pause 50
     low 13
     goto scan2

switch_2L:
     IF switch2 = 1 THEN switch_1L               'continue if switch 2 is right
     switch2 = 1                                               'set switch 2 state
     high 12                                                     'pulse switch 2L
     pause 50
     low 12
switch_1L:
     button 1,1,255,255,sensor_1R,1,scan3         'continue if sensor 1R off
     IF switch1 = 1 THEN scan3                     'continue if switch 1 is right
     switch1 = 1                                              'set switch 1 state
     high 10                                                    'pulse switch 1L
     pause 50
     low 10
     goto scan3

switch_2R:
     IF switch2 = 2 THEN scan4                     'continue if switch 2 is left
     switch2 = 2                                              'set switch 2 state
     high 13                                                    'pulse switch 2R
     pause 50
     low 13
     goto scan4

switch_4:
     button 1,1,255,255,sensor_1R,1,forward_4L     'continue if sensor 1R off
     IF switch1 = 1 THEN forward_4L                 'continue if switch 1 is right
     switch1 = 1                                                   'set switch 1 state
     high 10                                                          'pulse switch 1L
     pause 50
     low 10
forward_4L:
     button 0,1,255,255,forward,0,scan5                 'continue if forward mode
     IF switch4 = 1 THEN forward_4R                'continue if switch 4 is right
     switch4 = 1                                                  'set switch 4 state
     high 14                                                        'pulse switch 4L
     pause 50
     low 14
     goto scan5
forward_4R:
     switch4 = 2                                                  'set switch 4 state
     high 15                                                        'pulse switch 4R
     pause 50
     low 15
     goto scan5

switch_4L:
     IF switch4 = 1 THEN scan6                        'continue switch 4 is right
     switch4 = 1                                                 'set switch 4 state
     high 14                                                       'pulse switch 4L
     pause 50
     low 14
     goto scan6

switch_4R:
     IF switch4 = 2 THEN scan                         'continue switch 4 is left
     switch4 = 2                                                'set switch 4 state
     high 15                                                      'pulse switch 4R
     pause 50
     low 15
     goto scan

revers var byte                        'Stamp #2
sensor_3 var byte
sensor_3L var byte
sensor_3R var byte
sensor_5 var byte
sensor_5L var byte
sensor_6 var byte
sensor_6L var byte
switch3 var byte
switch5 var byte
switch6 var byte

input 0
input 1
input 2
input 3
input 4
input 5
input 6
input 7
output 10
output 11
output 12
output 13
output 14
output 15

scan:
     button 1,1,255,255,sensor_3,1,switch_3
scan1:
     button 2,1,255,255,sensor_3L,1,switch_3L
scan2:
     button 3,1,255,255,sensor_3R,1,switch_3R
scan3:
     button 4,1,255,255,sensor_5,1,switch_6R
scan4:
     button 5,1,255,255,sensor_5L,1,switch_5L
scan5:
     button 6,1,255,255,sensor_6,1,switch_6
scan6:
     button 7,1,255,255,sensor_6L,1,switch_6L
goto scan

switch_3:
     button 0,1,255,255,revers,0,scan1                 'continue if reverse mode
     IF switch3 = 1 THEN reverse_3R               'continue if switch 3 is right
     switch3 = 1                                                'set switch 3 state
     high 10                                                      'pulse switch 3L
     pause 50
     low 10
     goto scan1
reverse_3R:
     switch3 = 2                                               'set switch 3 state
     high 11                                                      'pulse switch 3R
     pause 50
     low 11
     goto scan1

switch_3L:
     IF switch3 = 1 THEN scan2                     'continue if switch 3 is right
     switch3 = 1                                              'set switch 3 state
     high 10                                                    'pulse switch 3L
     pause 50
     low 10
     goto scan2

switch_3R:
     IF switch3 = 2 THEN scan3                     'continue if switch 3 is left
     switch3 = 2                                              'set switch 3 state
     high 11                                                    'pulse switch 3R
     pause 50
     low 11
     goto scan3

switch_6R:
     IF switch6 = 2 THEN switch_5R             'continue if switch 6 is left
     switch6 = 2                                             'set switch 6 state
     high 15                                                    'pulse switch 6R
     pause 50
     low 15
switch_5R:
     button 5,1,255,255,sensor_5L,1,scan4         'continue if sensor 5L off
     IF switch5 = 2 THEN scan4                     'continue if switch 5 is left
     switch5 = 2                                              'set switch 5 state
     high 13    'pulse switch 5R
     pause 50
     low 13
     goto scan4

switch_5L:
     IF switch5 = 1 THEN scan5                 'continue if switch 5 is right
     switch5 = 1                                          'set switch 5 state
     high 12                                                'pulse switch 5L
     pause 50
     low 12
    goto scan5

switch_6:
     button 5,1,255,255,sensor_5L,1,reverse_6L     'continue if sensor 5L off
     IF switch5 = 2 THEN reverse_6L                 'continue if switch 5 is left
     switch5 = 2                                                   'set switch 5 state
     high 12                                                         'pulse switch 5R
     pause 50
     low 12
reverse_6L:
     button 0,1,255,255,revers,0,scan6                    'continue if reverse mode
     IF switch6 = 1 THEN reverse_6R                 'continue if switch 6 is right
     switch6 = 1                                                   'set switch 6 state
     high 14                                                         'pulse switch 6L
     pause 50
     low 14
     goto scan6
reverse_6R:
     switch6 = 2                                                   'set switch 6 state
     high 15                                                         'pulse switch 6R
     pause 50
     low 15
     goto scan6

switch_6L:
     IF switch6 = 1 THEN scan                         'continue switch 6 is right
     switch6 = 1                                                'set switch 6 state
     high 14                                                      'pulse switch 6L
     pause 50
     low 14
     goto scan
 
 Return to Report

 Control Panel Wiring Diagram:

 

 Return to Report