Scratchbuilding a turntable


ikallio1

Member
Greetings from a new member!

I am currently building a small layout for my kids (my excuse anyway :).
We've completed the benchwork and most of the trackwork. I thought
I'd try a nice simple turntable project for my first major modeling
exercise. After searching these forums and the internet for advise about
turntable kits, and having heard the horror stories about the difficulties
with most of them, I started wondering if I wouldn't be better off scratch
building one. After all, I didn't want to invest almost $1000 on a prebuilt
one with precision indexing just to have my young kids wreck it :-/


I have some woodworking experience, and some nice tools like a router,
tablesaw and drill press. I also had purchased a circle cutting
jig years ago that had never been used. I have some experience
with electronics and software as well. I was also encouraged by the
excellent treatise "TURNTABLE AT MALFUNCTION JUNCTION
ON THE TETON SHORT LINE" (http://www.tslrr.com/turntabl.htm) by
Wayne Roderick.

I've made quite a bit of progress already, and once I figure out how to
upload photos here I will describe what I've done so far. I hope this will
be of use to others who may want to try their hand at scratch building
a turntable. I have to warn you that this project is not for the faint
of heart. It has already been more work than I thought it would be. But it
has been fun, and has allowed me to exercise a wide range of skills and
disciplines. It remains to be seen if I can produce a smooth working,
nice looking scale model of a turntable. It looks promising so far though!

-ik
 
Scratchbuilding a turntable: plan

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at you own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.

The plan

The layout is HO scale and no specific prototype has yet been selected.
However I am interested in the NP, GN and other railroads in the Pacific
Northwest. I came across an article on the NP roundhouse at Auburn, WA.
The turntable and roundhouse looked very interesting. I decided that my
plan will be roughly based on this prototype. Unfortunately both have been
dismantled so I will have to rely on the few existing photographs.

plan.jpg

Having a vague plan to reuse this turntable & roundhouse in a later, much
bigger layout, I wanted to have realistic positioning of the roundhouse and
realistic track spacing. Auburn had 6 degree spacing between the tracks
leading to the roundhouse. The turntable looks to be just under 100 ft in
length, so the adjacent rails just meet at the edge of the turntable pit.
There were 25 stalls in the roundhouse, divided into sections with 5, 6,
7 and 7 stalls. The section with 5 stalls also had a machine shop with
one track extending through it and exiting the shop at the far end.

Garden tracks seem to be on a wider spacing, probably 12 degrees.
This would allow sufficient side clearance for locomotives parked close
to the turntable.

I can just barely squeeze in the first 2 sections of the roundhouse by
compressing the second section to 4 stalls, ending up with 9 stalls in
the roundhouse, including the extended section with the machine shop.
Due to layout space constraints I had to make a mirror image of the
floorplan.

Risks

Choosing 6 degrees track separation in a 100 ft turntable is a bit risky. I did
the math and there should be sufficient space to keep the adjacent rails
electrically insulated from each other. The meeting points will look like
a frog in a turnout. In practise this may turn out to be a problem and I may
have to isolate the "frogs" like in a turnout. I am willing risk some additional
hassle to achieve prototypical appearance. If worst comes to worse, I may have to widen the spacing...

Analysis of my junkbox
1. I have a broken down HP Deskjet, which might yield a motor and gears
2. I have scrap pieces of MDF for pit wall, bottom, indexing disk and shaft
support
3. An IR emitter LED and various other electronic components
4. A blank PCB that has had some small bits harvested for
throwbars (had to make some old turnouts DCC friendly)
5. Flat cables from old hard drive to connect the electronics boards
6. A scrap piece basswood should yield sufficient quantities of scale lumber
for the bridge after some mincing in the tablesaw :)

