Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Front_049
“I have this train I bought in Germany,” said Lynn, who approached me at a train show, “and I’m looking for someone to build a railroad for me.”
I visited her a few days later, and found that she had a Märklin Mini-Club Z scale train set, track, and accessories. She had purchased it in 1978 as a gift for her father. (At the time, Z scale trains were the smallest commercially available.) After he passed away, the train had come back to her. She had never seen it run, but wanted an operating railroad in time for her retirement party. I agreed to build her a 15″ x 31″ tabletop railroad, with less than five months to get it done.

Locomotive

Cleaning and testing Lynn’s locomotive, still in its very battered original box, was an early priority. How long ago had it last been operated? Had it ever been lubricated or cleaned? Had the motor been fried by 12V power?

In 1978, this was the smallest model locomotive manufactured anywhere in the world. After I cleaned some crust off the wheel treads, it ran fine.

In 1978, this was the smallest model locomotive manufactured anywhere in the world. After I cleaned some crust off the wheel treads, it ran fine.

I cleaned a section of track, connected power, and nudged the engine along. At first, there was no response. Touching the terminals of a 9V battery directly to the wheels got them to turn a little, and over several rounds of cleaning-and-powering, the engine was able to run on its own. Later, I cleaned some lint out of the gears, and applied a few drops of oil to the proper spots.

Electronics

Railroad construction started with the throttle. In the box with the train was an old N scale 12-volt power pack, just like the one I used 30 years ago. Z scale operates on a maximum of just 8 volts. If you’re careful not to turn the handle more than two-thirds up as you run the train, the power pack works. If you forget…pffffft. After explaining the situation to Lynn, I offered to build an 8-volt throttle, based upon an Arduino, into the layout. (I was perhaps a little vague on the list of features I had in mind for it.)

This project looked like a good application for motion sensing. There’s not much for a train to do on an oval of track except go round-and-round. With a motion sensor, the throttle can stop the train if there’s nobody in the room, and start it again when they return. I had already experimented with Parallax’s motion sensor, but it’s not really designed for permanent installation in a finished project. A little research turned up the Panasonic 32111, which has a wide detection pattern, digital output, and a black body that discreetly protrudes through a modest hole in the front panel.

Another feature I wanted to include was a combination speed and direction control. The idea of putting train speed and direction together in a single knob seems obvious, but for some reason, it’s rarely been done in model railroading. With the Arduino, the job is easy–translating knob position into speed and direction is a matter of programming. The control uses a 10K-ohm potentiometer with a center detent, just like the equalizer knob on a stereo. Turn the knob to center, feel the “click,” stop the train.

Arduino-based throttles frequently make use of motor shields, but I had other uses for the Arduino’s I/O pins, and only one motor to control. I opted instead to use a L293D chip, which can handle about 400mA current (plenty for Z scale), and comes in a DIP package that’s easy to use with a breadboard or perfboard.

My Arduino throttle shield. Major components, clockwise from upper left: L293D motor controller, 10-pin socket for front panel, screw terminals for lighting and light-sensor, 2N2222 transistors for lighting circuits, 0.4A polyfuse for track power, screw terminals for track power.

My Arduino throttle shield. Major components, clockwise from upper left: L293D motor controller, 10-pin socket for front panel, screw terminals for lighting and light-sensor, 2N2222 transistors for lighting circuits, 0.4A polyfuse for track power, screw terminals for track power.

Next up: the indicator light. These days, what’s an electronics project without a full-color flashing light? The status indicator in the center of the panel uses different colors to indicate the state of the layout: red when stopped, green when running, white when sleep mode is enabled, fading to purple as the layout approaches sleep, blue when the layout has “fallen asleep.” To be honest, controlling the RGB LED uses as many I/O pins and lines of code as controlling the train itself, but it does add a fun visual element to the railroad. The throttle circuit also includes two structure-lighting circuits, each with a 2N2222 transistor capable of driving several LEDs.

Using a SparkFun ProtoShield PCB as the basis for a throttle shield, I assembled the motion sensor, potentiometers, and LEDs onto a perfboard for testing, and connected it temporarily to the Arduino, to which some test code had been uploaded. After I added a 10K-ohm pulldown resistor to the sensor’s output, the circuit worked exactly as intended.

Panel_092

