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()
{

Serial.begin(115200);
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.
Dcc.pin(0, 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.
//delay(5000);
}

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.

Six Switch-Kats in Situ (Say That Ten Times Fast)

Tonight I repaired the single dead rail by soldering its feeder wire. I had unknowingly severed the wire with a quick-splice clip when attaching it to the bus wire yesterday. Here’s the repair:

I had already severed another feeder with a quick-splice clip, but I realized I had done it right away, so I was able to repair that as I was wiring the rest of the module.

Because I already had the module tipped up, I figured it would be a good evening to start wiring the Switch-Kats. These are simple decoders that connect to the bus and give each turnout a DCC address. This will allow me to select each turnout with the controller and it will translate my inputs into “switch left” or “switch right.”

I mounted the Switch-Kats using plastic standoffs, as I had done with the Arduino, and situated each one a few inches from the wire leading up to each respective turnout. I angled most of them, as I will need to access the “top” end to insert a jumper wire when putting them into “program” mode.

Here they are before wiring them to the turnouts:

And here they are, wired to the turnouts:

And here they are connected to the bus wires:

I still need to add some anchors to keep wires secure, but otherwise I think I’m done with all “under the table” wiring. I will be adding a couple of holes on the back to run power cables through; this will allow me to anchor them a bit more securely. I’ll also be adding a hole on the right side to connect the bus to the next module. I will wait to tackle this project until the fascia has been added to the back.

Now it’s time to program the Switch-Kats and reprogram the Arduino, and LSR will be back in full operation.

Running Again

I spent four or five hours this weekend wiring up the track, sans the turnouts and turntable, which I will likely get around to later this week.

Engines are running without any significant issues except for a dead rail on the far side of the turntable where the engine shed will be; so I need to re-wire the feeder to that rail. I will post pics of the underside of the module when I’m repairing that.

For now, let this picture of my super helpful cat suffice (she fell asleep on my screw-gun case while watching me test the engines):