Need to buy
1. Dollies for the bridge (Diamond Scale <http://www.diamond-scale.com/>
has them).
2. Angled arch kit from Diamond scale as well - will wait a couple
of years for the kids to grow up a bit before installing this :)
2. Brass tubing for shaft and bushings, flat brass for bridge foundation
3. Small screws for the pivot point of the positioning vanes
4. Thin sheet metal for positioning vanes
5. L239D motor driver chip
6. A small single board computer to control the motor and manage
the indexing. I have always wanted to tinker with an Arduino so
I'm going with that :)
<http://www.arduino.cc/>
7. IR detectors (found a couple of NTE3034A Phototransistor Detectors
at a nearby Fry's)

Lest anyone think that I'm extremely well organized and capable of advance
planning, I have to admit that in reality the planning process and parts
acquisition has been very organic and mushy. Any illusion of organized
planning is caused by writing this weeks after the work started!

Cheers, until the next installment,
ik

ps. the attached track plan was done with xtrkcad - a very nice tool
after you pass the steep learning curve!
 
Last edited:
Scratchbuilding a turntable: design

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.


The Design

As I mentioned earlier, I was very inspired by the article "TURNTABLE AT
MALFUNCTION JUNCTION ON THE TETON SHORT LINE" by Wayne Roderick
(http://www.tslrr.com/turntabl.htm). I have basically used Wayne's design
with a few minor changes. Big kudos Wayne!

Having the bridge supported by only the dollies that bear on the ring
rail in the pit ensures good vertical alignment with the track on the
rim. A heavy engine moving onto the bridge will not cause any rocking
of the bridge. The shaft is affixed to the bridge with a long flat bar
of brass, flexible in the vertical direction and very rigid in the
horizontal direction. This allows the bridge to follow the shaft
rotation without any backlash while being very insensitive to any
vertical positioning error.

Underneath the pit bottom, affixed rigidly (and without backlash) is
the positioning (or indexing) disk. It has positioning vanes attached near
the rim, corresponding to the positions of the tracks to be indexed above
on the layout. The positioning vanes interrupt a light beam, which is
detected using 2 light sensors. I used an infrared LED as the light
source and IR Photosensing transistors as sensors. This makes the system
relatively immune to stray light. Using two sensors makes it easy to
determine when a positioning vane is in the exact middle point between
the sensors - just turn the table until the voltages from the
sensors are equal. This system is also relatively immune to variances
in the shapes of the vanes (although Wayne gives excellent hints
as to how to produce nearly identical pieces).

I deviated from Wayne's design by replacing the ring rail in the
positioning disk with inlaid ring of PCB board. The vanes are flat
and a circular rabbet cut around the perimeter of the disk provides
clearance for the sensors so that the vanes can pass between the
sensor and the light source.

The attached design picture will hopefully clarify what I am trying to
say above. The inlaid PCB board is shown in a deep green colour.
(In retrospect, Wayne's ring rail design would
probably have been easier to implement ;-)

Another deviation from Wayne's design is the way the positioning
disk and shaft are supported. In his design a center bearing below
the shaft carries the weight. The motor presses on the rim of the
positioning disk and moves it by friction.

turntable_design.jpg

My design has three bearing wheels supporting the rim of the
positioning disk. They are positioned 120 degrees apart. Two of
the wheels are free-rolling wardrobe door rollers I found in my
junk box. The third wheel is the drive shaft from my salvaged
motor gearing. The drive shaft has a piece of silicone tubing
slipped over it to improve the grip. The 1/3rd weight of the
positioning disk is enough to provide sufficient grip for the
drive shaft with the tubing.

The center shaft is supported by the positioning disk. Below
the positioning disk is the shaft support bracket, which
keeps the shaft vertical.

The pit bottom is cut a couple of inches larger than the outside
diameter of the pit rim wall. This forms a flange that will be used to
attach the turntable from below to the bottom of the layout. Shims
will be used to get the pit rim to exactly the correct height
for the approach tracks.

In the next journal entry I will discuss the design of the electronics.

Cheers until then,
ik
 
Last edited:
Scratchbuilding a turntable: electronics

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.


Turntable electronics

A relatively simple electronics package is needed to control the turntable. As
of now, the plan is to use a DC motor to rotate the bridge in either direction.
The user input is a single potentiometer. The user turns the potentiometer to
the direction he wants the bridge to rotate. The bridge gradually accelerates
to RUN speed. When the bridge is approaching the desired track, the user
returns the potentiometer to the center position. The bridge decelerates to
APPROACH speed and coasts along until the positioning vane attached to the
positioning disk passes over the IR sensor. The bridge slows down to HUNT
speed and stops when the light input from both IR sensors is balanced. This
happens when the positioning vane is in the exact middle of the IR sensors.

turntable_schematic.jpg

As a small additional wrinkle, I plan to implement "ludicrous speed" for the
turntable. When the potentiometer is turned to extreme clockwise (CW) or
counterclockwise (CCW) end, the bridge will accelerate to LUDICROUS speed.
This will be nice for speeding up setup work prior to an operating session,
when maintaining prototypical speed is not a priority :)

Processor board

The heart of the electronics is the small Arduino board. I chose the most
recent standard Arduino board, the Arduino Duemilanove. It will have enough
inputs and outputs remaining that it can be used for some other fun functions
in the engine servicing terminal. The Arduino board is inexpensive and can
also be scratchbuilt if funds are really tight. The development environment
is a free download and extremely simple to use. See
<http://www.arduino.cc/> for more information.

I ordered mine from Adafruit Industries (See
<http://www.adafruit.com/index.php?main_page=index&cPath=17>).

I happened to have the right kind of USB cable to connect it to my laptop
and my junk box yielded a nice 9V DC wall wart power supply that just
happened to have the right kind of connector to plug into the Arduino board.
Adafruit has both items too.

Motor control

I picked the L293D H-bridge to drive the DC motor. The nice thing about it is
that it can easily be adapted to drive a stepper motor as well if I decide to
switch to one. I plan to build a board that snaps onto the Arduino board with
pins pushed into the connector sockets. The Arduino community call these
kinds of boards "shields". In addition to the L293D there is only one additional
component, a pull up resistor to enable the H-bridge. Otherwise the board
will just be a bunch wires between the Arduino pins and the L293D pins and
DC motor.

I made sure that the DC motor power draw is within the 600mA limits of the
L293D. I just connected my multimeter in series with the motor and ran it at
9V while holding the output axis between my fingers. This gave me a stall
current of just under 500mA. Even in LUDICROUS speed the motor will be run
at less than 5V and will draw significantly less current.

For initial experimentation, the motor control and sensor boards will be
implemented on a solderless prototyping board (breadboard). This will make it
easier to e.g. arrive at appropriate resistor values and will allow quick design
changes as needed.

Sensors

The sensor board is a very simple affair consisting of a few resistors in series
with the IR led and the 2 phototransistors. The 470 ohm resistor is needed to
throttle the current passing through the IR led to well below its maximum
rated current. I arrived at the 470 ohm value by experimentation with the
phototransistors. I used voltmeter attached to the point between the
phototransistor and its 4.7 kohm resistor to see how it responded to various
intensities of IR light. This same point was eventually routed to one of the
analog input pins on the Arduino board.

sensor_board.jpg

Last, I wired a 10 kohm potentiometer between the 5V and ground. The
middle contact is wired to an analog input on the Arduino Board.

Attached is a PDF of a hasty schematic for the electronics. Let me know if
you see any obvious errors in it. It'll probably need to be updated anyway
before this project is completed.

I will post some pictures of the boards later on.

Cheers,
ik
 
Last edited:
Scratchbuilding a turntable: bridge base

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.


The build: bridge base

The other day as I was in the hardware store, I walked past a display stand
with various brass tubing and sheets. I thought that might be good material
for the bridge base, and sure enough - I found a pair of brass tubes that
nested nicely. The larger tube would make good bushings and flanges for
attaching disks to the narrower tube. I also grabbed a couple of flat pieces
of 12" long brass sheet.

I also ordered the bridge dollies from Diamond Scale
<http://www.diamond-scale.com/>.

After getting them and doing some math and additional design, I realized that
12" is not enough for the bridge base - I needed to extend it a little bit.
I cut extensions from the other brass sheet using my diamond wheel in my
Dremel. I was surprised how badly the diamond wheel cut the brass (anyone
know what's going on there? What's the best way to cut brass?). It almost
seemed like the brass coated the diamond wheel, preventing the abrasive
edges from doing their work. I finally took out a hack saw and finished the
cutting with it, leaving a lot of sanding to be done to smooth the rough edges of the cut.

I cleaned surfaces to be joined with steel wool and applied some flux paste.
I set the flat on top of an unused ceramic tile, and positioned the extension
using marks I had scratched earlier. I heated up the joint with a propane
torch and touched the solder to the joint. I was relieved
to see it flow nicely to fill the joint.

Earlier I had I marked the exact center point of the brass bar and
scratched some positioning marks for the tube and drilled a hole in the
centerpoint of the flat for the bridge track power lines. I couldn't believe how
hard it was to keep that drill bit from wandering. In the first photo you can
see how badly off center that hole went. Luckily it is there only as a passage
for the wires, so the positioning isn't critical. I learned a trick for
this later on: use a piece of transparent 1/16" thick plastic to hold the
tip of the drill bit in place above your mark! Pre-drill a guide hole into the
plastic with the drill bit you are going to use for the actual hole. This is
especially useful for those tiny #65 etc. drill bits.
bridge_base1.jpg

The second photo has the dollies attached with mini nuts and bolts. The
dollies have elongated holes to allow for some fine adjustment to get
the wheels to ride at the same radius at both ends of the bridge.
I also soldered on nuts for the eventual attachment of the bridge.
bridge_base2.jpg


The last picture has all the details and paint applied to the dollies. Lots
of deflashing, sanding and fine-tuning is needed to get the metal castings
to this point. The Diamond scale dolly kit sure makes a nice model of this
part of the turntable! That last picture also provides a sneak peek at some
other parts of the project - I will get to those soon!
bridge_base3.jpg


Next journal entry will detail the woodworking part of the project.

Cheers,
ik
 
Last edited:
Scratchbuilding a turntable: woodworking

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.


Cutting the turntable components with router

I had purchased a circle cutting jig way back when I got my router. I had
never gotten around to using it, so it was time to dust it off and give it
a try. I had some old pieces of MDF for the pit walls and shaft support
bracket so I proceeded to cut those first. I had a 1/4" straight bit
for the cut, and it was luckily quite new and sharp. I had to do the cut
very gradually, deepening the cut only by 1/16th of an inch after each
round. What a mess of dust it created!

When I got to cutting the pit bottom from a new piece of MDF, I
realized that MDF must get harder as it ages. The new MDF was significantly
easier to cut! All the other cuts were very straightforward, the pit wall
was much more complicated though. The router is very heavy and needs to
be supported on both sides of the cut to keep the bit vertical. I had to
plan the cutting sequence so that the outside waste piece stayed on
until the last moment. When cutting off the ring from its inside waste piece,
I left 3 "bridges" of material every 120 degrees to keep the workpiece
whole until the very last pass. On the last pass I was careful to hold the
ring in place so the router bit couldn't grab the ring and destroy all the painstaking work.

The first picture below shows the router with its circle cutting jig
attached. In the front is the pit bottom piece cut from the new MDF sheet.
turntable1.jpg

The second picture shows the turntable foundation assembled with the
shaft support bracket mounted to the pit bottom with spacer blocks
in between. The shaft support bracket is held in place with 3 long wood
screws and wood dowels. The dowels help make sure that the shaft
support will always end up exactly in the same place after removing &
remounting. I expected to have to take the support bracket off quite a few
times during the build.
turntable2.jpg


The 3rd picture shows the most complicated piece, the pit wall. The fourth
picture shows the pit wall glued to the pit bottom. I used the bridge base
mounted in its place to make sure the pit wall got positioned concentrically
with the pit bottom. The brass bushings kept the bridge base in place without
any play so the end result is very good. There is probably less than 1/64th
of an inch of error in the concentricity.
turntable3.jpg


You might be able to see a weird slot in the ring rail support step. That was
caused by a little router "slip" when I forgot to properly tighten the bit
height adjuster. Oh well, it's nothing that a bit of wood filler and sanding
won't cure.
turntable4.jpg


The fifth picture shows the positioning disk with its rabbet for the IR sensors
and the smaller rabbet for the PCB board inlay.
turntable5.jpg


The last picture shows the positioning disk with the PCB board ring inlaid in
place. The gray color is my attempt at concrete using some old scrap paints.
In the end I gave up and got some Polly Scale Concrete to use for the visible
parts.
turntable6.jpg


More details in next entry!

Cheers,
ik

Ps. Pictures 5 and 6 in the next message.
 
Last edited:
Scratchbuilding a turntable: woodworking pt2

Here are pictures 5 and 6.

Oh and by the way: the ring was cut from 2 scrap pieces of 5/8" MDF, glued
together and allowed to properly dry before routing.

-ik
 
Last edited by a moderator:
You've got way more talent than me, ik. Looks like a nice solid piece of work. You're right about the concrete color, although I prefer Floquil Aged Concrete.
 
You're being too modest Jim, I've seen your pictures. But thanks for the kind encouragement. When I was at the LHS I was comparing those two concrete
colors, the aged concrete looked very yellow to me. But it's hard to tell how
the painted object would look from just looking at the paint bottle. I like the
idea of "aged" though - I think it would go well with my modeling preferences. I like
grimy, rusty and sooty industrial scenes and would like to model the "eysore" kind of stuff that abounds in the real railroad business :)

-ik
 
Scratchbuilding a turntable: rollers and motor

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.



Rollers

As mentioned earlier in the design section, I needed to provide 3 point
support for the positioning disk. 2 points would be just low friction
rollers and the third point would be the motor drive wheel.

I had some wardrobe door rollers that looked like good candidates for the
job. The roller support brackets were the wrong shape, I wanted an L
bracket that would be attached to the shaft support bracket. So I
removed the rollers from the brackets, then pounded each into an L shape
using a heavy vise and a hammer. Picture 1 shows the end result, with
the rollers reinstalled and attached to the shaft support bracket.
rollers.jpg


Motor

I had stored away an old HP Deskjet with the idea of eventually scavenging
the motors from it for a project. Well this was it - I needed a motor and
gearing for the turntable! So it was time to deconstruct the old deskjet,
armed with a new set of no-tamper screwdrivers. It was a fun and
educational little project in itself. I was really impressed at all the clever
engineering in that little $200 printer. I wish I had taken some pictures to
show you.

The printer had 2 DC motors and 1 stepper motor inside. The stepper motor
was used to drive a print head cleaning station using rack and pinion gearing.
The DC motors were used where real precision control was needed: in the
paper feed mechanism and the print head moving mechanism. In each case
an optical resolving system was used to provide the positioning accuracy.

The paper feed mechanism looked very promising for driving the turn table.
It has a set of reduction gears and a nice bracket holding them all together.
The 11" axle had several large rubber wheels attached to it. I decided to
remove all the rubber wheels, and cut the axle to a lenth sufficient to push
through one of the spacer blocks under the shaft support bracket. It just
needed to protrude 1/2 under the positioning disk to support it. I ended up
slipping a piece of surgical tubing with just the right diameter over the axle
to provide better grip on the bottom of the positioning disk. I added some
pieces of scrap MDF to the shaft support bracket in order to attach the
motor bracket from the printer as is.

I didn't even remove the resolving disk, optics and electronics board - you
never know if it might come handy some day :) Picture 2 shows how I
attached the motor.
motor.jpg


