PlasmaDrive Analog Train Controller

This analog controller is fundamentally different from any I have ever seen before. In layman's terms, it is simply an analog feedback controller, not unlike the Gaugemaster UF series or the Hornby 2000 type reviewed here, or my "Universal" Analog Controller here, but with the addition of a high-voltage cleaning function similar to the Gaugemaster HF1. However, there is a lot more going on inside.

The circuitry delivers an amount of energy, using a flyback converter, rather than a fixed voltage. This has the great advantage that it will develop a huge voltage across any dirt and dust particles, burning or blowing them away like the HF1, but it has the disadvantage that locomotive speed control could be completely lost, much like driving the Hornby Live Steam trains; smart PI feedback then fixes this problem.

In addition, the controller has all the layout automation capabilities of my PID684SV train controller.

In practical power terms, this series of controllers can run with a single lithium battery, just like a smartphone, DSLR, or flashlight. Alternatively, and in the ineterest of virtually infinite operating life, they can run using supercapacitors; there is nothing more dispiriting to discover that something you have not used for months or years has dead rechargeable batteries. Finally the PlasmaDrive will charge its batteries or capacitors and run trains from solar panels as in my St Lesitz and Clandestine Mine layouts.

For the high-tech user, there is the option of a small LCD display that provides a clear readout like dashboard instruments, and fascinating model diagnostics for the interested driver.

The PlasmaDrive controller will work not only as an embedded system for automating layouts, but as a plain, manual control. I have constructed a prototype in homage to the wonderful Hammant & Morgan Powermaster, as pictured at right.

One of the motivations for this design is not simply "blasting dust", but tackling control of antique locomotives. (OK, not technically antique, meaning 100 years old, but ancient in tech terms.) Not accidentally, the picture at right shows an old Tri-ang R253 shunter. Like many old locomotives, it tends to be a bit more difficult to get running smoothly. The PlasmaDrive is as good at getting these to run as anything I have seen. As part of testing this design, I purchased a bunch of the most decrepit N-scale locomotives I could find at antique stalls at last year's annual model railway exhibition. They were near unusable with even regular feedback controllers. A plasmadrive prototype got them running promptly, albeit less smoothly than in the case of a modern loco.

I should point out that the design will run OO and HO locomotives, but it is specifically designed for N- and Z-scale ones. At the smaller scales the issues of smooth and reliable control are usually greater. Hence the Z, N, and OO test tracks in the picture.

This is a rear view of the embedded model. The idea is that the panel is screwed into the woodwork of your microlayout.

Note the twin 500 Farad capacitors. These store enough energy for about 40 minutes of continuous shunting, about 2250 usable Joules given 3.5 to 5.5 volt capability, or around half an hour delivering 2 Watts. If you are running from solar panels, half a dozen 125mm by 125mm 6V panels is enough for most microlayouts even without direct sunlight.

This is the rear view of the PlasmaDrive in a Powermaster format. The whole design has that serious industrial look. I have built this with wood and plate metal, which is an approximation of the all-plate-steel original. I used some more of the lovely rimu planks thrown out when the University renovated the Physics School labs, which seems very appropriate. The paintwork is matt and crinkled, again like the Hammant prototype in the photo above.

Like the Powermaster, there is a selection of output terminals to connect various track blocks, each switched from the front. This model has three circuits, labelled 1 to 3 on the front panel swicthes.
There is a mains power supply, and a set of terminals with an indicator LED for 12V out when mains powered, or to connect solar panels if you want to be very green or work off grid. You can also attach a 12V DC source as often provided on other controllers. If nothing else, this reduces the number of power cords.

Before getting into more technical detail, it is worth showing what the feedback voltage typically looks like. The image at right is an oscilloscope screen capture of the track voltage (yellow) driving a high-quality, Z-scale, 4-axle shunting locomotive. As you can see the instrument has been set to 2 seconds digital persistence, so you see a couple of hundred overlayed traces. The green trace is present to trigger the scope correctly. During the short green pulse at about 6.5 divisions is when the track voltage is measured to estimate loco speed. Regions that are "filled" with yellow trace are where the PlasmaDrive is generating high-energy pulses, each a few microseconds long, at about 30kHz, and so they are almost indistinguishable in this display. The interesting part of the plot is the region between the two "walls" of yellow. Every 8ms the PlasmaDrive shuts down for about 1ms; this is the "gap" shown in the picture. During the shutdown, the DC voltage on the motor is exposed on the track. This is the set of yellow traces bridging the walls, and their value is measured during the narrow, negative-going pulse on the green timing trace. (The timing trace appears on the heartbeat LED for just this purpose.)

In the case of this locomotive, the trace in the gap is well behaved, and the speed of the train is easily measured.

