Category Archives: Electronics

WiThrottle and DCC++

One of the major design points for my shelf switcher layout is a compact way to power it.  Well, I pretty much have that ready now.

I put together a DCC++ Base Station using an Arduino MEGA board, an Ethernet shield and a Pololu MC33926 motor shield, then I added a TP-Link TP-WR802N pocket router for wireless connectivity.  I then worked on the software a bit, and added the ability for the DCC++ Base Station to communicate with the WiThrottle (or Engine Driver if you’re Android) app on my iPhone.

Now, when I install this in the shelf layout, I’ll be able to control the trains from my phone for a pretty low price…

Here’s a video of the gear in action…

Atlas MP15DC Decoder Install

Atlas MP15DC Decoder Install
I recently purchased this used Atlas MP15DC, and of course it needed a decoder. Since I’ve been more or less standardizing on Digitrax for my “run of the mill” decoders, I chose the Digitrax DN163A3, which is a “drop-in” version for this locomotive. TCS also makes a drop-in decoder, and of course a wired decoder can be used.

At low speed, this is one of the smoothest running locomotives in my fleet, even with the factory-default motor settings. There is an audible whine at higher speeds, but… this is a switcher. It’s not supposed to run at high speeds.

The install is so straightforward (and so typical of modern Atlas locos) that I won’t go into much detail here.

  1. Remove the shell
  2. Loosen the two frame shell screws
  3. Slide the light board out of the frame
  4. Place the decoder in the frame, with the large, wide end facing away from the cab end of the loco. Make sure to place it component side down, or LEDs up.
  5. Tighten the frame shell screws
  6. Replace the shell

The most important part of the install is to make sure the components face down when placing the decoder in the frame. The fit between the decoder tabs and the frame slots was quite tight, and required some force to get the frame to close up. If yours is loose, adding a little bubble of solder to the pads can take up the free space.

I also read in another install description that sometimes the motor tabs need to be trimmed or filed down just a bit to avoid incidental contact to the wrong tabs. I did not find this to be necessary on my loco, but be advised.

There was one thing that caught me off guard that I have not seen documented elsewhere, at least not with descriptive photos. There is a black piece of plastic inside the cab area of the shell that acts as part of a light guide for the rear headlamp. This piece is only press-fit, and seems to be able to fall out easily. Since I wasn’t expecting the part to fall out, I did not see where it fit originally, and it took some time to figure out where it went and how it fit into the loco.

To save you the trouble, here are a couple of photos:

The part is circled here.
Atlas MP15DC Decoder Install

This is where it goes… oriented upright like a chair, with the clear light guide poking through the hole in the black part.
Atlas MP15DC Decoder Install

One more tip… it’s easier to keep this light guide part in place if you flip the shell upside down and insert the frame into the shell, rather than placing the frame upright and putting the shell over it.

HTH!

February Progress Update

I’m a little surprised that it’s been over a month since the update video! Looks like I should be getting the camera out again. Progress has been slow, and not always photogenic, but there have been a few changes worth reporting on in the last six weeks. Lots of “real life” things going on right now that are keeping me from moving forward, but even slow progress is progress!

This post will be something of a mixed bag of content, since there are several different work items going on, and I feel I need to get the blog caught up quickly.

Structure Mock-Up

First up, this is a construction paper mockup of the Commonwealth Paper Products structure that will be on the narrow shelf behind the entry door.
Commonwealth Paper

I drew the building structure in SketchUp, and then printed 2D views of the model to glue onto a core that I built from cereal boxes. I think it’s a pretty convincing stand-in, and I plan to do these for many of the structures on the layout.

Custom Electronics

Next we have a couple of different electronics projects… a trio of CDU-based Kato turnout controllers that I built for a friend, and the completed control circuit for my animated swing gate.

Kato Crossover Controls

The CDUs are based on an integrated design I have that incorporates a switch and indicator LEDs, but my friend wanted to mount these remotely from his control panel, so I provided connectors for the switch and LED. These are a very simple design (not mine, just adapted), and the selected capacitor is powerful enough to handle a double crossover.

Stepper Motor Control

The swing gate control board has screw terminals for all of the motor, sensor, and control connections, and sockets for an Arduino Pro Mini and a stepper motor driver. This is ready to hook up, once I solve the mechanical issues with connecting to the shaft of the swing gate itself.