Picture 3 shows the drive axle supporting the positioning disk. When I drilled
a hole for the axle through the spacer block, I made it oversize to allow for
precise positioning with a support bushing. You can probably see the plastic
support bushing attached to the inside of the spacer block. I cut that
bushing from the plastic shell of the printer :)
drive_axle.jpg


Picture 4 shows another angle of the motor mounting.
motor2.jpg


At this point it was very satisfying to see the positioning disk turning
smoothly when I ran the DC motor with an old DC power pack from
a train set. I was left wishing for a bit more gear reduction to get more
torque at low speeds. We'll see how it works....there's always the possibility
to use the stepper motor instead. Besides, more torque might just end up
causing slippage of the drive wheel.

In the next entry I will discuss setting up the single board computer and other electronics.

Cheers until then,
ik
 
Last edited:
Ik, I never would have thought of using the motors form a printger but it looks like they are perfect for what you need...and cheap too. :) I do think more torque might be a problem, since most of the printer motors I've seen had a fairly low stalling current to account for paper jams.

The Aged Concrete does look kind of yellow in the bottle but dries to a cross between gray and faded yellow. Most people have never actually looked at the color of concrete - we look past it. If you take a look at some older concrete streets, you'll see there's a lot more that faded yellow color than you might have guessed.
 