This trace is from a low-quality, N-scale, 3-axle shunting locomotive purchased second hand. Again, the interesting part of the plot is the region between the two "walls" of yellow. In the case of this locomotive, the trace in the gap is well noisy, and any given trace has a lot of small spikes, presumably caused by dirt particles or bad workmanship on wheels, commutator, etc. There are even some traces, looking where the green trace first rises, that show no or virtually no voltage at all... the loco is momentarily disconnected from the controller entirely.

It is these spikes, variations, and complete dropouts that a feedback controller must fight. The high-voltage capability goes a long way to blast past the disconnections when applying power. Another major advance is that the controller has digital filters such as median and slew filters to overcome the extreme noise and frequent glitches in measuring in the gap-time voltage, on the rails between applications of power. The combination gives this controller magical ability to handle nasty locomotives.

Screen Displays and Locomotive Diagnostics

This display shows a typical boot screen after power has been applied. The Screen says the controller is in Manual mode, so it will simply "do what the knob says". "Shunt mode" means that the control knob is certre-off, like the H&M controllers.

The screen is red to indicate that the cells are not yet charged up sufficiently to run.

Pressing the white "D" (D for display) button will advance the screen display in manual. The first press takes you to the "Dashboard" screen, which is what you typically have showing when all is well and you are running locomotives. In this case, nothing will happen when you turn the knob until the cells charge up more and the display turns bright cyan.

The "Red" echoes the signal display. This optionally appears as a signal on the layout. It is Red because the locomotive has a problem, in this case, low power!

Once the cell voltage reaches just over 3.5V, the display background turns bright cyan. The indicator shows Green. The Vs display tells you the cell voltage level, which is something like the gas gauge in an internal-combustion engine vehicle: It tells you how much power you have. Remember that you can disconnect the mains power or lose your solar cells and the controller runs on its cells.

In this case the knob is turned up, and Speed is indicated. It is in arbitrary units up to typically 200, but it will go higher on some locomotives.

There are 4 annunciators that can appear on this display, like warning lights in a car. They are "I" to indicate a short circuit, "V" for an open circuit, "P" if the solar panels are supplying more power than the cells can hold and so your "tank is full", and "S" if the loco appears stuck because it is getting power and not showing any feedback voltage. The controller delivers dislodging pulses to help overcome stiction.

Diagnostic Screen Displays and Interpreting Them

This is the first of the information screens. These are not intended for regular use; they are for interest and diagnostic purposes.

The display here shows the locomotive speed, below that the throttle setting given by the user, the supply voltage, and the "amount of engine push" that is actually being delivered. Remember that this is a feedback controller, so the electronics tries to deliver whatever "acceleration" is required to achieve the requested speed. This is much like the cruise control in your car.

The display if of interest, because it shows you how hard the controller is working for any given locomotive. Different locos will require different amounts of "pedal". A light, plastic-bodied locomotive of the type common in Japanese commuter train models will have way less "Pwr" than a larger-scale locomotive (OO instead of N scale, for example), or a German-style, weighty locomotive with a lot of wagons.

Now it becomes more interesting. A Graham Farish 0-6-0 diesel shunter, carrying a couple of heavy wagons (someone is moving a large pewter statue of a wizard) and running on the test track as pictured below, is forced to climb a 3% grade on one side, and descend the same grade on the other half of the loop. The "Pwr" reads about 120 on the descent side and 180 on the ascent. Without a feedback controller, the train would slow down and speed up unrealistically.

Following on from the last screen is a similar dashboard, but designed to show the operation of the proportional and integral feedback components. For users who do not know how feedback loops work, you can skip over this one.

The speed and throttle values are as before. The "err" term is the proportional feedback term, and "ierr" is the integral feedback term. In normal operation, the ierr term does the main work, and the err term trims the thrust applied (the equivalent of the push on the accelerator pedal) moment by moment. The err term tends to dither about, in response to engine noise and track dirt issues, which is fine and normal. Essentially, these two numbers tell you how well your feedback system is working. The display is most useful if you alter the amount of feedback, which is accomplished in a later screen. Why would you want to adjust it? The answer is to allow for tuning for a heavy or especially light train. This is the key limitation of most feedback controllers, especially ones like the H&M 2000 and other later model Hornby controllers. They are shipped to the customer to suit the most fiddly case, and are often ineffective with locomotives that have more mass.

The next display reports the controller power consumption. This is usually of no interest, unless you are wondering how long the battery will drive a particular locomotive. The top line reports the input voltage and current, the Thrust number reports the relative power delivered to the locomotive, and the P value is the power consumed.

This screen is useful for understanding the locomotive. The drive is the PWM duty cycle delivered to the flyback converter, and the BEMF is the voltage developed by the locomotive motor, the so-called "back electromotive force". This is the value measured to determine the RPM of the motor. This screen is interesting from the point of view of seeing the effort required to achieve a given speed, and the voltage that represents such a speed for the particular locomotive.