New Power

CXST1141 Atlas MP15DC

This is the latest addition to the power roster, an Atlas MP15DC that I bought second-hand from a friend and that will be used in the yard. It’s DC for now, but I will upgrade it to DCC soon. I’ve tested it on the branch line, and it runs quite well.

Dixie Cup Factory Model

I’ve built up a SketchUp model of the Dixie Cup factory as well…

Dixie Cup Mockup

Dixie Cup Mockup

Dixie Cup Mockup

New Lighting

Finally, I replaced the ceiling fan in the room with a much, much brighter 4-tube fluorescent lighting fixture with 5000K daylight tubes. It’s almost too bright in here now!

New room lighting

As part of the lighting upgrade I also moved the wall switch for the room down below the layout deck. The “standard” switch location was behind the backdrop and would be impossible to reach once scenery was in place.

New room lighting

The new wall switch incorporates a very convenient outlet that will help with working on that part of the room.

That’s all for now! I have some track laying progress to report, but I will include that in a separate post after I take some better pictures with the new lighting.

Having the Right Tools

Wow. I only just realized that my mobile app hasn’t actually been publishing any of the posts I’ve been writing. So I’m a little bit behind.

Anyway, tonight’s thoughts revolve around having the right tools. A week or two ago I had to assemble a couple of circuit boards. Tiny SMT stuff. I have a good soldering iron, but the tip was a bit large. Some old goopy rosin flux, and a couple of really cheap tweezers. Let me just say, it was not a pleasant experience.

Tonight, it was time to build a few more. Fortunately, this time I had a new, smaller tip for the iron, some high quality no-clean solder flux paste, and a pair of high precision curved-tip tweezers.

It was a breeze!

Another version of the same story… I’ve spent years trying to hack together carpentry jobs using a jig saw and a hand-held circular saw. Not so good. Fine for rough carpentry, but not for display-quality stuff like a nice model railroad shelf.

Enter the table saw. Clean, accurate cuts, made quickly.

Now, the table saw was a large investment. I’m not really here to advocate spending a pile of money. But the tweezers, flux paste and iron tips were a total investment of about $10.

The right tools are worth their weight in gold, but they don’t have to cost a fortune. Don’t waste your hard earned dollars on cheap tools.

Not So Easy-Peasy Lighting

Untitled

Having just purchased some new passenger equipment, I decided to add some lighting. Rapido Trains has a very nice kit for just this purpose. It’s called the “Easy Peasy Lighting Kit” and frankly, it’s the bee’s knees when it comes to lighting passenger cars.

Rapido Easy-Peasy Lighting System

The kit consists of a battery-powered light board that you install in the roof of the passenger car using double-sided tape (not provided) or your favorite “other” means of attachment, and a magnetic “magic wand” that is used to turn the lights on and off. There is a magnetic reed switch in the center of the board. When you bring the wand near the car roof, the lights come on. Bring the wand near the roof again and the lights go on. The system doesn’t require track pickup, so you don’t have to worry about DC vs. DCC or metal wheelsets or loading down your booster or power pack with lighted cars.

On the other hand, the batteries will eventually die, and if you used a strong adhesive (like I mistakenly did), replacing the batteries could be a bit tricky.

Installation in most passenger cars is pretty easy. You just install the batteries, pull off the car roof, tape the board in place, and replace the roof. Done. Here’s the board installed in a Con-Cor Union Pacific smooth-side coach…

Rapido Easy-Peasy Lighting

… and the same car in the dark…

Rapido Easy-Peasy Lighting

All is not dandelions and lollipops, though. I bought these boards to go inside some old Rivarossi varnish that I had repainted for the CH&FR Railroad. To my chagrin, I discovered that the board does not fit in the cars. On all three cars (coach, diner and Pullman), the clear plastic ends of the roof/glazing part are too close in, and the board is too long to fit between the ends. In addition, on at least the coach, the bathroom walls on both ends of the car are too high to allow the batteries to fit inside the car.

Rapido Easy-Peasy Lighting System

Rapido Easy-Peasy Lighting System

Clearly some modifications are required. The diner and Pullman are going to have to be modified fairly significantly, so I will cover them in a later post when I’ve figured out how I want to do it. I will document here how I made the lighting fit in the coach.

