Automatic Tram Layout

Some years ago I built a small model tramway based on Keith Cameron's tram in the October 1979 MM. The tram ran on two rails of joined 241/2" angle girders and had an overhead pickup wire. There were limit switches at each end and at a centre station. The end two operated a solenoid which in turn operated a reversing switch and also a 555 timer circuit to give a waiting delay. The 555 timer also gave a delay at the centre station. The model worked quite well and reliably over a two day exhibition period.

I have now recreated this model using the Motorvator.
I have retained the overhead pickup wire, the other feed being through the rails. The length of track has been kept at 48" for practical reasons.
Open in new window

The tram is powered by a 107rpm geared motor which gives a good scale speed with a direct drive via a 3/4" contrate and 1/2" pinion to the axle.

Open in new windowOpen in new window

The program uses the randomise command together with mod 2 to produce a 0 or 1 to determine whether it will stop at a central station. A notice board operated by a servo displays "STOPPING" or NON-STOP" as appropriate.

Open in new windowOpen in new window

Two limit switches are used one at either end of the run. The tram speeds up and slows very realistically. I did not use a revolution counter as this would have been extremely difficult in the tram itself which is where the motor is located. All actions of speeding or slowing and stopping at the centre station are achieved using the WAIT command. This works very well indeed and the tram trundles up and down for hours, sometimes stopping at the centre station, slowing down very realistically as it reaches the end of its run. The notice board, although a little bulky , also works well flipping over realistically to indicate the type of journey. Extensions to the model would be easy, adding features such as a signal or lights at the centre station and a beep or bell as the tram is about to depart.
All in all it makes a simple but good illustration of the use of the Motorvator.

There are three disadvantages to the model as constructed.
1 The wait parameter used in the various function calls to determine slow down and stopping at the centre halt etc. are dependent on the motor used and other factors such as friction in the drive, voltage etc, ( as I found when I applied a little oil to the bearings!). However it did not take many minutes to adjust this for my model as the program is structured to allow this to be done easily.

2. There is always a danger that the motor terminals could be shorted accidentally or mischievously by joining the rail to the overhead wire using Meccano rod, long screwdriver etc. while the motor is running so damaging the Motorvator. I have separated supply and return as far as possible and introduced a small 0.3 Amp circuit breaker into the motor circuit. I have also put a 1 Amp circuit breaker into the power supply to the motorvator. (these small circuit breakers are available in values up to 3 Amp and measure about 1/2" by 3/4" by 1/8" ) .

3. don't forget to provide an insulated buffer on the tram for each of the end stops, because the tram body is live. I suggest an Elektrikit part 564 although any small wooden or plastic buffer with a well countersunk hole would do.

Here is the code for the MotorVator


Begin Program
Declare Byte buffer1=0
Declare Byte buffer2=0
Declare Word waiting=300
Declare Byte speed=10
SetMotor 1
,"F",30
Declare Byte count=0
Declare Byte random=0
SetServo 1
"F",0
SetServo 1
"B",;I found this small adjustment was required on my model 
Loop

first generate a random number
random
=Randomize()
;
now apply mod 2 to yield 0 or 1 i.ete remainder after dividing by 2
random
=random Mod 2
DisplayNumber random

;read the limit switches at either end of the tramway until one of them is closed
buffer1
=ReadOnOff(1)
buffer2=ReadOnOff(2)
    ;
now choose the appropriate end buffer 1 terminusbuffer2=destination
    
If buffer1=1 Then
        
;now select type of journey depending on random number selection
        Select 
Case random
        
Case 0
            SetServo 1 
,"B",5
            Call Out
(420)
        Case 
1
            SetServo 1 
,"F",90
            Call stoppingout1
()
        
End Select
    End 
If
    If 
buffer2=1 Then
        Select 
Case random
        
Case 0
            SetServo 1 
,"B",5
            Call Back
(450)
        Case 
1
            SetServo 1 
,"F",90
            Call stoppingback1
()
        
End Select
    End 
If
End Loop

End Program

Declare Function Out(timing As Word) ;timing depends on the model and direction of travel
                        
voltagemotor speed etc. and is determined by trial    
                        
this should only take a few minutes
    SetMotor 1
,"B",20
    Wait 10
    SetMotor 1
,"B",0
    
;The following routine accelerates the tram after waiting at the station
    Wait waiting
    
    
Do
        
SetMotor 1,"B",speed
        Wait 20
        speed
=speed+10
    Until speed
=110
    
;the tram is now at full speed 100 And continues for a period timing
    Wait timing
    
;the following routine slows the tram at the end of its journey
    
Do
        
SetMotor 1,"B",speed
        
If speed 20 Then
            Wait 20
        
Else
            
Wait 50
        End 
If
        
speed=speed-10
    Until speed
=0

End 

Function

Declare Function 

Back(timing As Word)
    
SetMotor 1,"F",20
    Wait 10
    SetMotor 1
,"F",0
    Wait waiting
    
Do
     
SetMotor 1,"F",speed
     Wait 20
     speed
=speed+10
    Until speed
=100
    Wait timing
    
Do
     
SetMotor 1,"F",speed
        
If speed 20 Then
            Wait 20
        
Else
            
Wait 50
        End 
If
     
speed=speed-10
    Until speed
=0

End 

Function

Declare Function 

stoppingout1()
    
Call out(25)
    
Call out(10)
End Function
Declare Function 
stoppingback1()
    
Call back(60)
    
Call back(25)
End Function