Scratchbuilding a turntable: single board computer

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.


Arduino - the single board computer
===========================

This little computer is just a delight to play with! After unpacking the
computer, it took me about 10 minutes to download & install the software
and get my first little program running on the Arduino.
I had ordered a standard version of the most recent edition of
the board: Arduino Duemilanove. It cost me $30 plus shipping
from Adafruit Industries
<http://www.adafruit.com/index.php?main_page=product_info&products_id=50>

It is small enough to sit in on top of my breadboard with space left
over for my prototype circuitry. The first picture shows the setup
with the motor driver chip.
breadboard.jpg


The development environment can be downloaded from
<http://arduino.cc/en/Main/Software>. When you run the
software the first time, you need to figure out which USB port
got allocated to the Arduino board. I won't get into more detail
about installing the software and connecting to your board, since
excellent instructions can be found here:
<http://arduino.cc/en/Guide/Windows>

After I followed the procedures explained there, I ended up
with a simple LED blinking program running on the Arduino. This
was a good starting point to go on developing my motor control
software. The language used in the Arduino development environment
is a variant of C/C++ called Wiring.

Controlling a DC motor with the Arduino and the L293D H-bridge
is really simple. In my schematic, I connected the PWM output
10 to IN1 on the L293D, and PWM 11 to IN2. PWM stands for Pulse
Width Modulation, the ATmega processor in the Arduino board
sends out a square wave. The value written to the port
determines how long the HIGH portion of the wave is proportionally
in each cycle. A value of 128 would mean the LOW and HIGH parts of
the wave are equal in length. This would drive the DC motor at
half the speed compared to the value 255.