The first step was to shorten the length of the light board enough to fit inside the roof-and-glazing part of the coach. To do this, I used a razor saw to trim as much of the battery end of the board off as possible. I got right up against the battery holder here, so much so that you can see I opened up the hole for the one of the battery holder legs. This is a tad risky, so use good judgement.

Rapido Easy-Peasy Lighting System

This is almost, but not quite enough to make the board fit. Unfortunately, the other end has a fairly narrow but important circuit trace around the end, so cutting it with a saw would be dangerous. Instead, I used some 300-ish grit sandpaper to file down the end just a smidge, enough to make it work.

Rapido Easy-Peasy Lighting System

Alternately you could cut the board with the saw, breaking the trace, and then solder a wire to re-establish the circuit.

Now the board fits lengthwise, but we still haven’t solved the “too tall battery” problem.

Rapido Easy-Peasy Lighting System

To make room for the batteries, I used the razor saw to trim 1/8″ off the height of the bathroom walls on one end of the car’s interior part, and then sanded the cut edge smooth. This frees up enough room for the batteries, but leaves the walls tall enough to look OK through the windows.

Rapido Easy-Peasy Lighting System

Finally, after a test fit, we add the tape and reassemble the car.

Rapido Easy-Peasy Lighting System

And that’s pretty much it. Voila! … almost…

Rapido Easy-Peasy Lighting System

The custom paint job on these cars didn’t include the roof, which I elected to leave the original silver. Trouble is, as you can see, the paint has worn thin in spots, so I’ll have to repaint it to keep the lights from bleeding through.

Rapido Easy Peasy Lighting

This isn’t a perfect solution. The foam tape I used is pretty high-adhesive. Probably too high. I’m quite concerned that I’m going to have some trouble when it comes time to replace the batteries, especially since I carved off all the “wiggle room” on the battery end of the light bar. I might actually find myself buying another car to scavenge a new roof from it, if things get bad enough.

In hindsight, it may have been better to cut the ends off the roof/glazing part to make room from the bar instead of shortening the bar to fit in the roof. I could easily have added some thin clear plastic to re-glaze the car ends. But, the car is lit and ready to go, once I replace the couplers again.

I’ll also point you to Mike Fifer’s succinct how-to on installing these lights in a Micro-Trains Heavyweight car.  Notable differences (and I should have listened to Mike!) are that he wraps the LEDs and the light spreader in tape to stabilize the board, and he doesn’t secure the board to the roof, instead just letting it rest on the tops of the seat backs.  That latter difference will certainly make battery replacement easier.

The CH&FR Goes Digital Part 7

