Peco Country Station IV: Interior

I spent most of the day fussing with Photoshop and an X-Acto knife, building a cardstock interior for the station. I don’t think most modelers go through this kind of detail-work, but I’m determined to have buildings that appear occupied, rather than looking like empty shells.

img_2742.jpg

img_2743

img_2744.jpg

It’s difficult to take photos show that show the effect, especially at night when the lighting is dim. The best I could do is take a couple of flash photos to show the finished interior.

img_2745

img_2746

I also repainted the platform because I didn’t like the uniform “Flat Dark Aircraft Gray” that I had used. I taped off the edging, then spray painted the platform with Rust-oleum “Chalked Charcoal”:

Peco Goods Shed I

For my second structure, I cracked open the Peco Goods Shed. This one will be fun because the doors can be arranged in an “open” position, offering viewers a peek inside. I will be detailing this kit with boxes, barrels, and sacks. 844fbf3a-e579-4ff2-b8ed-af679ae468ba-11158-000006f1c9419dd8_file

Not all was well with the kit, though. There were a few parts missing from the sprues that held the brick facing for the foundation. The Peco Lineside boxes are pretty flimsy and the kits aren’t bagged, so there is nothing stopping a flat part from sliding out of a closed box.

I considered returning the kit for a new one, but I cut my losses after noticing how unrealistically large the bricks on the facing are. I will be replacing them with cut-up facing from my extra platform kit, which sports bricks that are much more realistically proportioned. Here’s a comparison:

img_2738.jpg

This is adding a bit of time to the kit, but I think the results will be worth it.

The white goop is Testors Contour Putty, which I used as a filler. Once it dried, I shaped it with a knife and sandpaper, then painted the entire foundation:

Peco Country Station III

Not much progress on LSR since motorizing the turntable, but I’ve worked out a few small projects on the station and platform. For starters, I finished painting the platform:

3e0d172d-0bcc-49f9-9b67-c705277ab38a-11158-000006ef164bac7a_file

The surface won’t always be so gray; eventually I will use weathering powders to give it a lot of grit.

I have also put last year’s cardstock experiments to good use, and have made a simple interior for the station. This way, when light shines through, or when someone is scrutinizing the model closely, they won’t see bright brick-red plastic walls and super-wide window and door casings. Instead, they will see a wood floor, wainscoting, doors, a fireplace, and a few interior walls to break up the “empty shell” appearance.

To get the basic measurements, I photocopied each end of the station, then ran these through Photoshop to add details and textures. All of the images were found using Google image search.

Station Interior

Turntable VIII: Microstepped

Trying to get the turntable to rotate more slowly while remaining smooth turned out to be a challenge. When slowed down, it began ticking like a clock with enough torque that it would likely have flicked an engine off the deck. My brother-in-law and I spent a couple of hours last night trying to figure out a solution, to no avail. After that I stayed up way too late digging through Arduino forums, trying to figure out how to add a microstepping sequence to break up the “tick-tock” movement into much smaller waves. I went to bed thinking all that research was for nothing.

When I woke up this morning, though, I had the sudden idea that maybe the Adafruit motor shield has a library with a microstepping sequence already loaded. This would save us from having to make calculations and then pull in (or invent) strings of compatible code from other sources. So, after a quick reread on Adafruit’s informational website I verified that, indeed, the Adafruit is already programmed to run a microstep sequence.

Lo and behold, all I did was replace instances of “Single” with “Microstep,” uploaded the code to the Arduino, and suddenly the turntable is slow moving and smooth.

Here’s a video of the turntable moving slowly and smoothly.

I think we can adjust the code further to give the turntable a more realistic appearance by accelerating and decelerating the deck every time it moves. For now, though, I am happy with how it functions, so am posting the code here in case anyone else can make use of it:

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