The purpose of the H-bridge is to provide sufficient current
and voltage to the motor using the control inputs from the
processor. The chip gets the 9V supply current through its
Vs input and the 5V logic power supply through the Vss
input. One could provide up to 36V through Vs if it was
needed by the motor.

Next I wrote a simple program to get the motor running:

Code:
const int Motor1 = 11;      // PWM output pin to drive motor CW
const int Motor2 = 10;      // PWM output pin to drive motor CCW
int MotorSpeed;
int Direction;
#define CW                      0       // Clockwise direction
#define CCW                     1       // Counter-clockwise direction
#define RUN_SPEED               48
#define LUDICROUS_SPEED         75
#define APPROACH_SPEED          46
#define HUNT_SPEED              43

void setup() {

  // initialize serial communications (for debugging only):
  Serial.begin(9600);

  // Make sure motor is stopped
  analogWrite(Motor1, 0);
  analogWrite(Motor2, 0);

}

void loop() {

  Direction = CW;
  MotorSpeed = RUN_SPEED;

  if (Direction == CW)
  {
    analogWrite(Motor1, MotorSpeed);
    analogWrite(Motor2, 0);
  }
  else
  {
    analogWrite(Motor1, 0);
    analogWrite(Motor2, MotorSpeed);
  }

  // Delay 50 ms (makes the control program run 20 times per second)
  delay(50);
}
I played with various speeds and running directions until I
was satisfied that I could make the DC motor do what I wanted.

User input
==========

The next task was to connect the potentiometer and read it with
Arduino. I added the following constant & variable definitions
to the beginning of my program:

Code:
const int PotPin = 0;       // Analog input pin that the potentiometer is attached to
int PotValue = 0;           // value read from the pot
Then I was able to read in the potentiometer value with the
simple code:

Code:
  // read the CW/CCW potentiometer
  PotValue = analogRead(PotPin);
I then wrote some simple code to translate this value into
speed and direction for the DC motor. I essentially had made a
little "cab" to control the turntable. You can imagine I had
some fun time playing with the control knob and spinning
positioning disk :)

In the next entry I will describe how to add the indexing feature with
the sensor board and positioning vanes. I will also present the full
control program for the Arduino.

Cheers,
ik
 
Last edited:
Scratchbuilding a turntable: Indexing, part 1

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.


Indexing the turntable, part 1

As mentioned in the design, the indexing is based on a set of positioning
vanes attached to the positioning disk. The vanes pass between an IR
emitter (IR LED) and a pair of IR detectors (phototransistors). The first
picture shows what I found for this project. I found the phototransistors
at a local Fry's and the IR LED was in my junkbox from an earlier
experiment.
sensors.jpg


I made a PCB for the sensor board using the laser printer toner transfer
method. This method is described in many places on the
internet, see <http://www.riccibitti.com/pcb/pcb.htm> for an example. The
hardest part of the method seems to be finding suitable paper that
will release the toner easily. I used some inkjet photo paper from
Costco, but it was too high quality. It has some sort of polymer
coating which didn't come off the PCB very easily with water soaking. One
guy recommends using shiny newsprint - doesn't seem to matter if it's
already got some printing ink on it. I haven't tried it yet, but I did start
collecting nice white pieces of it whenever I run across them (older Apple
iPod and other i* ads seem to have a lot of white :)

My result with the toner transfer was a bit ugly so I had to patch the
toner with some nail polish before the soak in ferric chloride. The second
picture shows the end result. It looked and worked OK. Then I soldered
the components onto it and attached a piece of ribbon cable scavenged
from an old ATA hard drive cable. An old shelving bracket made a nice
mounting bracket (note to self: always check pieces of metal like this
for hardness before scavenging: I think I destroyed a nice metal drill bit
making the mounting holes, this bracket was made of very hard steel).
sensorPCB.jpg


The 3rd picture shows the whole positioning system assembled and mounted
on the turntable and positioning disk. (Note the corrosion on the vanes - it
happened overnight after I mounted the test vanes and forgot to clean off
the flux residue). I followed Wayne Rodericks advice and made a whole
stack of those vanes at a time. Mine didn't turn out completely uniform
unfortunately - I'm not much of a metal worker. But they seem to work just
fine.
positioning_system.jpg


You might laugh when you hear where the metal for those vanes came
from :) I couldn't find suitable sheet metal in my junk box and didn't feel like
driving to the HW store. I got an idea and headed for the pantry, where I
examined all the canned foods. Most cans have ribbed sides but a can of
coconut milk had nice smooth sides. I suddenly developed a craving for some
nice Thai green curry! A short while later I had the stack of rough cut vanes
you see in the last picture and a nice meal :)
positioning_vanes1.jpg


Continued in part 2

Cheers,
ik
 
Last edited:
Scratchbuilding a turntable: Indexing, part 2

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.


Indexing the turntable, part 2

When I started experimenting with the setup described in part 1, I was
very disappointed to notice that the vane shadows falling on the
sensors were so sharp that I was unable to locate the centerpoint
location between the sensors. After a bit of headscratching I
reasoned that this must be caused by the light source being too
close to a mathematical point. The PN junction in this IR LED
must be physically very small, hence the light is practically a point
source. I needed something much more diffuse.

