Computer Controlled DCC

  ** MENU - RailNet **
* Track2 RailNet *
a Entry Page
b RailNet Home
c About


d Clubs
e Directions
 Loose Ties All Ga.
Susquehanna S Ga


f Layout Photos
g Vendors
h Shows
i Pub. Displays
. . (outdated)


Email Archives
. (Yahoo)


Posting Tips
Test LstSrv


j DCC Contacts
L Computer-Control
. (S ga)
m Archives


. (G scale)


information about controlling a small DCC S-Gauge display layout with a DOS computer and Quickbasic, operating the train either around a circle or point-to-point.
1. MPEG Videos
2. Introduction
3. Layout Photos
4. Wiring Schematic
5. Additional Comments
6. Copies Of QuickBasic Code
Appendix A. S Helper Tips For Viewing MPEGS
-- Related Pages -- - G gauge relay & block multi-train systems

1. MPEG Movies

MPEG Movie 1 -- 15 seconds, 320 pixels -- point-to-point operation on compact Pikemaster door layout shown below
MPEG Movie 2 -- 60 seconds, 160 pixels -- same layout, showing engine stopping at sensor
MPEG Movie 6 -- 15 seconds, 320 pixels -- showing computer screen while computer is controlling locomotive

Additional MPEGs

MPEG Movie 3 -- 60 seconds, 160 pixels -- same layout, viewed from other end of layout
MPEG Movie 4 -- 60 seconds, 160 pixels -- overall view of same layout
MPEG Movie 5 -- 60 seconds, 160 pixels -- same locomotive/computer setup, operating on a straight-line point to point layout

General principle of operation:

  • Engine passes in front of sensor, computer rings bell and slows train gradually down to a stop.
  • Engine idles for predetermined amount of time, blows horn, then gradually starts up in opposite direction

More MPEGs, showing AF Atlantic w/Soundtraxx DCC (added 4/03)

MPEG Movie 7 -- 15 seconds, 320 pixels -- Runby - showing AF Atlantic w/Sountraxx
MPEG Movie 8 -- 60 seconds, 160 pixels -- showing train entering sensor on ramp
MPEG Movie 9 -- 60 seconds, 160 pixels -- showing train entering other sensor on flat

Photo of layout used for above 3 Atlantic MPEGS (640 pixels wide) . . . (1280 pixels wide)

Customized S-Helper Service SW-9 gives the impression of "action" even when it is sitting still, due to rooftop rotary-beacon light and diesel exhaust sounds from Soundtraxx sound decoder

(See the Susquehanna S-Gaugers Web Page for more S-gauge information)

CREDITS: SW-9 customization done by Chick Viggiano, Chick's Hobby Center, 609-423-0773, 924 Berkley Road, Gibbstown, NJ 08027


2. Introduction


This web page describes the use of a computer to control a DCC sound-equipped locomotive using a North Coast Engineering DCC command station, for the purposes of automatically controlling a small display layout.

The computer automatically stop, pauses, and starts the train, while activating the bell and horn at desired times.

The train can be operated either around a circle or point-to-point

Why DOS & Quickbasic

Old DOS computers are plentiful at cheap prices. People much more knowledgable than me about computers, recommend Quickbasic and DOS rather than Visual Basic and Windows, because Windows supposedly interrupts the Basic program by doing tasks in the background, which can cause the Basic program to miss events.

Note there are also available sophisticated commercial train control programs, such as Kam Industries and Railroad & Co, which I am not yet familiar with.



The detectors presently being used are light-beam detectors. When the train interrupts the beam of light shining across the track, the detector sends a signal to the computer.

Infrared detectors, current-sensing block detectors, or magnitically-activated reed switches could also be used.

CREDITS: Fabrication of detectors and creation of computer code to Interface the computer to communicate with the detectors and DCC command station, done by Fred Cupp, Williamsport Pa ( )


3. Layout Photos

Operating point-to-point on Tom Robinson's control table at the NMRA National Convention July 2001, St. Louis


Operating in circular mode on Loose Ties modules July 2001, Danville PA

Operating in "circular mode", the computer does the approximately the following steps when the train breaks the light beam of the detector:

Starts the bell ringing
Gradually "ramps" the speed down to a stop
Turns the bell off
Holds the train stationary for about 20 seconds
When ready to start, blows horn twice
Gradually "ramps" the speed back up. 

