Overview

Conductor Level

What is Turntable-EX?

Note

Turntable-EX is in public Beta testing, and as such, we encourage regular feedback on the success or otherwise of both the software and documentation. Please reach out via any of our support methods and help us get Turntable-EX as easy to use and reliable as possible.

For those who wish to help us with Beta testing, you’re encouraged to follow the testing processes outlined in the Regression Testing process, and then submit your test results using the Beta Test Results issue template.

Turntable-EX is a fully integrated turntable controller, using an additional Arduino microcontroller to drive a stepper driver to rotate a turntable and align the bridge track with the surrounding layout tracks. An Arduino Nano or Uno are suitable microcontrollers for Turntable-EX.

The aim is to keep things as simple as possible, and to maintain alignment with the categories of our users as defined in our Choose Your Level guide for CommandStation-EX (Conductor, Tinkerer, and Engineer).

The out-of-the-box example configuration should allow a Conductor level user to get up and running relatively quickly using the ubiquitous ULN2003/28BYJ-48 stepper driver and motor combination that are readily available.

To make full use of Turntable-EX, you will need a basic understanding of EX-RAIL automation, but we’ll share the details and some examples to help with this.

Essentially, if you have setup your own CommandStation, the expectation is that Turntable-EX will be a natural extension of this, and be equally as easy to setup (at least from the electronics and software perspective).

The Turntable-EX integration includes:

  • Support for an Arduino Nano or Uno

  • I2C device driver

  • EX-RAIL automation support

  • Debug/test command (handy for tuning step positions)

  • Out-of-the-box support for several common stepper drivers and motors

  • DCC signal phase switching to align bridge track phase with layout phase (if your turntable doesn’t do this already)

  • An LED and accessory output to control turntable specific automations (eg. flashing warning light)

Note

Credit where credit is due!

AccelStepper.h credit: This project would not be effective without the excellent work by Mike McCauley on the AccelStepper.h library that enables us to have somewhat prototypical acceleration and deceleration of the turntable. A slightly modified version of this library is included with the Turntable-EX software (sans example sketches), and more details can be found on the official AccelStepper web page. Modification comments are included within the library.

NmraDcc.h credit: Also, while not directly used in this software, Alex Shephard’s “DCCInterface_TurntableControl” was the inspiration for the initial turntable logic for another DCC driven turntable that translated into the beginnings of Turntable-EX. You can see this code as part of the NmraDcc Arduino library.

What you need for Turntable-EX

  • A DCC++ EX CommandStation running version X.X.X or later of CommandStation-EX (this includes the Beta version of the Turntable-EX device driver)

  • An Arduino microcontroller (tested on Nano V3, both old and new bootloader, an Uno R3 should also work)

  • A supported stepper motor driver and stepper motor (see list below)

  • A hall effect (or similar) sensor for homing, which needs to be digital/unipolar such as an A3144 or 44E (or equivalent)

  • A suitable power supply - note that your chosen stepper driver/motor will dictate this, see note below

  • A prototyping shield is highly recommended, especially when using a Nano, and the pictured version is preferred over the screw terminal version

  • Dupont type wires to connect the components, male to female or female to female as required

  • A USB cable to connect the Arduino to a PC to load the software

  • Optional: A dual relay board (or similar) if you wish to use the phase switching capability (see Important! Phase (or polarity) switching)

Nano V3 ULN2003/28BYJ-48 Stepper combo Hall Effect sensor Dual Relay Nano Prototype Shield Dupont male to female

Power supplies

Choosing the right power supply for your Arduino and stepper motor is important to get right.

If you are using the default ULN2003/28BYJ-48 it is technically possible to power the driver and stepper directly from the 5V output on an Arduino, however this is not recommended and should be avoided.

Given that this combo requires 5V, you can use a single, regulated 5V DC power supply rated for at least 500mA to power both the Arduino and the ULN2003/28BYJ-48.

Note that if you use the right Arduino Nano prototyping shield, it will likely have a LM317 voltage regulator supplied by the DC power jack. In this instance, you can use a 7 to 9V 500mA+ DC power supply to provide power, and it will be safe to connect the ULN2003 5V to a 5V output on the prototyping shield.

For other steppers such as the NEMA17 that require 12V DC, you will need either two separate power supplies, or a DC-DC converter to provide a lower voltage to the Arduino. Note that the NEMA17 steppers have a considerably higher current rating, so the power supply will need to be rated at 1.5A or higher.

Supported stepper drivers and motors