I had some slightly opaque plastic that might be able to diffuse
the IR light sufficiently. I cut a small piece and started thinking
about how to mount it in front of the IR LED. I looked around and
noticed that the eraser cover in my mechanical pencil is almost the
same size as the LED. I tried it and voila, it fit snugly on the
IR LED.

I cut a small cylinder from the cover and glued the piece of plastic
to one end. The whole thing then slipped nicely over the IR LED. After
firing up my sensor measurement program for the Arduino, I realized that
I needed to increase the intensity of the IR LED, so I decreased its
resistor to 470 ohms. Now the signal shapes from the sensors (in response
to the vane shadows) were perfect!

The first picture shows the sensor board with the makeshift light
diffuser in place.
sensor_board.jpg


Positioning vanes

The second picture shows the positioning disk with all the vanes attached.
You can also see the split ring PCB board which will be used to deliver power
to the bridge tracks. I made that with a soak in ferric chloride as well, this
time I didn't need any complicated circuitry on it so I just used clear packing
tape to protect the parts of the copper cladding that I didn't want dissolved.
The split ring PCB is epoxied onto the positioning disk.
positioning_disk.jpg


The screws I ended up using for the pivot point of the vanes are a bit on the
large side. I couldn't find smaller ones easily, but they seem to work OK
anyway. After playing with the 3 test vanes earlier, I realized that having
only a small tiny blob of solder between the vane and the inlaid PCB is best.
Having solder in the whole area between the vane and PCB made any
adjustments very hard. I suppose a larger soldering iron might compensate.
This is another reason why going with Wayne's original idea would have been
better.

I made another goof with the positioning disk. I had originally numbered the
vane positions clockwise. Then late one night I realized that I was looking at
the underside of the positioning disk - therefore the vanes should have been
numbered counterclockwise! My approach tracks were numbered clockwise of
course. I thought I was so lucky catching this gaffe before mounting all the
vanes. WRONG.

After mounting all the vanes with the "corrected" order, I couldn't believe it
when I started playing with the table and noticed where the bridge was
stopping. The wider gaps (for the garden tracks) where in the clockwise
direction from the 6 degree gaps (roundhouse tracks). What went wrong? It
took me a while to notice that the positioning vanes have to go the other
way because the sensor board is stationary, and the vanes are rotating! I
was cursing my "cleverness" as I spent couple of hours moving the vanes :-/

Positioning guide

