Using a turntable

I bought a turntable at '97 exhibition at Liverpool for my HO layout. It is a Walthers HO scale 90' motorised turntable(Part no. 933-3135). It comes in kit form and is fairly easy to put together. It costs AU$79. There are a few problems with this kit.

Computer control

The main problem with making the turntable suitable for computer control is to align the bridge with the rails. This has to be fairly precise - IMHO about 0.25mm. There are a few options.

One is to use a stepper motor without feedback. One drawback would be that the step of the stepper motor should coincide exactly with the track you are laying. If the motor steps were small enough, this could be handled but such motors would tend to be expensive.

A second option is to use sensors to detect when the bridge is aligned with the track. You would need a sensor per rail exit - each sensor will have to be carefully aligned with the exit rail. The controller would also need one input per rail. Adding a rail exit is not to be taken lightly - it involves some serious rework.

The third option that I have taken is to have a single sensor to calibrate the position of the bridge and a second sensor to detect the rotation of the motor.

Both sensors consist of an IR LED and photo-transistor combination. The first one is located on the edge of the turntable. The LED is on the bridge and the photo-transistor is stationary. The light from the LED has to pass through a small hole in the bridge and a slot in the turntable frame. The light falls on the photo-transistor when the rotor is in a particular direction and the two holes coincide. The second sensor is activated by a disc attached directly to the motor. The disc has a small part cut out. The light falls on the photo-transistor with each rotation of the motor.

When the turntable is first switched on, the bridge is rotated till the first sensor is activated. This initialises the bridge to a known position. After this, all positioning commands are processed by activating the motor till it completes the right number of rotations. The current position of the bridge is stored so as to allow processing of the next positioning command.

This approach has the advantage of making minimum changes to the turntable and needing the use of only two sensors. It is flexible enough to accommodate a wide range of positions.


Pick a spot on the edge of the turntable to install the index sensor. Drill a 1mm hole through the edge of the pit and into the outer and inner plate of the bogie. The plates of the bogie are identified as parts 17 and 18 in the assembly instructions. Drill two more holes below and above the current hole on the edge of the turntable only and make a slot out of it. This will compensate for any slight vertical play. Drill a 5mm hole on the inner plate of the bogie(part 17) without touching the outer plate. Push a 5mm IR LED into the hole and connect it to the two wires which power the track on the turntable. Attach a photo-transistor on the outside of the edge of the pit. When you install the turntable on the layout you will need a bit of clearance for the photo-transistor. Hint: Mark the hole for the turntable on the layout. Drill a hole on the edge of the circle. This will serve as the entry point for a jigsaw as well as the clearance for the photo-transistor.

When the holes on the bridge and the turntable align, the LED shines on the photo-transistor and it will conduct. This initialises the bridge to a known position. The smaller the hole, more accurate will be its known position. You should get accuracy up to 1 mm. As this is crucial to the positioning accuracy, feed the output to a Schmitt trigger and sense the transition point. A few inaccuracies may creep in, mostly due to slippage and backlash. The slippage should be negligible and the backlash can be eliminated by doing the final positioning by moving the bridge in the same direction every time. It is also possible to measure the amount of backlash and compensate for it during positioning.

To measure the rotation of the motor, mount a disc with a small part cut out directly on the shaft of the motor. The end of the shaft opposite to the worm gear has sufficient space for this. Place the LED and photo-transistor so the disc normally interrupts the beam and lets it through when the cut out portion of the disc reaches the beam. Each revolution of the motor will result in a pulse at the photo-trasistor output.

The spur gear attached to the worm on the motor shaft has 16 teeth and large gear has 210 teeth. Each rotation by the turntable is 16 x 210 = 3360 rotations of the motor shaft. If you can control the motor to a single revolution, you will get 1/3360 of a revolution of the bridge or 0.11 degrees accuracy. Assuming the diameter of the turntable is about 330 mm, this gives a 0.03mm movement at the edge of the turntable for each revolution of the motor. This should be sufficient to align the bridge with the track leading to it.

The turntable motor will be driven by an L293. To position the motor accurately within a revolution, the motor will be driven in three stages - high speed for coarse positioning followed by low speed for final positioning and finally braking the motor. Braking the motor is achieved by connecting both its leads together - this is one of the nice features of the L293.

A bicolour LED is used to indicate the status of the motor drive - yellow when positioning with a flash for each motor revolution, green when it has been positioned and red for error.

Of the 13 I/O pins on the PIC 16C84, 9 are used as described below.

The PIC 16C84 has 64 bytes of EEPROM which can be used to store non-volatile data. When a command to move to a position is received, a flag is set in EEPROM to indicate that positioning has commenced. When the required has been reached the position is tored and the flag is reset. This way, on power cycling, the controller knows its position and does not have to go through a slow, non-prototypical initialisation process. The only exception is if the power is turned off while the rotor is being positioned.

At some point I intend to design a manual control interface for the turntable allowing it to be operated without a PC for those who want fly-by-wire operation rather than computer control.

RS-232 and DCC control

The turntable controller will be built to take RS-232 as well as DCC commands. This will allow me to start testing it using RS-232 with the DCC implementation to follow later. My DCC decoding routine isn't yet working. The command set for the two modes will be the same.

The command set for the turntable controller is listed below.

With 7 commands identified so far, 4 bits will be assigned to the command allowing a maximum of 16 commands. All commands except G9999 will use 8 bits with 4 bits for the command and 4 bits for data. The G9999 command will use 16 bits with 4 bits for the command and 12 bits for data.

Using the turntable for DCC needs a few things taken into account. Turning a loco around will involve reversing the polarity of the track on the turntable. This will need all those steps taken for handling reverse loops on DCC layout. If you are powering accessories on a separate DCC feed, power the turntable controller through this feed but connect the rail on the turntable to the DCC feed for locos. The LED on the rotor is used only for the initial positioning and is driven off the power to the rail on the turntable. Turning the power off to the rail will not affect normal operation.

Current status

To reduce the play of about 6mm in the shaft, I added two layers of 3mm cork underlay. It is not the slipperiest of materials and the wobble in the big gear increases a little. The wobble is a problem when the worm tends to lift the gear away from the turntable. By keeping the rotation largely in the opposite direction the problem should be mitigated.

Other links

Home Back
Updated on 29 Jan 2002. Feedback to