The default configuration of Turntable-EX is for the ubiquitous ULN2003/28BYJ-48 stepper driver and motor combination. These steppers are used in a myriad of applications, are inexpensive, and will be suitable for most smaller scale turntable applications.

However, it is very easy to use one of several other common stepper drivers if you require more torque, or if you prefer to use a NEMA17 or other stepper motor.

The complete list of supported stepper drivers and motors:

  • ULN2003/28BYJ-48 (Default)

  • A4988/NEMA17

  • DRV8825/NEMA17

How does it work?

If you’re not familiar with stepper motors then you only need a very high level understanding of how they work in order to use Turntable-EX successfully on your layout, as the concept is very simple.

Very simply, a stepper motor is able to be rotated one step at a time, which translates to degrees of movement around a circle. For example, the ubiquitous 28BYJ-48 stepper motor referred to here takes 2048 steps to make a full 360 degree rotation. The higher the number of steps in a single rotation, the easier it will be to get perfect alignment between the turntable and your layout, and this also typically translates to smoother rotation.

Note

You don’t actually need to know the number of steps required to make a full rotation as this is calculated by Turntable-EX the first time it starts up and performs the calibration sequence. You will see the number displayed in the serial console as outlined in Automatic calibration.

In Turntable-EX, at startup, the turntable will rotate until such time as the homing sensor is activated, in which case it will set the homed position as step 0 and stop moving. Typically, the homing sensor is a hall effect device mounted in the turntable pit which is activated when a magnet in one end of the turntable bridge comes in to close proximity.

Once the home position is determined, the various positions on your layout are defined as the number of steps from this home position.

The command used to move to these positions simply sends the number of steps to Turntable-EX, which calculates the steps required in order to move the least number of steps to the desired position, meaning it will rotate either clockwise or counter clockwise depending which is the shortest distance.

That’s pretty much as simple as it gets. These step positions are defined in myAutomation.h (part of EX-RAIL), which will be described in further detail below, including how to ensure these are advertised to WiThrottle applications.

Tip

It’s recommended that the home position does not align with a specific layout connection track to ensure that each time Turntable-EX powers on, it automatically triggers the homing activity to occur, ensuring it starts in a consistent location each time for the highest accuracy.

Controlling the turntable

To control the turntable, the simplest method is using EX-RAIL automation commands advertised as ROUTEs to the throttle of your choice.

Refer to the Testing, Tuning, and Control page for more details on this.

Important! Phase (or polarity) switching

Note

This section of our documentation on phase or polarity switching is currently a bit confusing. The “keep it simple” approach didn’t quite translate to this section of the documentation unfortunately. We’re reviewing the phase switching options at the moment and should have this updated very soon.

In the meantime, for those looking to convert existing turntables, most have an existing central wiper ring (or similar) with gaps 180 degrees apart to provide the bridge track power and automatically reverse the polarity. This will continue to work with Turntable-EX, meaning the dual relay board is not required.

We still recommend you read on as getting the phase/polarity right when the turntable is rotating is important.

An important aspect that must be taken into consideration with a rotating turntable is the phase or polarity of the turntable bridge track in relation to the surrounding layout tracks.

Danger

If your locomotive drives on to the turntable bridge track, and the DCC phase (or polarity) is not aligned with the surrounding layout tracks, then you will cause a short circuit. The CommandStation should cut power in that scenario, but the desired behaviour is simply to drive onto the turntable with no interruption.

In order to prevent short circuits, the DCC signal to the tracks on the bridge need to be reversed when rotated to certain positions. There are three options to achieve this:

  • Use an auto-reverser that automatically reverses the phase when a short circuit is detected (the Digitrax AR1 is a commonly used option here)

  • Use a mechanical method to switch the phase based on the physical position of the turntable

  • Use Turntable-EX and EX-RAIL position definitions to reverse or maintain the phase as appropriate for each position using a dual relay board (or similar)

The critical aspect when using Turntable-EX/EX-RAIL or a mechanical method to control the phase is to ensure the entry and exit tracks for each position are wired with the same phase or polarity. An auto reverser will allow out of phase layouts to work as it will always reverse on a short circuit.

Consider the turntable starting in alignment with the entry and exit tracks, with everything wired in alignment so the +/- connections from the motor shield are connected to the same rail all the way along.

If we do not invert or reverse the phase, when it rotates 180 degrees, there will be an obvious issue!

No rotation 90 degrees 180 degrees

Now consider inverting or reversing the phase when performing that 180 degree turn, and the result is just like the starting point, with all tracks in DCC phase alignment.

No rotation 90 degrees 180 degrees

I’m Ready!

Click the “next” button to get started assembling Turntable-EX.