Tapiola Parish Model Railway Club

Electrification of the previous layout

The layout was a one huge loop. The loop consisted of 5 stations:

  • one bigger with three through tracks and a three spur yard for switching
  • three smaller stations with only one passing siding and one or two industrial spurs
  • one smaller halt with one (single ended) spur only

The yards had power routing turnouts. The yards were split into two rotary sections. The rotary selector switches fed the power to station approach tracks and via turnouts to the middle of the selected siding. in order to feed the whole siding the rotary selectors of both ends of the yard had to be turned to same cab and points set to same siding. If two trains were to approach the station the other had to wait outside yard limits until the other was brought to halt and turnouts thrown and rotary switches reset.

If two trains were to depart to different directions it could be easily arranged by setting the turnouts and rotary selectors accordingly.

As the members of the club were quite young it was found that a centralized control system suits best for us. So we employed a kind of CTC-system for forwarding the trains from station to another.

The CTC-panel, in the middle top are the so called group buttons for train forwarding, top right is the speed control of fast time clock, the 13 rotary knobs are for block power (not used with computer), and isolating switches below are all down, meaning that blocks are isolated from rotary switches (and with the introduction to C/MRI the blocks are connected to relays. The red lunch box houses the C/MRI electronics!


The CTC-panel (which does not follow any prototype) consisted of rotary switches for cab selectors and push buttons for turning the points to through tracks (if points were to be set to spurs, local panels were used by the train crew). If the turnout was set to diverging route a yellow led next to the turnout was lit.

To aid train forwarding, the detectors were installed to each rotary section. The rotary switches were to be turned only if the led was off. The detectors only saw trains which were actually powered, so by throwing the points you isolated the engine and thus switch off the detector light.

Even after all this the power assignment was a tedious task. What we needed was a Computerised Cab Control System (CCC).

Computer / Model Railroad Interface

Bruce Chubb's Computer / Model Railroad Interface (C/MRI)system is good, but it may become unneccesarily expensive, and complicated to handle only a small layout like ours was. So, instead of getting that, we decided to develop our own. With Mr Koskela we developed our own concept and this is what it became. (This is a poor-man approach):

Firstly we didn't have a PC, we had an MSX instead. It's parallel port has just 8 bits for data + /STROBE. The only feedback was READY. But MSX did have two joystick ports (for digital, or switch-equipped joysticks).

The thing:

Data/address clock separation

Address and data clock [2K]

As there was only the /STROBE and 8 bits of data it was decided that the most significant bit of data represents data/address selection. Connector P3 is the parallel connector of MSX-computer. By NANDing /STROBE with 8th bit gave /DATA CK (in diagrams denoted as ">D" and by inverting the 8th bit and NANDing it with /SROBE gave the /ADDRESS CK (denoted as ">A").

Address Latch

Address latch [2K]

Address and data were sent one after another, so the address had to be latched somewhere to be on hand when routing the data. U2, ('273) was used as an address latch.

Address decoding

To save lines taken to output cards it was decided that data clock and address decoding will be made into one and resolved address would be forwarded at data clock to final data latch.

Address decoding [3K]

The address was split into lower and higer "nibble", three lines each, and decoded with 3-to-8 devices ('138). The middle bit (A3) was reserved for expansion. (It selected the U5, but '138 has inverted selector soo, so another '138 could be used as MSB address decoder and full address space be exploited). The LSB nibble was only decoded if computer was sending DATA, not ADDRESS. The MSB was decoded as it came from the address latch. With this arrangement one, and only one of the LSB address nibble expanded lines vas active (low) as data was present. By picking one of these eight lines and one of the address MSB part decoded eight lines we got a unique addresss that was active when data following this address was active at MSX computer's printer port. The dotted line in above separates the Address/data separator (main board) from the output card. By picking two lines from the MSB and two from the LSB group we could (with single NAND package) get clocks for four output latches in the output card.

Address data sep, address latch, input driver [XK]

Address/Data separator, address latch, output buffer (main board)

Output card

The output of the latch was amplified with ULN400X-seven bit amplifiers (500mA/50V per channel, originally ment for seven segment displays?).

That was the output!

Output board [32K]

Output board (Latches and ULN-drivers)

Data In

The input to the computer was through the joystick ports. The data was red one bit per input port at the time. Four or eight ports could be red at the same time (depending on using one or two joystick ports. The MSX-joysticks were of switch type. The always active lower nibble of the address (taken from Address latch before the U6 3-to-8 device ('138)) selected the input card multiplexer "position" and "chip select" was by the most significant decoded line. The main board had schmitt triggers as the multiplexers in input cards were of analogue type.

The address latch operated data selectors (multiplexers) and inputs were taken through the muxes to the joystick port.

Input board [27K]

Input board (muxes)

The whole lot


The main board


The whole lot (cmri)[XK]

the whole lot. From left: Inputs, main board, outputs.


Fast response input?

I needed fast response, (for the CTC-panel). I used the joystick fire-button connection. One could trap that (with MSX-BASIC) to generate an interrupt and read the buttons of the panel, and beep. The real time loop then handled the actions later, thus the operator got the feeling of instant response, and the feel of huge CTC-system!

Computerized Signal Box (Power Box) at Helsinki club

This system was originally designed for Helsinki Club's Pihlajamaa layout's computerized power box (signal box) in 1987. I recently found the original MSX-Basic software, and converted it into PDF. Some special characters are not displayed and the end of the software appears to be missing. As the Pihlajamaa layout was sold before the computerized power box was finished I took the unfinished C/MRI setup to Tapiola to be used as Computerized Cab Control system.

Computerized Cab Control

Usually Computerized Cab Control is connected to layout with relays, that connect the desired cab to desired section. In case of three controllers usually two relays are needed per section.

At Tapiola a different approach was "invented": All cabs had their own relay banks and each of them were divided into "odd" and "even" blocks of relays.

If the loco is on "odd" section of track, no power is travelling through the "even" relays, and they can change state. As the train enters to "even" section, no power travels through the "odd" relays, and they can change state. A loco will only need two sections to be powered at one time, provided we know the direction the the loco is travelling, or if lineside signals are so set that the loco has no way of travelling to unpowered section.

An example:

As the loco was under control of cab A and was on an even block, the odd bank of cab A's relays could connect the power to the next or previous block. This way only two blocks could be connected to a same cab, but that is enough!

The layout had 13 blocks and 3 cabs and only needed 19 relays (3 cabs: 8 even and 8 odd blocks (3 relays each). The one extra relay took care of handling the power routing while going from block 13 (odd) to block 1 (odd).

NB: No saving in relay count will be gained, if the number of blocks and/or controllers/cabs is small. The pictures show a situation were the excact number of relays needed is the same, but if the system is larger, the relay count comes down nicely.

Picture of the inside of the CTC-panel, the relays are in the middle


If a train is standing in a station with power applied. The computer knows that this is to be connected to engineer A. If the points were thrown, the train becomes isolated and the detector looses the train. Now the computer switches off the power, but puts the cab code in memory if the engine becomes detectable again.

Train leaving the station

If we are to forward this train from the station, we must first set the points to that siding. The detector notices the train and computer switches power to the rotary section. If we then give the train a permission to proceed say, from section 6 to section 7, the power of cab A is applied to section 6 (as detector picked up the loco) and to section 7 if starter signal is cleared.

The CTC-panel showing a train about to depart from siding (Yellow LED next to turnout detotes that it's thown, red LED in the track diagram denotes that the train detector has sensed the train, and green LED inside signal symbol is lit to show that the train may proceed. the black buttons top right are group buttons used in conjunction with the switch immediately below the station area. If a train is to be forwarded, the switch below station area is thrown to the direction of intended travel and black group button ("Kulkutien varmistus") "create route" is pressed. if the route need s to be canselled, the group buttom "kulkutien hätäpurku" ("emergency delete route") is pressed. In case the train crew needs to do shunting within station area the group buttons "paikallisluvan anto ("grant local control") and "paikallisluvan palutus" ("delete local control") will be used. This will provide power to both ends of the station area blocks irrespective of train detectors.

The same situation on screen: due to lack of space the rotary sections are coded with letters instead of numbers. The line (with text "Twin-T") has a star where a train is detected. immediately above the star there are arrows at blocks 6, 7 and 8 (f, g and h) denoting that the computer is giving permission for the train to proceed to the right from these sections. The row marked with text "Kytk!" ("conn!") denotes which cab is connected to this section. We see that the cab/controller 1 (or A) is connected to sections 6 and 7 (f and g). The row marked "Muisti" ("Memory") displays the throttle numbers that are taken in to memory in case two locos occupy same block (but the one in memory has been made dead by throwing points!). The kind of tunnel shown on screen at block 3 (c) means that the turnouts are so set, that a train travelling from block 2 (b) will travel directly to block 4 (d), and not through the block 3, which is the goods yard. The numbers with arrows above the track line are denoting which of the computer's function keys would create route. By pressing the space bar one could toggle between four group buttons, and the text at the top of the screen showed which of the group buttons was activated (this was used before the control panel got the buttons). the area marked as "releet" (relays) displayed the status of the four output ports. the state was displayed in decimal and binary form. The "Kierr.aika" ("loop time") shows the real time loop time (this version has quite a lot of code in assembler, the plain basic version had reatime loop times well above 2 seconds!

As the train proceeds it will appear in section 7 and later dissappear from section 6. The computer knows that trains don't dissapear, but move from one section to another, so if due to bad contact the train should dissappear while about to move to section 7 no false actions will be made. Only as the train is completely within section 7 will the section 6 be released. If the section 6 would be the destination of the train, the dissapearing of the train is considered as the train being isolated by throwing the points -- the section will be de-energised and the cab code will be put into section 6 memory. If this was an intermediate section and not the destination, as is now the case the dissappearance of the train will not de-energize the secton.

Train meet

If another train is to enter the station occupied by a train, the standing train must be made dead by throwing the turnouts to a free siding. Now the cab number of the standing train dissappearing from detection is put into memory and the section may now be assigned to the cab of the approaching train. If this train is accidentally loosing contact, the cab cannot be put into memory as there is already another cab code there!

Only after the train has completely left the rotary section that the standing loco occupies, may we re-energize the standin loco by throwing the points. Now the loco will get the cab assignded by the code in memory.

Passing a train

Passing another train works similarily, but if there is no actual feedback of the turnout position, and two trains are standing at the station, both facing the same direction, the train last entered to the staion must leave first. Only if turnout feedback is provided the the throwing of the points could be interpreted as a command to swap the cab number in memory to that in use and vice versa.

Tapiola had only six turnouts with feedback to computer, as at these instances the turnout position caused the train to enter different section. This was shown with "tunnel" symbols on screen.

Latest all-basic version of the software TaPRK_C-MRI_v1.11.zip
Latest found version of the software TaPRK_C-MRI_v2.8.zip


13 train detectors were needed, and they were connected so that, while using power routing turnouts, they lost sight of the train as the points made the track or section dead.

But as the computer knew that the points were thrown it thus knew where the loco was. The detectors were a sort of mixed design of diode version of Twin-T and Mudies detector (described in 1970's in MR). (Again, I throught that Dr Chubb's design of Optimized detector was not optimized moneywise, I'd rather have four detectors with the price (and component count) of one of his ;).

The schematic and picture of the power part of detector

The actual detection part consisted of anti-parallel diodes and antiparallel transistor base-emitter junctions. The collectors were tied together and formed a open collector output with no delay. A 33 nF capacitor was need to smoothen out erroros. This diode+transistor unit was assembled on a thumbnail size vero board, inserted into plastic film container and connected underneath the layout. the open collector lines were taken to the control panel for delay and amplification. This made the heavy duty wiring shorter too.

The schematic of delay/amplification unit and picture of the quad delay/amplifier

The amplification consisted of 1/4 LM324 op-amp, 1 uF / 3.3 Mohm three seconds off delay and instant on and sensitivity trimmer.

Post Mortem

With PC you could get all the info through a Centronics port, and at around 10 dollars a piece it is not a great investment even though you would blow one. Unfortunately todays computers running under Windows have no longer direct connection to LPT port, so one must either make a bootable diskette and load old fashioned DOS software there with the operating system, or resort to commercial software, but those are nicely tied to only commercial hardware so the DIY programmers are really having hard times!

18146 kävijää/visitors
© 1996-2023 Tapiola Parish Model Railway Club / Tapiolan seurakunnan pienoisrautatiekerho, Viimeksi päivitetty / last modified (none). Created with Notepad.

[CONTACT INFO] Don't send e-mail!
Text, drawings and photos are protected by copyright laws. Technical solutions, methods and source code are public domain only for non commercial purpose. All development has been carried out during our free time, mainly funded from our own pocket and with non selfish goals, so the use of this material for profitable use (including construction for a friend aginst a fee) is forbidden without written permit from the club. The pages contain errors, so, if you use the data given, you do so at your own risk and responsibility. If you further develop material found on these pages you must put it on display without fee e.g. to a freely available web page. We expect a note about this also.
Pages tested with W3C validator -- didn't look good ;)

[YHTEYSTIEDOT] Älä lähetä sähköpostia!
Tekstit, kuvat ja piirokset ovat tekijänoikeuslain suojaamia. Tekniset ratkaisut, menetelmät ja lähdekoodit ovat vapaasti kopioitavissa ja hyödynnettävissä ei-kaupallisissa tarkoituksissa. Kaikki kehitystyö on tehty vapaa-aikana ja pääosin henkilökohtaisilla varoilla eikä hyötymistarkoituksessa, siksi materiaalin käyttö hyötymistarkoituksiin (sisältäen kaverille rahasta rakentamisen!) on kielletty ilman kerhon kirjallista lupaa! Sivuilla esiintyy virheitä. Jos käytät sivujen tietoja hyväksesi, teet sen täysin omalla vastuullasi. Mikäli kehität sivuilla esiettyjä ajatuksia kytkentäkaavioita tai koodia edelleen, on sinun asetettava se maksutta kaikkien saataville esimerkiksi Internetiin. Odotamme vastavuoroisesti tietoa suoritetusta edelleenkehitystyöstä.
Sivut testattu W3C validatorilla -- ei näyttänyt hyvältä ;)