One insightful use is to assess the "cornering effort" of a train. One might expect little extra effort to be required to traverse a bend in the track. Particularly in the case of wagons whose wheels are rigidly connected to the shaft, so that wheels on each axle must rotate at the same rate, some slippage must occur, and this adds to friction losses. The result is that a train will slow noticeably on corners; this is worse on old locomotives with lower-field permanent magnets producing less torque, and when using "resistive" controllers like the H&M Duette. You can see the effect on this screen, where drive increases for similar BEMF.

As mentioned above, noise on the BEMF signal caused by eccentric motor components, mechanically different pole clearances, and bad contact between wheels and track or between axles/wheels and pickups makes life hard for feedback controllers. This screen gives you some idea of the problem in any given locomotive, by showing the mean, and local minimum and maximim values measured. The data arrives at about 120 readings per second, which is too hard to display or store and analyse, but this screen is just what is required. With a little practice you can see when a loco needs attention, cleaning, repair, etc.

Parameter Screens

This screen gives the level on the automation input as a percentage of rail, the time for the dead-mans switch to kick in and stop the locomotive in minutes, the maximum possible value of the drive in PWM units approaching 512, given the instantaneous supply voltage, and the control proprtional gain parameter. Values below 15% on the link input cause the train to reverse in Auto mode, or cause the controller to boot into manual mode. Values above 75% cause no action. Values in the middle cause a station halt, where the train automatically pauses and then resumes.

This screen is present purely for diagnostic purposes, chiefly when setting up automation on a layout.

This screen shows how long in minutes the computer has run, and how long in minutes a train has been running.

This screen shows how many times the controller has been rebooted, and how many times it has automatically run a train on the layout. Of course this counter does not advance in manual mode.

Parameter Setting Screens

There are two parameters that can be set.

The first is the automatic braking distance setting. This function ensures that a train stops correctly in a station, irrespective of the throttle setting. The value is set while this screen shows, but if the knob is not touched, the old setting remains unchanged. It should be set to suit the layout and the distance from block detection to train in station. The default value shown represents about 150mm for a typical N-scale locomotive. The idea of this setting is that changing train speed will not change the stopping distance, which is usually set by the ralative position of the station platform and the block detection electronics.

This screen sets the control gain constant, KP. For larger, heavier trains, the value can be increased to tighten speed control. For smaller, lighter trains the value can be decreased to prevent that "nervous jitter" that can appear.

Automatic Mode

The open-chassis version is intended for embedding in a layout to be automated. The free-standing, mains-or-solar powered, Plasmamaster version is intended for manual use like a conventional controller. Nevertheless, both can be operated in the opposite mode.

If the Powermaster is booted with the R/M (Reverse/Manual) flipped down, or the open-chassis PlasmaDrive version is booted with the override switch held in the R (Reverse) position, each controller boots in the opposite mode. Holding the D (Display) button down for more than 10 seconds causes a warm reboot.

When these controllers are in "Automatic" mode, the display is cream coloured.

Autoruns runs are triggered automatically, more frequently for higher supply voltage. This is on the logic that the higher the supply voltage, the more energy you have to spare. They can also be triggered by a momentary contact on the button input; this could be manual, or set off by sudden changes in light level, for example.

When first triggered the display shows technical dashboard. This soon changes to the "scanning" screen that shows how many runs have completed, how long to timeout, and the speed. From here, the train can be halted in a station, halted and put into reverse, or it can complete the run. These are triggered by signals on the link input, or the push button input. On the Plasmamaster incarnation, the white button starts and stops an autorun, the H switch causes a halt, and the R/M switch triggers reversal.

The device shows a first screen when halted, and another while leaving. The latter allows clearing of the block detector. Then the system returns to scanning.

A similar screen appears for stop-and-reverse. When the run finally completes, there is a Green Lockout period. Any triggers, perhaps from waving branches over a sensor or small children, cause the lockout to extend.

When complete, the screen blanks, and the controller awaits a trigger for the next run.

Constructional Details for Geeks and Engineers

This is the PCB overlay of our version 2 prototype. The flyback circuit has such large circulating currents and voltage spikes above 500V so the layout is crucial. The main drive FET is a Gallium-Nitride (GaN) device that is only available in surface-mount format. The layout of L1, G1, C2, C3, C4, C7, R3 and R4 must have low parasitic inductance. The rest of the board is not so critical. At time of writing (2021) the G1 transistors cost about NZ$20 each.

Below is a PDF printout of the C-code that runs the controller. (Likely only the first page shows in your browser. Right-click and download file to get the full listing. Long!)