Phil Harding
Pictures by the author
BEFORE EMBARKING ON THIS PROJECT, my only experience of computer programming was nearly fifty years ago using the Fortran language. Until recently, I didn’t know what an Arduino computer or a motor shield or C language were. So as a novice, I jumped in at the deep end and ended up being able to get my turntable to do what I wanted from it. There is a wealth of knowledge and help as usual on the internet.
I have had a working turntable on my layout for a long time, based on Ilfracombe SR. This used a Mazda-3 rear window wiper motor/gearbox and a second home-made worm drive to get the table turning at a low enough speed. It was controlled by relays and there were temperamental slip contacts underneath the centre of the table which struggled to stay clean enough to make perfect contact. With unreliable contacts you could find the table sailing past the intended stop position and continuing to rotate for a while. I think that happened once at Ilfracombe in real life due to heavy winds. The whole design was a copy of one made by my good friend, the late Ian Norman. Ian was a lift engineer, so we had lots of relays controlling all aspects of the operation. I thought it would be easy for a technology update and change to a computer driven stepper motor; it was not. During this project there were several occasions when I wondered what I was doing and perhaps Ian after all had found the best solution.
The Mazda 12V wiper motor had enormous grunt, but flexibility in the drive mechanism and slack in the gearbox caused the turning motion to stick or slip, making the table move unevenly. I was inspired by an article in RMWeb several years ago about the subject of using an Arduino and stepper motor for a turntable in 4mm scale. I started out on this path, copying the program, stepper and motor driver. I found, however, an even worse stick/slip action for the turntable as the motor wasn’t large enough to handle loads. I even tried the MERG turntable electronic board and the recommended motor/gearbox. The great thing in the journey was learning how to handle the Arduino and the programming language.
I decided to go for more grunt, and after a couple of trials with intermediate size motors and motor shields for the Arduino, I went for a very large stepper motor and special driver shield. The motor shield plugs onto the Arduino but the motor driver shield required fan cooling. The Arduino now sits in an electronic projects box with a separate lid. The lid has been cut out to take an 80mm diameter fan to cool the shield.
The 80mm cooling fan for the motor driver board (Shield)
The final motor chosen was a Sanyo Denki 1.6Nm, 24v, 2A, 4 wires 1.8 deg/step; along with a DF Robot DRV 8825 Motor Shield. For those wondering what a motor shield is, it is the board between the computer and the motor which communicates the Arduino outputs of highs (+5V) and lows (0V) and feeds power to operate the motor.
The DF Robot Motor Shield. The Arduino computer is underneath the shield as a two-stack assembly. In addition to motor feed wires, there are input and output wires for control and sensors.
The shield can also be set to use micro-step resolution, so in this case each pulse moves the motor shaft ⅛th of 1.8 degrees. I can now say this works, with minimal jerky motion, then often due to dirt on the table wheels or track. The gearbox between the motor and the table driveshaft is a Meccano worm drive using the 133 tooth wheel, with ball race bearings on the shafts, built inside a piece of extruded rectangular aluminium. My milling machine was used to set the bearing positions for the shafts. The combination of the gear ratio and the motor micro-step function produces a need for approximately 100,000 stepper motor steps to do a half table rotation, so you might guess that there is no problem with resolution to line up the rails. There are flexible couplings between the motor and gear box as they are not quite in line. From the picture, you can observe that the motor is hidden inside a box.
The encased stepper motor and Meccano base gearbox
This is a cast box, with a thin layer of double-sided rubber tape as used in the building trade, and followed by lead sheet on the outside. This has helped to keep the noise down to a minimum level, with which I am happy. Without the noise suppression treatment, the working unit sounded like a desktop printer. The smaller stepper motors didn’t seem to make as much noise but lacked the power.
The Arduino software program started with the DF Robot sample code (supplied), to make the motor turn. It feeds a series of highs and lows to the coils of the motor, spaced apart by milliseconds, to control the speed. Then I added a Hall effect sensor input to the Arduino board, with a magnet fixed to the turntable and a sensor set on the circumference of the turntable brick well. This can be positioned anywhere, as all it does is to allow the motor to find on start-up the sensor position from which all other moves are calculated. The accuracy of the rotation to align the table rails does not have to be remembered over time by the computer because it is set each time the layout is switched on, rather like the printer attached to your computer. Only two positions are required for the Ilfracombe layout but there is capacity to have many more positions if required.
A key issue with turntables is the backlash in the gear box, causing the table to move from its stopped position when a loco is running on and off, causing derailment. This was resolved by have a sliding locking pin on the turntable mating with a slot in the well at the correct track position. The table mounted locking pin is driven by a servo, controlled by an onboard accessory decoder, operated by an output from the Arduino computer via an instruction from an NCE Mini Panel. This is an additional benefit of having a DCC powered layout. The instruction signal is transmitted through the track feed wires. So as long as there is good conductivity to the table, the servo also gets its messages. The servo underneath the table not only moves the locking pin but also the big lever on top of the table used by the fireman to push the turntable around. This is how I can tell if the system is locked or not, by the position of the lever. I was worried that all this extra grunt from the stepper motor could shear or tear off the locking mechanism from the table or well, so I added a routine in the software which asks me by way of a flashing LED and a push button, if it is all clear to move the table after unlocking. The lock system holds the table steady when engines or indeed the Devon Belle Observation Car are rolled onto the table.
The underside of the table, showing servo, driver and frog juicer.
There is only one slip ring underneath the well, pressing on the drive shaft, which feeds one rail on the table, replacing three slip rings on the original Mazda motor design. The other rail is fed to the table by pick-ups from the circular rail in the well.
So what to do about polarity when turning a loco on a DCC layout, you may ask? I fitted a Tam Valley Depot dual frog juicer inside the turntable, but it played havoc with the MERG DCC district cut-outs, despite being set on the slowest response time, so I fed the table with ‘raw’ DCC direct from the NCE Command station. Position lights on my control panel indicate which road setting the table is at, and this is also controlled by the software and the NCE Mini Panel. A loco can roll on to the table, turn and roll off without losing feed, so the sound from the DCC decoder is not interrupted. I have used the turntable for several hours without loss of rail alignment. However, the Ilfracombe timetable, based on a Monday in May (1948), keeps me busy for six hours to complete. Therefore, I have fitted a reset button to the mini control panel so that after about halfway through the day’s running I can choose to restart the Arduino and refresh the table positioning accuracy.
I wrote a piece of start-up software for the turntable to approach the Hall sensor from both directions, so that I could calculate the changes in mechanical backlash over time and compensate for it. I decided as there were only two stopping positions, that it didn’t matter too much to keep the table rotating in a clockwise direction only and this saved a lot time with no need to worry about backlash. For the future, because I can’t stop playing with the software, I want to add motor acceleration and deceleration routines during a turning move.
With a terminus station layout, and working to a timetable, having a reliable turntable is a reassuring asset and I thought I would share this experience as articles on turntable motorisation are not very frequent. I am happy to share the Arduino code for this turntable project to anyone who feels they would like to understand it or use it for themselves. The table operating can be viewed on the Guild YouTube Channel, search for 'Turning at Ilfracombe'.