To aid in fine-tuning the indexing system I mounted a positioning guide to the
bottom of the pit. I made it out of a piece of clear plastic. I scribed a line
with a box knife on the back side of the plastic and attached it with duct
tape. See picture 3. This allowed me to actually see how precisely
repeatable the positioning was (it wasn't very repeatable to begin with!).
positioning_guide.jpg


Next entry will describe the control software.

Cheers,
ik
 
Last edited:
Scratchbuilding a turntable: Indexing, part 3

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.



Control software

Here's the fun part:
Code:
/*

Turntable control
=================

Physical inputs:
- Potentiometer for user to request turning direction
   and speed
- Analog inputs from two phototransistors (used to determine
   location of the positioning vanes)

Physical outputs:
- 2 wires to send PWM pulses to a DC motor
 
System description:
- Turntable bridge has a positioning disk mounted rigidly
   on the same axle. Positioning disk is under the layout.
   Positioning vanes mounted on the positioning disk are
   used to accurately stop the turntable at the correct
   location for the approach tracks on the layout. DC motor
   drive wheel bears on the positioning disk to turn the
   turntable bridge.

Functional description:
- The control panel has a single potentiometer. The user
   rotates it in the direction, (CW or CCW), that he wants
   the bridge to rotate. This makes the bridge rotate at its
   standard RUN speed in the chosen direction. When the user
   returns the potentiometer to its center position, the
   bridge decelerates to APPROACH speed and continues to
   the next track. As it nears the track, The bridge decelerates
   to HUNT speed and zeroes in to place.
- APPROACH mode ends when the leading edge phototransistor
   is occluded
- HUNT mode ends when the light falling on the phototransistors
   is balanced. System enters STOP mode
- Speed changes are never abrupt, the control software gently
   accelerates/decelerates transition between RUN, APPROACH
   and HUNT speeds
- A really fast turn speed called LUDICROUS speed is used
   when the potentiometer is turned all the way to the
   extreme CW or CCW position

*/

const int Motor1 = 11;      // PWM output pin to drive motor CW
const int Motor2 = 10;      // PWM output pin to drive motor CCW
const int PotPin = 0;       // Analog input pin that the potentiometer is attached to
const int PTCW = 1;         // Analog input pin for clockwise phototransistor
const int PTCCW = 2;        // Analog input pin for counterclockwise phototransistor
int PotValue = 0;           // value read from the pot
int MotorSpeed = 0;         // Current speed value output to the PWM (analog out) to drive the DC motor
int TargetSpeed = 0;        // Target speed is used when accelerating and decelerating
int PhotoValue = 0;         // value read from Phototransistor
int PhotoValueCCW = 0;      // value read from the counterclockwise Phototransistor

#define STOP                    0       // Bridge is stopped
#define RUN                     1       // Bridge is turning at normal speed
#define LUDICROUS               2       // Bridge is turning at ludicrous speed
#define APPROACH                3       // slow down and start looking for positioning vane
#define HUNT                    4       // Positioning vane detected, move slowly until light input balanced

int Mode = STOP;

#define CW                      0       // Clockwise direction
#define CCW                     1       // Counter-clockwise direction

int TargetDirection = CW;       // Target direction is used when decelerating and accelerating
int Direction = CW;             // Current direction of rotation
char *DirectionText[] = {
  "CW ",
  "CCW "
};
 
// Below are the potentiometer treshold values used to enter the different operating modes

#define CW_TRESHOLD             750
#define CW_TRESHOLD_LUDICROUS   900
#define CCW_TRESHOLD            350
#define CCW_TRESHOLD_LUDICROUS  100

#define APPROACH_TRESHOLD_LOW   330
#define APPROACH_TRESHOLD_HIGH  730

// Below are the PWM output values for setting different speeds

#define RUN_SPEED               48
#define LUDICROUS_SPEED         125
#define APPROACH_SPEED          42
#define HUNT_SPEED              38
#define MINIMUM_SPEED           35              // motor stalls at this voltage, no point in spending time decelerating from or accelerating to this value
#define STANDARD_ACCELERATION   1

// Below are the treshold values from the phototransistors used to determine mode changes

#define HUNT_TRESHOLD           800
#define BALANCE_TRESHOLD         50
#define FINE_BALANCE_LIMIT       10

void setup() {

  // Make sure motor is stopped to begin with
  analogWrite(Motor1, 0);
  analogWrite(Motor2, 0);
}

/*

Main Control Loop
=================

*/

void loop() {


  // read the user input (CW/CCW) potentiometer
  PotValue = analogRead(PotPin);           

  // if CW requested, then go to RUN mode in the CW direction
  if (PotValue > CW_TRESHOLD)
  {
    TargetDirection = CW;
    Mode = RUN;
    if (PotValue > CW_TRESHOLD_LUDICROUS)
      Mode = LUDICROUS;
  }
  // else if CCW, then go to RUN mode in the CCW direction
  else if (PotValue < CCW_TRESHOLD)
  {
    TargetDirection = CCW;
    Mode = RUN; 
    if (PotValue < CCW_TRESHOLD_LUDICROUS)
      Mode = LUDICROUS;
  }

  // do all the mode-specific stuff
 
  switch (Mode) {
   
    case STOP:
      TargetSpeed = 0;
      break;
     
    case RUN:
      TargetSpeed = RUN_SPEED;

      // if potentiometer returned to middle, then go to APPROACH mode
      if (PotValue >= APPROACH_TRESHOLD_LOW && PotValue <= APPROACH_TRESHOLD_HIGH)
      {
        Mode = APPROACH;
        TargetSpeed = APPROACH_SPEED;
      }
      break;

    case LUDICROUS:
      TargetSpeed = LUDICROUS_SPEED;

      // if potentiometer returned to middle, then go to APPROACH mode
      if (PotValue >= APPROACH_TRESHOLD_LOW && PotValue <= APPROACH_TRESHOLD_HIGH)
      {
        Mode = APPROACH;
        TargetSpeed = APPROACH_SPEED;
      }
      break;
     
    case APPROACH:
      // wait until approach speed and direction have stabilized
      if (Direction == TargetDirection && MotorSpeed == TargetSpeed)
      {
        // read the leading edge phototransistor
        if (Direction == CW)
        {
          PhotoValue = analogRead(PTCW);
        }
        else
        {
          PhotoValue = analogRead(PTCCW);
        }

        // if occluded, then go to HUNT mode
        if (PhotoValue > HUNT_TRESHOLD)
        {
          Mode = HUNT;
          TargetSpeed = HUNT_SPEED;
        }
      }
      break;
     
    case HUNT:
      // read phototransistors
      PhotoValue = analogRead(PTCW);
      PhotoValueCCW = analogRead(PTCCW);
     
      // if values close enough, then go to STOP mode
      if (abs(PhotoValue-PhotoValueCCW) < BALANCE_TRESHOLD)
      {
        Mode = STOP;
        MotorSpeed = 0;
        TargetSpeed = 0;

        // Fine hunt loop
        while(abs(PhotoValue-PhotoValueCCW) > FINE_BALANCE_LIMIT)
        {
          PhotoValue = analogRead(PTCW);
          PhotoValueCCW = analogRead(PTCCW);
        }

        // perform immediate motor stop      
        analogWrite(Motor1, 0);          
        analogWrite(Motor2, 0);          
      }
      break;
  }

  // Handle acceleration/deceleration:
  // =================================
 
  // if target speed/direction not yet attained, then adjust speed
  if (Direction != TargetDirection)
  {
    // Decelerate to 0 speed
    if (MotorSpeed > MINIMUM_SPEED)
    {
      MotorSpeed -= STANDARD_ACCELERATION;
    }
    else
    {
      // 0 speed attained, time to start accelerating in the other direction
      MotorSpeed = 0;
      Direction = TargetDirection;
    }
  }
  else if (MotorSpeed < TargetSpeed)
  {
    // Accelerate
    if (MotorSpeed < MINIMUM_SPEED)
      MotorSpeed = MINIMUM_SPEED;       // jump straight to MINIMUM_SPEED
    else
      MotorSpeed += STANDARD_ACCELERATION;
  }
  else if (MotorSpeed > TargetSpeed && MotorSpeed > MINIMUM_SPEED)
  {
    // Decelerate
    MotorSpeed -= STANDARD_ACCELERATION;
  }

  // Update motor speed
  if (Direction == CW)
  {
    analogWrite(Motor1, MotorSpeed);          
    analogWrite(Motor2, 0);          
  }
  else
  {
    analogWrite(Motor1, 0);          
    analogWrite(Motor2, MotorSpeed);          
  }

  // Delay 50 ms (Control program runs 20 times per second), except only 10ms in HUNT mode
  if (Mode == HUNT)
  {
    delay (10);
  }
  else
  {
    delay(50);
  }
}

I made the code fairly well self-documenting, but if there are any questions
about it feel free to ask. I had to add a fine hunt mode, where the control
program goes into a continuous loop after a certain level of balance has been
found between the light sensors. It then loops continuously until the balance]
is sufficiently close and immediately stops the motor. I found that even with
the slowest HUNT speed I could get without stalling the motor, 10 ms was
too long an interval to find the centerpoint with sufficient precision.