#define DCC_ADDRESS 6 //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 14 Stepper Motor has a 0.9 degree/step. 360/0.9 = 400.
Adafruit_StepperMotor *myMotor = AFMS.getStepper(400, 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(200, 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 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(200, FORWARD, DOUBLE); //Move 180 degrees in the specified direction.
//delay(5000);
}

Turntable VII: Motorized!

The stack is in place and wired up.

Initially I had some issues loading the code into the Arduino, and finally worked it out with my brother-in-law’s guidance. I’d been loading it correctly, but a command was missing that caused the motor to remain unresponsive. Once that was sussed out the turntable started working without much of a problem, at least while it was powered via USB.

An issue arose when I powered the Arduino with 12V DC. When the motor was running on that voltage, it got sizzling hot and moved erratically when activated. However, when I switched back to the USB cable (which is regulated at 5V) it worked perfectly fine.

We are working on that, and then we will be keying in a slower speed. Ideally the deck will rotate at 1 rpm, but it is currently closer to 4-5 rpms. Overall, though, I am very excited and relieved that it is able to run!

Here’s a video of the turntable in action. You can see both the 180-degree rotation as well as the 0.9-degree nudge (just in case the deck goes out of alignment).

Edit: I think I’ve pinpointed the issue with the DC supply. While the motor indicates that it is a 12V motor, to be safe we should have calculated Ohms Law, which tells us that a  source should never exceed I=V/R (or “Current” equals “Voltage” divided by “Resistance”).  Any more than that and the motor will draw too much when idle (it draws the most voltage while holding). My brother-in-law and I both assumed that the motor shield would regulate the voltage.

For my motor (as per the specs listed on the packaging:

V=0.5A
R=17 ohms
I=0.5×17
I=8.5 volts

Thus, according to Ohm’s Law we don’t want the voltage to exceed 8.5 volts. I guess that is what the motor specs mean:

“Each phase draws 500 mA at 8.5 V, allowing for a holding torque of 7Ncm(10oz.in) … Rated Current/phase: 0.5A … Phase Resistance: 17ohms.”

To be honest, that’s mostly Greek to me, but the numbers align with my math.

I’m not too concerned with torque (because there isn’t much weight or resistance on the turntable) so 5 volts should be plenty. The motor has been working just fine on the 5V USB, but I would prefer a straight DC supply because I may decide to add a USB extension between the USB port and the fascia.

Turntable VI: Programming the Stack

Between random Saturday chores, I soldered the pins of the Adafruit Motor Shield. Prior to that, I had to squeeze the shield sideways for the Power light to signal. No big deal; just a bit more soldering than I expected.

From the DCC shield, I also pulled off the vestigial jumpers and those that would route power differently than needed. A few of the pulled jumpers were educated guesses, and (given the “educated” bit) I followed my brother-in-law’s lead.

The Arduino and both shields are now fully powered using either DC or USB. I had the option of powering it all from the DCC bus via the DCC shield, but I’m nervous about how much it would draw and possibly affect the performance of locomotives and switches. Thus, there will be two DC cables powering the layout.

My brother-in-law also had a great idea: I could add a USB extension that would lead to a panel on the front of the module, so I can simply plug my computer into that to program the turntable. In the future I may do that.

Anyhow, I loaded my brother-in-law’s sketch_turntable document into the Arduino library, so as far as I know the Arduino is now programmed.

Theoretically, choosing “Accessory 6” on the PowerCab should select the turntable; then pressing 1 or 2 will move it clockwise or counterclockwise 180 degrees. Choosing “Accessory 7” will also select it, but subsequently pressing 1 or 2 will only prompt it to move a single click.

We aren’t too optimistic about it working at this point, but I plan on wiring it up tomorrow to find out.

Edit: Once we have the code finalized, I will post it on this blog for safekeeping, and to share with others who may be interested.

Turntable V and Engine Shed Track

Spent about an hour soldering feeders to the turntable, and then soldered feeders to the track that will eventually lead from the turntable to the engine shed. It all works flawlessly.

Now, every inch of track is powered.

Next up, I will be continuing to work with my brother-in-law to configure the Arduino shield-stack, then will start programming.

Functionality of the Arduino will be super-simple (although I could make it more complex later on). The turntable will be selectable as an accessory (just like the switches), and will be able to turn 180 degrees clockwise and counter-clockwise with the push of a single button on the PowerCab.

By selecting a different address, the turntable will enter “nudge” mode. This way, if I need to align the deck with the tracks, I can nudge it a single click clockwise or counter-clockwise (the stepper motor moves 400 clicks with every rotation.

I’m hoping to start programming the Arduino tomorrow.

Track Repair and Turntable Polarity Test

In my excitement after securing the turntable motor last night, I turned the module over and knocked it against my knee (I tend to work on the floor). Normally that wouldn’t have been an issue, except my knee struck the excess rail that extends beyond the module surface, where the fascia will eventually lengthen the module a bit.

That made for a big mess. The rails popped right off the ties and bent upward, severing forty or fifty plastic “rail spikes.” There was nothing I could do except replace that length of track. Here’s the damage:

So tonight I pulled out the soldering iron and desoldered the feeders. Then I pulled the track up to the first turnout and laid a new length of Flex-Track in its place. After gluing it down, putting some weights on, and soldering the feeders on, it looks like new.

After that repair I needed to do something a little more exciting, so I temporarily wired the turntable up.

I was afraid the locomotives would get hung up on the gap between the approach track and the turntable deck rails, and I was also afraid that the polarity of the tracks wouldn’t switch when rotating the deck.

For those who are unfamiliar with Peco’s turntable, I may need to explain this “polarity” piece a bit. The reason I opted for Peco’s turntable instead of another plug-and-play turntable is because it has a genius system for switching the polarity of the rails whenever the deck makes a full rotation.

This system depends on two separate brass collars beneath the turntable deck. Two spring-loaded brass plungers move across the collars when the deck rotates. Each plunger conducts electricity up to one of the two rails, and after both rails pass over the gaps between the collars, the polarity reverses (i.e. the positive rail passes over the negative collar and vice-versa). If this didn’t occur the layout would short out every time the deck made a full rotation.

Another benefit of the polarity changing is that a locomotive moving forward onto the deck can be turned 360 degrees and continue to move forward off the deck. It doesn’t matter that it just came from that direction; with the reverse in polarity, the locomotive still registers as moving forward.

Good news all around: the locomotives can get on and off the deck with no extra effort, and the polarity changes as it ought to.

Here’s a video of the turntable in action. Pretty soon, my hands won’t be needed except to push a button on the DCC controller. Next up, I hope to begin working on the software and hardware that will allow me to do just that. On that note, my brother-in-law sent me some documents and instructions earlier today, so I have some reading to do.

Turntable IV

Well, it isn’t pretty, but after a whole lot of head-scratching and futzing, I now have the stepper motor attached to the turntable, and am able to rotate the turntable deck with minimal friction.

As you can see here, the biggest initial obstacle was the mass of wires and switch motors. To clear them, I had to extend the mounting beam a foot longer than expected. Once in place, I drilled the hole for the motor, then sanded it out a bit.

Yep, pretty much like that. At this stage I could tell there would be some friction issues to deal with between the deck and the well. Both components are plastic, and the slightest lean in the pivot mechanism sends one side of the deck screeching to a halt against the wall or floor of the well. I sanded some of the well, then I filed down the underside of the deck ends. That helped a little, but I could tell I’d need to place some shims under one end of the mounting beam.

Before I got into fine-tuning, I wanted to make sure everything was situated and solid. I attached the motor to the mounting beam with a couple of machine screws.

I then used CA glue to fix the iron axle inside the deck. Now the deck can be dropped in and pulled out at will by loosening or tightening two small inset hex bolts on the shaft coupler.

After putting a couple of shims between the baseboard and the mounting beam (to reduce a lean which caused one side of the deck to dip down while the other lifted), the deck could be moved slowly and without much friction.

Turntable III

Today I cut up and glued together a modified configuration of the Peco Setrack Platform System and started painting it:

It’s not much, but it’s progress.

The main reason I am writing this post is to start talking about the turntable mechanism.

Remember last year when I asked Peco about the DCC turntable motor that was slated for release in 2016, and they told me it would be released later in 2017? Well, it wasn’t released in 2017. When I asked them about it more recently they told me they were having some technical difficulties with the indexing, but assured me that it was slated for release in 2018. They thanked me for my patience.

I do have patience, but I’ve come to realize that I don’t have much faith in Peco’s ability to manufacture a motor that will work well. Judging by the prototype, there will be modifications necessary to mount the motor directly to the underside of the turntable. Also, the motor probably has a gearbox, which probably has plastic gears, and that means it will not be very accurate (especially an earlier model, while the kinks are being worked out).

So, I reached out to my brother-in-law and told him what I needed to do, and asked him to guide me through the hardware and software setup of an Arduino-based, DCC-interfaced turntable motor. He knows far more than I do about circuitry and programming–it’s what he does for a living.

After a few days he gave me a shopping list:

  • Arduino Uno
  • Adafruit Motor Shield
  • Iowa Scaled Engineering DCC Shield

 

To power the Arduino, I sourced a power cable from the electronic graveyard at my office. The motor shield stacks right on the Arduino and drives the motor via jumper wires. The DCC shield (which is slated to arrive next week) will translate commands from the DCC controller to the Arduino, which will then tell the motor shield what to do.

I got the Arduino and motor shield today:

As you can see, I also got a stepper motor, a 4mm to 5mm flexible motor shaft coupler, and a 4mm steel rod.

Figuring out a mounting system for these mechanical components will be my primary goal for the next few days while I wait for further guidance from my brother-in-law. The mechanism may look something like this:

unnamed

So, although it doesn’t seem like it, there’s quite a bit of activity happening underneath LSR, and if all goes as planned, I will have an indexed, programmable turntable soon.