Hi Everyone! I have an NYC Flyer train set (circa 2004) that I want to control by a microprocessor I am building. I would like to know if I can use a duty-cycled AC voltage to control the speed of the train. My initial thought is to use a zero-crossing TRIAC to send full or half sine waves, but I am not sure if duty-cycled AC is a safe method of speed control for the type of motor in the engine. This type of speed control would be easy to implement using the microprocessor. Has anyone ever tried this method on such an engine?
Yes. This technique, called "phase control" is what Lionel uses in, for example, the CW-80.
Bob Nelson
So what I have measured as, say 14 V (RMS), on the volt meter, is actually a "chopped" AC signal? At "100" output on the CW80 transformer I read 18V so is it safe to assume should get an 18V transformer and duty-cycle its output? Do I need to zero-cross fire the TRIAC or is a random fire TRIAC better? I assume the zero-cross would be easier on the motor, but that means cutting out full cycles leave the engine effectively unpowered for some fraction of line cycles. If my math is correct, a good portion of line cycles will be unused when the train is under idle speed condiitons, so does this matter for any other functions like lights, sounds, etc.?
I think your best bet is what Lionel did: They used a 20-volt RMS transformer (not 18). For any one output voltage, they fire the triac at the same phase in every half-cycle. They generate the bell or whistle signals by advancing and retarding alternate firing times slightly. The maximum output is about 18 volts to leave room for this trick.
Some folks have reported trouble with using the CW-80 and its ilk for non-Lionel locomotives.
Note that the CW-80's voltage cannot be read correctly with an ordinary AC voltmeter. Here is a correction table that I have posted before:
Meter RMS 0 0 0.5 1.6 1 2.7 1.5 3.7 2 4.6 2.5 5.4 3 6.1 3.5 6.9 4 7.5 4.5 8.2 5 8.8 5.5 9.5 6 10 6.5 10.6 7 11.2 7.5 11.7 8 12.2 8.5 12.7 9 13.2 9.5 13.7 10 14.1 10.5 14.6 11 15 11.5 15.4 12 15.8 12.5 16.2 13 16.6 13.5 16.9 14 17.3 14.5 17.6 15 17.9 15.5 18.2 16 18.5 16.5 18.8 17 19 17.5 19.3 18 19.5 18.5 19.7 19 19.8 19.5 19.9 20 20
Although the voltage error can be corrected, there is no practical way to correct an ammeter reading.
Hmmm, so this DC voltage I measure on my meter when the whistle/bell is active is essentially an artifact of the timing on the AC on/off triggering points? I had assumed they had a separate bipolar DC power supply that was superimposed on the AC signal to induce the whistle and bell sounds. The advancing/retarding of the phase angle seems so much simplier. So it sounds to me like the zero-crossing approach is out and I need to learn how to do this phase angle triggering of a TRIAC. And suggestions on where to to to get a 101 lesson in phase angle firing of an AC voltage?
Has anyone out there ever built their own phase angle triggered TRIAC to power a Lionel train (essentially built their own CW80 power supply)?
MJHanagan2 - I've considered making a microcontroled power supply, but don't have enough electronics background to do so unassisted. Could you please post your progress on this project as you go along? I'd like to see the final scematic you come up with.
Thanks!
Unfortunately I'm not an electronics person either, but I'm learning as I go.
My plan, as of now, is to use one of the Parallax Propeller microprocessor chips to operate the entire system. This will be a wall mounted system that runs between two adjacent bedrooms. The idea is the train will either loop inside one room, or if both kids want it operating at the same time it will alterately pass from one room to the other after making a single loop within each room. I plan on having IR remote controls for each bedroom plus one IR remote in mommy and daddy's room to overule any misbehaving kids.
I need to research this "snubber" thing a bit more and probably make some measurements using an oscilloscope in order to determine the train's "power factor" - apparently you need to know this in order to determine the capacitor and resistor needed to do the snubbing. Unless there is someone out there that has already done this???
I will try to post something in the next week or two.
I'm not familiar with the Propeller. Sounds intriguing!
I had been researching the Arduino. I was attracted to that since it was flexible in the programming, which I would be better at.
I hadn't figured out how to control the voltage with a microprocessor, and was concerned about using pulsed voltage on older Postwar engines.
I don't know what you mean by 'snubbing.' Can you explain?
I have seen several references to the Arduino micro and it sounds a lot like the Propeller - designed to be user friendly i.e. more geared to the hobbyist rather than the serious EE.
Today I was able to make some rudimentary voltage and current measurements on the running train. Keep in mind I am playing with a very low-end Lionel NYC Flyer train set (circa 2004). It came with one of their CW80 power units. I set up a simple oval track and used just the engine, tender box and lighted caboose (I left the other cars off for now). I measured the power unit's output voltage and current at a rate of ~10,000 Hz so I captured ~166 data points per 60 Hz line cycle. The peak voltage I measured was about 22V which equates to something like the output from a 16 V RMS transformer.
What I see is a definite phase angle controlled output from the transformer just as Bob has described above. It looks like they are chopping off the leading voltage of the positive AC sine wave and the leading voltage off the following negative sine wave. I think this is referred to as “full wave phase control”. Take a look at Teccor’s application note AN1003 “Phase control Using Thyristors”.
At this point it looks like the basic requirements will be a 16V transformer with an output of ~2A (RMS), a TRIAC, a random-phase TRIAC driver and a voltage comparator. The voltage comparator will produce a pulsed output each time the transformer’s voltage passes through the zero point (going from negative to positive). The microprocessor waits for the comparator’s output to go from 0 to 1 signaling the “zero-crossing” time. It then waits for the proper amount of delay on time before signaling the driver to turn on the TRIAC. The micro then turns off the driver signal. The driver keeps the TRIAC in the on state until it crosses the zero point before it deactivates the TRIAC output. The micro waits for the appropriate amount of time before reactivating the driver to turn on the TRIAC again for the correct amount of negative voltage time. And like in the previous half-wave cycle the driver keeps the TRIAC in the on state until it crosses the zero point before it deactivates the output.
So that’s pretty much the key to the very basic power control mechanism. The speed then is simply how much of each sine wave gets output to the track. Full power is 100% of each sine wave. The bell and whistle signals are passes to the sound circuit in the tender box by chopping a bit more off the positive or negative portion of the sine wave (just as Bob described). I haven't measured how much gets chopped off but I can clearly see it in the voltage measurement data.
I now need to consult my EE buddy to figure out which type of TRIAC is needed (there are quite a few out there) and get a recommendation on the specific type of driver to use. I will also ask him about this snubber circuitry. From what I can see in the measured V-I data the train’s engine motor seems fairly well behaved and there is not a lot of phase shifting between the voltage and the current. I believe for larger motors the inductance of the motor can cause some phase shifting of the voltage and current which creates some problems in how the TRIAC reacts to the on/off signals. My guess at this point is snubbing won’t be necessary but adding a small capacitor and a resistor might be prudent to keep things well behaved. I will also need to defer to my EE friendto help size the capacitor and resistor properly. I will then put together and post a circuit diagram detailing his recommendations.
Let me know if you want me to post the measurement data. I won’t post today’s measurements because I don’t have a very accurate value for the current sensing resistor so my calculated current values may be off by as much as 10%. Once I get a good value I will redo the measurements so I have accurate numbers (±1%).
You don't need to turn a triac off. It turns itself off when the current goes to zero near the end of each half-cycle. (It's a thyristor.)
All the measurements that forum members have posted indicate to me that the open-circuit voltage of the CW-80 is 20 volts RMS, not 16. You mentioned having a current-sensing resistor in the circuit. Could that explain the difference?
I get an open circuit voltage of 19.05 VRMS using my handheld meter. When I attach the nominal 12k ohm voltage divider (needed to knock down the voltage to the ±10V ADC card) the handheld reading drops to about 18.55 V witht he throddle at 0% and about 18.88 V when the throddle is at 100%. I get the same calculated RMS voltage from the ADC measurements. The presence of the 12 k ohm "load" on the otherwise open circuit results in a measurable drop in the output voltage. I suspect this is an artifact of having a net, albeit very small, load on the output side of the transformer. When the full load of a running train is active then it looks like the net output of the transfomer drops to about 16V RMS (peak voltage of about 22V). An EE should be able to explain why this happens (I'm pretty much limited to V=IR).
My ADC card only measures voltage so in order to monitor the current I put a small resistor in series with the track wire. For this morning's measurements the only resistor I could find was a nominal 5 ohm rheostat which I dialed down to be ~1 ohm. My handheld multimter only has 0.1 ohm resolution so the actual setting may have been off by about ±0.1 ohm. I then measured the voltage drop across this resistor and calculated the current. Once I find a good 0.1 or 0.01 ohm current sense resistor I will repeat these measurements so the accuracy will be there. I will also receck the values of the voltage divider, but since they are matching the "TRMS" handheld meter I believe they are reasonably accurate.
Ahhh, a TRIAC always turns itself off? So this means I only need the optocoupler driver to activate the gate of the TRIAC when I want it to come on? Am I correct in assuming I need a "random phase" driver such as a Fairchild MOC3022M for this? Any special about the TRIAC? I was looking at an NXP BT136-600D.
Thanks for the continuing info! I'll admit most of this is beyond my simple training. But please keep posting as you go. I'm trying to keep up, and learning along the way.
I am curious, though, if what you are designing would only work for the transform you started with, or can you use it on any transformer? Would it be possible to use a triac with a high enough rating for higher voltages and still have it work for a variety of transformers?
I have a pair of old Lionel Type V transformers that can go up to about 25 volts. I've already be warned not to use them at full power when running more modern engines.
Those voltage readings sound more reasonable. One thing to keep in mind is that the CW-80 is never on for the full cycle, in order to leave room for the whistle-bell trick--one polarity of half cycle always needs to be able to come on earlier than it would normally. On the other hand, the CW-80 has a small capacitor in parallel with the triac, probably to prevent triggering on sudden voltage changes, which is a vulnerability of thyristers generally. But this means that a measurement with a high-impedance voltmeter is likely to see the full transformer waveform, almost as if the triac weren't there. The bottom line is that I think your CW-80's transformer is intended to put out about 20 volts RMS, more or less depending on the power-line voltage.
As for whether that particular driver device is appropriate, it is clearly overqualified in the voltage-rating department; but it's pretty cheap, so I don't think there is any point in looking for one with a lower rating, if one even exists.
You do need a "random-phase" driver if you're planning to time the triggering in software. "Random" here is used in the same sense as in "random-access memory", which is that the memory locations can be accessed in any order that you want, not literally randomly.
The usual trigger for line-voltage phase-control dimmers is an analog circuit comprising a pair of cascaded low-pass resistor-capacitor networks driving a thing called a "diac", which is like a two-terminal triac that fires when the voltage across it reaches a certain threshold. This is put between the last RC network and the triac gate; and the networks are driven by the line voltage. One of the resistors is variable, so that the time to the diac's trigger voltage can be varied from almost zero to over 8 1/3 milliseconds, that is, the full duration of the half-cycle, in which case the triac never fires.
Occasionally someone asks here whether those inexpensive dimmers can be used to control trains. They can't, since the diac's trigger voltage is far to high for the toy train transformer's voltage ever to fire it. The whole thing could be redesigned for the much lower voltage; but then it's not such an attractive proposition.
Jark, yes, a single computer-controlled triac circuit could be used with a variety of transformer voltages without any problem.
Big success today! I used the Parallax Propeller MCU chip to control the train speed and even properly triggered the whistle and bell sounds. With some fairly simple “SPIN” code I was able to use my laptop’s keyboard to send commands to the MCU to control the speed and sounds. I used a voltage comparator as the basic element to toggle one input pin of the MCU each time the 18V transformer’s voltage passed through zero. The MCU then waited the appropriate amount of time before using one of its output pins to trigger a Fairchild MOC3022 opto-coupler which in turn triggered the output of a TRIAC (a BT138-600 series). The 80 MHz speed of the MCU’s internal clock provided plenty of precision in the phase angle timing of the trigger signal so I was able to get some very sensitive speed control. I used an offset angle of 20° to trigger the whistle and -20° to trigger the bell sounds.
I didn’t use any snubber circuitry today and could not detect any false triggering. I need to clean up some of the test circuitry and SPIN code then I will post both here for those interested.
There are those who are interested! Please post when it is ready.
And congratulations on a fine experiment that went well.
Our community is FREE to join. To participate you must either login or register for an account.
Get the Classic Toy Trains newsletter delivered to your inbox twice a month