Once the user-interface components were assembled on their board, I drew up the design for the front panel, which Front Panel Express machined from 2mm anodized aluminum. When it arrived two weeks later, it looked great and fit perfectly.

Woodworking

The throttle and its panel were now complete. Finally, it was time to move on to the carpentry. Why did I wait this long to begin work on the layout itself? Simple–I wanted the throttle to be an integrated part of the layout. The railroad, in short, needed to be fitted to the front panel, which in turn needed to fit the throttle circuitry. Sounds backward, but it’s a planning strategy that has worked well for me in past projects. Besides, the woodworking is easy. I build furniture for a living.

Building a small tabletop railroad is not much different than building a drawer box, really. For the fascias, I used solid red oak, choosing lumber with particularly strong grain patterns. My usual joinery technique is rabbets at the corners, and a dado to hold the deck. Rabbets offer enough glue surface to ensure a joint that will stay together. Since my dovetailing jig was sitting in front of me, however, I opted for the more decorative look of dovetailed corners.
I like to recess panels about 1/4″ or so into the fascia. It not only looks good, but reduces the chances of panel components being snagged during operation or transport. The recess for the front panel was done with a plunge router, a straight bit, and a collar. During routing, the collar runs against the edges of the template, and the result is a precisely-sized rectangular recess with perfectly straight edges.
The deck was milled from 1/4″ medium-density fiberboard (MDF). Because MDF has none of the internal stresses of plywood, it lays perfectly flat, and stays that way so long as it’s properly braced.

The freshly-finished carcase is ready for railroad.

The freshly-finished carcase is ready for railroad.

After the basic box was assembled, I installed the stream bed, and a pine stiffening member to the underside of the deck. Corner blocks were also milled up and installed, to provide places for attaching plastic feet later.

Finishing was easy. I handed it off to a co-worker, who (with the boss’s prior knowledge and consent, of course) applied Lynn’s choice of stain, then sprayed the same lacquer finish used on the company’s furniture products. After finishing, I installed the feet, then the front panel and its circuit board.

Track

Two essential, yet often overlooked, tools for quality tracklaying: pushpins and canned tomato products.

Two essential, yet often overlooked, tools for quality tracklaying: pushpins and canned tomato products.

I now had a clean, flat deck, ready for railroad. I used spray adhesive to attach strips of cork along the right-of-way. After carefully inspecting Lynn’s Märklin sectional track, I laid a bead of foamboard adhesive on the cork with a caulking gun, troweled it smooth with a palette knife, and positioned the track. I found most of the curve sections to be a little over-curved (whether from manufacturing or past use, I’m not sure). Without some straightening, they would tend to kink at the joints, and cause trouble later during operation. Liberal use of push-pins ensured that the track flowed smoothly. The adhesive took several hours to dry, so there was plenty of time to adjust the alignment of the track until everything is straight and smooth.

Scenery

To build a mountain on a model railroad, it’s best to start from the inside. The track and roadbed in the tunnel area were given a quick coat of black paint. The tunnel cavity was marked out a piece of blue Styrofoam, cut with the bandsaw, and also painted black. The upper layers of the mountain were laminated with spray adhesive, the access hatch cut out, and the rest of the mountain glued into position.

I did rough carving on the Styrofoam scenery with a hot-wire cutter, slicing it away in thin layers. Some work with 36-grit sandpaper refined the contours. I didn’t worry about minor gouges or roughness in the surface; the ground cover would take care of that. Large imperfections were filled with Sculptamold.

I cast rocks from plaster, broke them up, and reassembled them into outcroppings adjacent to the tunnel portals. After the adhesive dried, a little Sculptamold tuck-pointed into the seams blended the pieces together. The rocks were given a mixture of browns and grays, a black wash coat, and a little dry-brushing with white to pick out the highlights.

A little work with an airbrush helped bring the pond and the rock outcroppings to life.

A little work with an airbrush helped bring the pond and the rock outcroppings to life.

Before the stream and pond were poured, I filled the stream bed with strips of Styrofoam, which then was carved, sanded, and patched as needed. A thin layer of watery plaster in the pond bed smoothed it out. I airbrushed the pond bed gradually to black at the center, for the appearance of depth. A few tablespoons of gravel from the park, secured with white glue, gave the stream bed some nice, chunky texture.