So now I've pretty much caught up with where I am with the construction.
Here's an overview photo (I put a little Z scale train loop on the mounting flange just for fun ;-) :
z_scale_layout.jpg


Next step is to fine-tune the positioning vanes with the positioning guide,
build the bridge, install bridge rails and install the table in the layout. It will
probably be a little while before the next entry comes in. Cheers, until then
ik

Ps. anyone know what size of ties were used on bridges (specifically turntable
bridges) and what spacing was used? I have some 9" x 9" HO scale lumber -
would that be prototypical?
 
Last edited:
>> Ps. anyone know what size of ties were used on bridges (specifically turntable
bridges) and what spacing was used? I have some 9" x 9" HO scale lumber -
would that be prototypical?


From the drawings for a 56', A-frame (armstrong) TT, the cross ties are 8 x 12, bolted under the 2 main beams. Those beams are a pair of 8" x 18", spaced side-by-side. The space is enough for the 1 1/2" x 33" bolt. I can't tell if the tie or the beam is notched. The 33" bolt goes through the 12 tie and the 18" beam. Ties at the center of the TT are larger. Lateral spacing appears to be 12" between (20" center)
My drawings came from the California Railroad Museum.

Big project - have you thought about publishing beyond this forum?
 
Last edited by a moderator:
Thanks for the information. I went out and photographed some actual
bridges locally which I guess are from about the same era as the turntable
I'm modelling. It seems the bridges are using some square profile cross ties
(maybe 8" x 8") and some rectangular profile ones (maybe 8 x 12). I will take
some measurements from those photos and see what they give.

I wasn't really thinking about publishing this when I started the thread. And I'm
still a complete newbie RR modeller, it would seem presumptious to publish something
at this stage. Besides, I wouldn't even know where to start trying to get an
article published.

Will post the next journal entry in a bit.

Cheers,
ik
 
Scratchbuilding a turntable: Correcting vane positions

Disclaimer

This is a construction journal, not a plan to be followed! If you are inspired
to build something after reading these articles, do so at your own risk. Take
the necessary precautions for safety. Working with powertools and electricity
is dangerous.



Correcting the vane positions

I needed to accurately measure the deviations of the positioning vanes
from their intended positions. I used my digital camera to do this.
I modified the positioning guide to include a millimeter scale,
then took a photograph of the positioning disk at each
stop from both approach directions (clockwise and
counterclockwise). See photograph 1 for example.
vane_positions.jpg


As you can see from the track plan presented earlier,
I have 18 approach tracks, and have to provide 2 table positions
for each track (needed to be able to turn the engine 180 degrees).
I have a total of 36 positioning vanes so I needed to take 72
photos. I had a bit of work to do.

I then loaded each photograph in Gimp (a open source graphical
editing program), used the measuring tool in there to measure
(in pixels) how much the deviation was between the 0-line of the
positioning guide and the positioning mark on the rim of the
positioning disk. Then I measured (in pixels) how much the 10 mm
distance (on the positioning guide) came to in that photograph.

A simple bit of arithmetic then gave me the deviation in millimeters.
See the table in picture 2 (the pdf file).
vane_positions.jpg


It was interesting to see the difference in deviation when
approaching each position from CW and CCW directions. There
seemed to be a fairly consistent error just over 1/10th millimeters.
The largest error was 0.28 mm. This would translate to an
error of a bit over 1/100 inches at the approach track rail ends.
Looks promising so far.

I then calculated a new origin for the 0-position (after all, this
position is arbitrary). I wanted to pick a position that would
minimise the number of vanes I needed to move. I picked the
value 1.22 as the new origin point (i.e. I subtracted 1.22 from
all deviations, arriving at the values in the "Corrected"
column. My criterion for needing to move a vane was 1/4 mm.
Anything under that would be close enough for now.

I then needed to figure out which vane was responsible for the
error, put that in the "Move vane" column, then rounded up
the movement amount to one decimal place for the correction
amount (last column)

Next it was time to heat up the soldering gun and shift some
vanes. I'm hoping that I managed to get all the vanes to
within 0.25mm of correct position (1/100 inch at the approach
track rail ends). This is good enough for now.

I plan to position the approach tracks using the turntable bridge
rails. This should put the average positioning error for the "better"
half of the bridge to less than 0.003 inches (0.13 mm divided by 2,
then add 20 pct to account for the larger diameter at the rail heads,
then divide by 25.4 to convert to inches). I will then have to
fine-adjust the opposing side vanes as best as I can until I get
acceptable accuracy for the bad end of the bridge.

Next step will be building the bridge. I will post the next journal
entry after I get that done.

Cheers,
ik
 
Last edited:
Sorry for the long hiatus guys, been busy with other
hobbies and family life, in general. I hope to be
able to blow the dust off the project and post some
more progress soon.

-ik
 
boy I'm glad I started this build log, sure will make it easier to resume the project
some day! The project is not dead by any means. I lost the H-bridge chip to another
project, but that can be replaced easily enough. I hope to be able to get back to
the project soon.

-ik
 



Back
Top