Operating point-to-point at the NASG National Convention July 2001, Steamtown (Scranton) PA


Mock-up of a compact display layout

The compact layout being loading into a compact car

The above photo shows a mock-up of a compact display layout, intended to fit on a single standard 30" wide sales table, and can operate point-to-point at shows. It is built on a 34" wide x 68" long hollow-core door -- using 30" diameter circle Pikemaster track.

The layout can be seen operating in the MPEG vidoes referenced above

Advantages of this small layout:

  • This complete track fits into a compact car, reducing setup time compared to assembling the track at the show.
  • This layout can fit on a single standard 30" wide sales table. Normal 40-inch diameter "Flyer radius" track requires two tables to make a loop. At some shows, renting 2 tables can be quite expensive.

4. Wiring Schematic


5. Additional Comments

There are several reasons for using the computer to operate the train:
  • The person manning the layout can focus his attention on talking to people, while the computer handles the "busywork" of running the train
  • The varying speed-cycle is intended to break the monotony of a train just running endlessly in a circle
    • The idle period gives the motor a rest from constant running
    • Also, having the engine idling and "creeping", with full lights and sound, demonstrates the DCC capability

Macs Don't Work Here So Well ?

Although I possibly qualify as a "Macintosh Fanatic", this is one application that is maybe better done with PCs, for the following reasons:

  1. Lack Of Brainpower -- Nobody in my geographic area - to my knowledge - has interfaced a Mac to send start/stop/speed-up/slow-down type of "train operating" instructions to a North Coast DCC Command Station -- and frankly, I'm not smart enough to figure out how to do it myself.
  2. Lack Of Software/Hardware -- With the PC, all you need is the easily-found DOS and Quickbasic programs to control a North Coast (or Wangrow) command station. To use the Macintosh, I believe you need to obtain Virtual PC, which is another $200 or so expense, plus some kind of Basic, plus special cables to connect the Mac to the command station.
  3. PCs are cheaper -- You can find old 386 PC laptops in the $25 price range; whereas a Mac laptop, even an old one, is probably going to be significantly more expensive.

6. Copies Of Quickbasic Code

Using the below links, you can either view a text copy of the Quickbasic computer code, or download an actual copy of the computer code.

Simple Program (RNLOC1.BAS)

Text version
Quickbasic Program
  • This program is intended to be the simplest possible program to allow you to control the locomotive using the computer.
  • This program allows you to use the computer's up and down arrow keys to control locomotive speed.

Enhanced Program (RNLOC24d.BAS)

Text version
Quickbasic Program
  • This program uses the code from the above program, plus two added modules to automatically "ramp" the train up and down running in a circle or running point to point.

Appendix A. S Helper Service -- Tips For Viewing MPEGS

The MPEG movie files can be viewed with Quicktime Player or Windows Media Player (although some of the Windows users cannot seem to play them).

Statement Of Problem

JamesIngram@ wrote:
> TO: Tom Robinson:
> Tom -
> You and several other people reported not being able to play the MPEG
> format movie files I sent on Monday.
> <snip>
> Fred Cupp checked this out for me, and reports the following
> procedure worked for him:
> 1. From within your email program, save the movie files onto your hard drive.
> 2. Start 'Windows Media Player', which he says comes with Windows 95 & 98.
> 3. From within Media Player, use the 'File' --> 'Open' sequence to
> open the movie file.

S-Helper Service - Manufacturer's Recommended Fix For Problems Viewing S-Helper SW-9 MPEG Movie Files

Date: Wed, 27 Jun 2001 22:31:41 -0400
From: Robin Thompson <robin@>
Subject: Re: Re Playing S-Gauge MPEG Files I Sent Mon 6/25
Dear Jim,
They ran just fine on my G-4. But, I think you are giving misleading
Step one - Sell virus attracting Windows machine on e-bay. This should be no
problem as P.T. Barnum can attest.
Next purchase one of the superior Apple Macintosh computers. An iBook, G-4 or
titanium powerbook will do just nicely.
Lastly enjoy the mpegs of the SW-9s and reading about how the viruses are
driving windows owners crazy. The money and time you save in reformatting your
hard drive and purchasing virus software alone make the Macs a great value.

mac-no shs

This DCC page created 5/17/01, last modified 6/27/2006... by (bottom include) , Williamsport Pa, Voice Mail 570-322-7597