The stream and pond were created with EasyCast, a two-part clear resin available in craft stores. I placed the layout on a level surface, made sure the stream bed was fluid-tight, and dammed up the front edge of the layout with a scrap of foam. The mixing procedure whips fine bubbles into the resin, which may be expelled just after the pour simply by breathing lightly on the surface. Full cure time is 72 hours, but I’ve found that that the resin is no longer tacky after 24 hours.

A layer of ground foam helps transform a lump of Styrofoam into a little slice of the Bavarian hills.

A layer of ground foam helps transform a lump of Styrofoam into a little slice of the Bavarian hills.

While waiting for the resin to cure, I started winding armatures for the trees from about 5 turns of 26-gauge steel craft wire. Half the loop was twisted tight into a trunk, the other end of the loop was snipped, and the strands splayed out into branches. The armatures were dunked into a can of flat latex, and poked into a scrap of Styrofoam to dry. After the paint dried, foliage was added with green polyester fiber, hair spray, and ground foam.

Once the resin was fully cured, the ground cover was applied, the tunnel portals installed, and the trees “planted.” The throttle shield, with an Arduino Leonardo, was permanently attached to the underside of the railroad, and a light sensor installed between the rails to detect the train’s presence at the station. Adjustments to the Arduino code enabled me to tailor the throttle to the characteristics of Lynn’s locomotive.

Station

Do you suppose the seasoning packet is still good?

Do you suppose the seasoning packet is still good?

The Märklin Wintersdorf station kit had been in the box for 35 years, still on the sprues. The parts came molded in four different colors, but I repainted some of them to improve the station’s appearance. (The red of the clay-tile roof looked too bright, for example, so it received a more faded terra-cotta color.) I partially assembled the station, but left the foundation and roof loose for the moment.

For lighting, I cut a piece of perfboard to fit in the first floor, and soldered on surface-mount warm-white LEDs and resistors. With some wire “legs” soldered to the corners of the board to hold it at ceiling height, I tucked the circuit into the station, along with some black-paper baffles to confine the light to the proper “rooms.” The foundation and roof were attached with a non-solvent adhesive, which ensures that the station may be opened up again for any further work.

A last-minute addition to the lighting plan was the “disco” light. Everybody loves lighting effects on model railroads–crackling fires, arc welders, emergency-vehicle flashers, and so on. I installed a fast-cycling full-color LED  on the perfboard, powered directly from one of the Arduino’s digital pins. At three-minute intervals, the regular room light blacks out, and the disco light cycles through its colors for several seconds. I didn’t breathe a word of it to Lynn when I delivered the railroad.

Delivery

With the station installed, the railroad was ready for the party. I set it on her coffee table, plugged it in, positioned the train, and twisted the throttle knob. The engine required nudging for a few laps, until the rails were polished up. Lynn was delighted.

As we entered her dining room to review the other party preparations, the status light went purple, then blue, and the train stopped in front of the station. “How do I turn it back on?” she asked.

“Just walk toward it,” I told her. She got within 8 feet of the railroad, and the train started in motion again.

Lynn's railroad in its new home.

Lynn’s railroad in its new home.

At the party, the railroad was a hit. It didn’t take long for the disco light to be discovered. Lynn’s locomotive ran beautifully throughout the evening, but the crowds milling about the railroad gave almost no opportunity to demonstrate the motion-sensing feature.

http://youtu.be/wyJeBGPYib4

Jeff Faust

Jeff Faust is a professional woodworker by day, and an intractable model railroader by night.


Related

Comments

  1. Jason says:

    Easily one of the best projects Ive seen in a while. Love it.

  2. Michael C. says:

    This is a really cool project. I love all the features and the associated attention to detail to each one. Serious kudos to a job well done!

  3. wow, i loved this article and all the work and devotion that went to that train set.

  4. ameyring says:

    Very nice and inspiring to those of us who are looking for compact ways to make train layouts.

  5. mark says:

    it was a nice job bringing out the old train set and making it lively with electronic parts, knobs and gadgets..i love the disco lights in the train station.. i love most the design of the diorama.. looks cool, and nature filled also..even the emergency opening through the tunnel, better to have that in case it got stuck.. great job!

  6. Eric Faust says:

    From one Faust to another! Very well done my kinsman. I love trains, too. I greatly admire your magnificent project AND your gift of narrative prose. Thank you. Eric Faust.

In the Maker Shed