[youtube=http://youtu.be/pGdrG5i_q1I]

Today we present the long-awaited (I hope!) Part 7 of my “The CH&FR Goes Digital” series.

This episode dives into block detection using the Digitrax BDL168 16-input block detector.  We cover track setup, wiring, connecting the BDl168 to your computer with JMRI, and provide a live demo.

Block detection is what we call “knowing where your trains are”, and it works very similarly to how the real railroads do it.  The layout is divided up into electrically separate segments, or “Blocks”.  Each Block is a section of track where you want to be able to tell whether there is a train on that track or not.  It might be a siding, or a length of mainline track, or (less likely) a track in a yard.  The Block is electrically isolated from all the other blocks, and the power feed to one rail is fed through a block detector like the BDL168.

When a locomotive sits on that section of track, even if it is not moving (under DCC) a small current flows through the locomotive’s decoder from one rail to the other, and the BDL168 can detect this current flow.  When it sees the locomotive’s current draw, it reports that section of track as “occupied”.  If there is no current flow, the BDL168 will report “unoccupied” for that track section.

Of course, on the prototype railroad, the trains provide their own power, but the block detectors are able to work very similarly.  By inducing a voltage between the rails, the detector can watch for the metal wheels of the train to short the rails together, indicating that the track is occupied.

On the model, without a little work, we can only detect the presence of locomotives.  Most model railroad cars (in N scale at least) come with plastic wheels which do not conduct.  On the few which come with metal wheels, the axles are insulated to prevent the car from shorting out the track.

By adding a small resistor to one wheelset on each car, the entire train can be detected, not just the locomotive.  One of my favorite videos on how to add resistive wheelsets is by Daryl Kruse who runs the UPRR Geneva Subdivision in N Scale.

For further reference, here are some links…

55″ Dispatcher Panel

55" Dispatcher Panel by BGTwinDad
55″ Dispatcher Panel, a photo by BGTwinDad on Flickr.

This is an early step in the “dream plan” for dispatching my layout(s).  The photo doesn’t really do the scale justice.  This is JMRI displaying my layout panels on our 55″ living room TV.  It’s big enough I can tell track occupancy from my kitchen thirty feet away.

For now, it’s just a novelty, because the current Glover’s Bend layout is small, but the ultimate goal, the “Chestnut Hill Sub” will be an around the room shelf layout big enough for multiple operators, and a panel this big will be easy for everyone to check when they want to see what’s coming.

Ultimately, all of this will also be web-accessible, enabling truly remote dispatching, for my friends who are too far away to visit in person.

Someday, when I win the lottery.

Technicals:  I just installed a Digitrax BDL168 block detector circuit under the layout, and it is monitoring 16 different blocks around the two main lines.  It’s feeding information back over LocoNet to my train room computer, which is generating the displays using the JMRI train control software.  My train room computer happens to have an HDMI display port, which makes it easy to convert my TV into a monitor.  Add a wireless keyboard and trackpad, and I can dispatch trains from my couch!  Easy-Peasey!

I’ll write an article or two about installing the BDL168 and setting up the panel once I get everything debugged and working properly.

 

DC vs DCC Locos and Control

It’s about that time of year, when for some reason there seem to be a lot of newcomers to the hobby, and a lot of people considering significant upgrades to their layouts.  Hmm… must be Christmas or something.

One very frequent question I come across, and one which seems to get a lot of answers, some accurate, some not so much, is the question of DC vs DCC control of locomotives, and specifically whether DC locos can be run on DCC track, and DCC locos run on DC track.  I shall attempt, in my rambling and overly-wordy way, to dispel some of the confusion and explain in some detail what is going on and why certain things work and others don’t.

In order to get this done in a blog post instead of a Ph.D. dissertation, I’m going to have to assume you understand some basic electrical concepts like DC and AC voltages and currents.  If you don’t understand these, I would refer you to Wikipedia in the short term, but I do plan to add some blog posts on these basic ideas later on.

Also, I will try very hard not to debate the merits of DC vs. DCC in this blog post, but only to explain (basically) how they work and what happens when you try to mix them.  The debate has long since passed into the “well beaten dead horse” category, anyway.

DC Control

Under DC control, the motor in the locomotive is directly connected to the rails.  It’s a DC motor, so it’s expecting a steady, DC voltage in one direction (one polarity) or the other.  The polarity of the DC voltage on the rails determines which direction the motor (and thus the loco) runs, and the voltage amplitude (level) determines the motor’s speed.  It’s a very simple system, but it works.

The catch is that because the rail voltage is directly controlling the motor, every motor on that set of rails will respond in the same way.  There’s no way to have two different locos running at different speeds or in different directions on the same set of rails.  DC control folks solve this problem by breaking the layout up into several blocks, each of which is electrically isolated from the rest of the blocks.  They use a set of switches to tell which throttle (“cab”) controls which block(s), and make sure that only one train is in each block.

DCC Control

DCC Control is a bit more complex than DC at this level.  In DCC, we put a little tiny computer inside the locomotive.  The computer is responsible for controlling the motor in response from a series of commands from the user’s Throttle (by way of the Command Station).  If you look at what’s happening on the rails, instead of a DC voltage (and polarity) that controls what the motor does, you see something quite different.  What you see is instead, technically, an AC voltage, and it’s quite high – a voltage that would be “full throttle” if we were under DC control.

This is the first major difference between DCC and DC.  In DC, there is always only the voltage required to turn the motor at the required speed, so to make an engine “idle”, you have zero volts on the rails.  Under DCC, there is always full voltage on the rails, no matter what speed the loco is moving.  For N scale and smaller, the DCC rail voltage is usually +/- 12V, and for HO or larger, the voltage can be as high as +/-18V to deliver the extra power the larger scale motors require.

The second major difference is the AC vs. DC part.  Under DC control, for a given direction of train motion, the polarity of the rail voltage is constant.  Reverse the rail polarity, and the train suddenly goes the other direction.  In DCC, the polarity of the rail voltage is always changing, and quite rapidly at that — over eight thousand times a second, in fact.

So keep this in mind.  While the DC rail voltage is a nice steady signal that only goes one direction and for a non-rocket-like train speed probably has a fairly low voltage, the DCC signal is banging back and forth thousands of times a second all the way from a full +12 or +18 to -12 or -18 Volts all the time no matter  what the train is doing.

Why is the signal banging back and forth?  Well, there’s a pattern in that oscillation, and that tiny little computer is paying attention to and deciphering that pattern.  And in that pattern are the commands being sent from the throttle.  Commands like “Run the engine at 50% throttle” or “Turn on your front headlight”, or even “Program CV42 to value 27”.

I could go on at great length about how this all works, but I think this is enough to make my points later on, so let’s move on, in the interest of brevity.

DCC Loco on DC Control

What happens if I buy a brand new DCC-installed loco (or install a DCC decoder in a previously DC loco), and plop it down on my DC-controlled track?  Well, the designers of DCC realized that LOTS of people are going to want to do precisely that — and that they will be very frustrated customers if their new, expensive engines don’t run. So the NMRA DCC standard allows for, and lately decoder manufacturers have been making what are referred to as “Dual-Mode” decoders.  Now,  you may find some older, outdated decoders that don’t do this, but pretty much all current decoders being sold in 2012 support dual mode.

A dual mode decoder is smart enough to realize that it might not be running on DCC track.  So, when power is applied and it wakes up, the decoder looks for a DCC control signal.  If it doesn’t see one, it assumes that it’s on a DC track, and will start following the DC track voltage and polarity as though it were a simple DC motor.  The result is that most modern DCC locomotives will work just fine on DC control, with a few minor caveats.

Caveats you say?  Well, yes, there is one fairly big one.  That little computer inside the decoder needs a minimal voltage to run – usually about 5 volts.  So while your “pure DC” loco will begin to crawl along at 1-2V DC, your DCC-on-DC loco won’t even wake up until a much higher throttle setting.   This is the main caveat.  There may be some other minor ones, but they depend on the specific decoder so we won’t go into them here.

Flying Locomotive Syndrome

There’s one really annoying thing about dual-mode decoders, though, and it’s a big reason why most decoders also have a switch to turn it off.  Every once in a while when you put a locomotive with dual mode enabled on a DCC track, and you power up the layout (especially when recovering from a short circuit), the decoder will mistake the changing voltage on the rails caused by the DCC Booster “waking up” (my term) for a DC signal.  The decoder will then switch into DC mode, and when the Booster starts putting out the regular DCC signal, the loco will race off into the sunset at full speed.  Not a pretty sight.  For this reason, lots of “pure DCC” users like to disable dual mode.

So, if you put your supposedly “dual mode” locomotive on a DC track and it doesn’t work it may be because someone has disabled dual mode.  Just plop it back on the programming track and check bit 2 of CV29.

DC Loco on DCC Control

This is where things get dicey.  If you plop a DC loco down on DCC powered track without doing anything else, here’s what happens.  Remember, the DCC track signal is at full voltage (either +/-12V or +/-18V depending on the booster setting), and it’s changing polarity 8,000 times a second.

Well, your DC locomotive is going to sit there trying to go full speed, reversing direction 8,000 times a second.  It just happens that the nature of the DCC control signal is such that the average time spent at each polarity is about the same, so the DC motor will spend about the same amount of time trying to go both directions.  It won’t really go anywhere, but it will make an ugly buzzing noise while the motor heats up and eventually melts the shell, if the motor itself doesn’t burn out first.

Short answer:  It won’t work.

Digitrax (and others) Address 00 Control

(Note: After learning that Bachmann and Lenz — at least — also provide this feature, I had to re-word this section a bit.  Having a look with a rested set of eyes pointed out a few technical corrections as well.)

NMRA to the rescue — sort of.  In another attempt to allow “backward compatibility”, the NMRA DCC standard allows for a method of controlling a DC locomotive on DCC track.  To my knowledge, only Digitrax has actually implemented this apparently this feature is available from at least Digitrax, Bachmann, and Lenz, maybe others.

They make this work by a method called “zero stretching”.  If you put a DC locomotive on your DCC track, and set your throttle to address 00, you can (usually) control the train.  Here’s how it works.

As mentioned above, the DC motor sees the DCC signal as a DC “full throttle” with a rapidly reversing direction.  It’s a “feature” of the DCC signal that the variations in the signal average out such that the motor doesn’t actually move — that is, the average voltage of that rapidly oscillating DCC signal is zero, because the signal is spending the same amount of time at +12(18)V as at -12(18)V.

When you increase the throttle, the command station starts stretching out some of the “spaces” between commands* so that the signal spends a bit more time at one polarity than the other.  The DC motor will see this as an average voltage somewhat above (or below) zero, and will begin to move.  DCC decoders are programmed to expect — and ignore — this “zero stretching”.  The higher the throttle setting, the longer the stretching time, the higher the average voltage the DC motor sees.

So it works. Sort of.  But it is noisy, and you still have the problem of the idle engine potentially overheating.  So I really don’t recommend it as a regular way to run locos.

Here’s a brief video of a DC locomotive sitting on my Digitrax DCC layout.

[youtube=http://www.youtube.com/watch?v=F-oj_17ybLQ]

By the way, I’m only about 1-for-4 on getting a DC loco to actually move under “address 00” control, but your mileage may vary.

*It’s actually stretching out the length of the “zero” bits within the data, but that’s a detail that really isn’t important at this level of discourse.

DC and DCC side by side

So what does a guy do if he wants to try out or transition to DCC, but he has dozens or hundreds of DC locos, and can’t fork up the $30 each or the conversion time to go whole-hog DCC?  Well, there are some options, but we have to be careful there as well.

DC/DCC Timesharing

One thing you can do is time-share.  Using a DPDT switch, you can wire your DCC booster side by side with one of your DC cabs (let’s say Cab A).  Then, when you want to run DCC locos, clear all the DC trains off the layout, throw all the block switches to Cab A, throw your DC/DCC switch to DCC and go to town.  When it’s time to run DC locos, just throw the DC/DCC switch back, and have fun.  This is really the most practical thing to do.  The only catch here is to be careful not to leave a DC loco idling somewhere on the layout while running DCC.

In short, here, your layout is all-DC today, all-DCC tomorrow, and so on.

DC/DCC Block-Sharing

Another option is to take advantage of the electrically isolated blocks in a DC layout to run DC and DCC trains side by side.  In this case, you wire the DCC booster into one of the cabs as above, and throw only some of the blocks to that cab, such that for example, one loop on the layout is DCC, while the rest are DC.  Some modular layout clubs have taken to doing this, often designating one or more of the loops on the layout as DC, and the others as DCC.

In short, here, the inner loop, or the upper deck, or the left side, or whatever is DCC while the outer loop or lower deck or right side or whatever else is DC.

BE CAREFUL!

There is a real danger here.  First, this will only work if your DC wiring system isolates both rails. You cannot properly isolate the DC from DCC if you have a common-rail DC wiring setup.

Second, you must never allow a locomotive to bridge the two regions.  DCC and DC power must never be connected to each other.

What happens?  Two things. First, the DC voltage from the DC throttle will add to the DCC signal (AC voltage) generated by the DCC Booster.  The resulting signal on the rails will look like a DCC signal, but shifted up (or down) by the amount of the DC throttle voltage.  Second, the DC throttle and DCC booster will see each other as “loads”, and will try to feed power into each other.

Precisely what the end result is will depend on exactly how the DCC Booster, the DC throttle, and your DCC decoders are designed.  If the voltage offset created by the short is high enough, it could damage the sensitive electronics in the decoders, “letting the magic smoke out”.  Likewise, if either the DCC Booster or the DC Throttle are unable to “sink” the current being delivered by the other power source, then the output stage of the weaker device will fail.

Most likely the loser in this fight will be the DCC Booster.  If you are lucky, the over-current protection circuitry will kick in and simply shut down the booster.  If you are less lucky, the output drive circuits will be fried (as in — again — “letting the magic smoke out”), and your expensive booster will become an expensive door-stop.

So, if you choose to “block-share” DC and DCC on your layout, I advise that you be extremely careful that there is no way for the two power sources to be connected to each other, including through a locomotive crossing from one region to the other.