More Turntable Stuff

All Switch-Kats have been programmed (a very, very easy process) and I’ve reprogrammed the turntable as well.

The Switch-Kats worked flawlessly right away, and the turntable worked great… most of the time. However, there were a couple of instances during which the turntable motor simply stopped mid-rotation, as though it forgot what it was supposed to do.

I assumed the issue was one of three things, and I remedied each of them as follows:

Assuming the wall wart that powers the Arduino, shields, and motor was too weak (it is only 0.8A / 3V) I purchased a 5A / 12V wall wart and swapped it. Bad idea. The DCC shield got very hot very quickly, and the turntable had so much torque that it ticked like a clock when it was supposed to be microstepping. I resorted to the original wall wart.

Assuming the CAT5 cable between my controller and the layout needed to be replaced, because the little plastic piece that clips it into the plug broke off a few days ago, I purchased a new one. I’m not sure if this would have affected a command that’s already been sent to the Arduino, but it was broken anyway so it had to be replaced. Here’s the new cable (exciting, right?):

Assuming the motor was getting too hot (all stepper motors get hot when they are drawing power, whether they are at rest or working), I bought an aluminum heatsink. Here you can see it on the top (bottom) of the motor, where it tends to get hottest:

I’m not sure whether it was the controller cable or the heatsink that did the trick. I’m guessing it was the cable. Now, the turntable more stable than it ever was, and is working reliably.

For posterity, here is the Arduino sketch I am using for the NEMA 17:

#include <NmraDcc.h>
#include <Wire.h>
#include <Adafruit_MotorShield.h>

#define DCC_ADDRESS 7 //Change accessory address here.
NmraDcc Dcc ; //Declare DCC Shield.
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); //Declare Motor Shield.
bool firstloop = true;
//Comment: getStepper(steps, stepper#)
//Stepper# is which port the motor is connected to. If using M1 and M2, indicate port 1. If using M3 and M4 indicate port 2.
//NEMA 17 Stepper Motor has 200 steps in 360 degrees.
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

//This function is called whenever a normal DCC Turnout Packet is received.
void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t OutputPower )
Serial.print(“DCC Turnout Packet Received\n”);
if ((Addr == DCC_ADDRESS) && OutputPower){
Serial.print(“Move 180 degrees\n”);
myMotor->step(100, Direction, MICROSTEP); //Move 180 degrees in the specified direction.
} else if ( (Addr == (DCC_ADDRESS + 1)) && OutputPower){
Serial.print(“Nudge 1 step\n”);
myMotor->step(1, Direction, MICROSTEP); //Move 1 step in the specified direction.
delay(200); //Wait 200 ms for debounce.

//setup(): This is executed first and only one time.
void setup()

while(!Serial); //Wait for the USB device to enumerate.
Serial.print(“Start Setup\n”);
AFMS.begin(); //Create with the default frequency 1.6KHz.
myMotor->setSpeed(0.025); //Set speed for 1/2 rotation per 1/2 minute., 2, 1); //Setup external interrupt, the pin it’s associated with that we’re using, and enable the pull-up.
Dcc.init( MAN_ID_DIY, 10, CV29_ACCESSORY_DECODER, 0 );//Call the main DCC init function to enable the DCC receiver.

Serial.print(“Setup Over\n”);

//loop(): If the DCC function detects a signal, it will call notifyDccAccTurnoutOutput on its own.
void loop()
if (firstloop) { Serial.print(“First Loop\n”); firstloop = false;}
Dcc.process(); //Calling this method makes the DCC shield check for new communications. It must be frequent or a message may be missed.
//myMotor->step(100, FORWARD, DOUBLE); //Move 180 degrees in the specified direction.

Oh, and I also added a holster for the controller, which I’ve put off for a long time:

In the background of the heatsink photo (earlier in this post) you can see that I added adhesive cable clips to some of the longer feeders and to the bus wires. So, I’ve really finished just about all of the wiring projects I had planned, and now I think I’m ready to start working on the terrain a bit more before adding a fascia and backscene. Pretty exciting. I’m already past the stage I was at with the former module, and I’ve only been working on this module for a few weeks. I anticipate that things will decelerate a bit now, as I’m moving into new territory.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s