0
\$\begingroup\$

I have a question, an easy one I believe. I am designing a small module which may take control of an analog model train as soon as the train is detected.

When the train is detected, a uController must screw down the dutycycle to either 50% or 0% (frequency is fixed) to slow the train dowm to either half speed or a full stop

The voltage on this piece of track has to be analog (0V - 12V). Use of an unfiltered PWM signal on the tracks is not an option. The first section would be 12V DC, if a train would transition from the first section onto a section which has PWM every conducting wheel might trigger a short circuit spike between 0V and 12V. The system might get away with such short circuit spikes, but I believe it cannot possibly be any good and therefor I consider it a bad option.

Also driving analog trains with PWM is very undesirable. 1st digital trains do not understand a PWM signal and they will simply not work. It is common for people to have a digital train driving around among analog trains.

PWM'ing a train can be done on 20kHz or above (due to horrible high pitch sounds). This has horrible driving qualities on analog trains. Digital trains do use these frequencies, but these trains also come with cruisecontrol and an advancde PID (or something similars) system to deal with this.

By far the best way to achieve a good PWM controller is by varying the frequency alongside the dutycycle. < 10% Dutycycle you use 20Hz and 100% dutycycle is done @ 100Hz. Though trains drive wonderful on this method. The train's LED may flicker like an Xmas tree (glowbulbs work fine though) and sadly not every train has room to accomodate an anti flicker circuit. It is also not desirable if you need to do this with every train.

The detection is done via an optocoupler. When a current flows through the 2 diodes, they create a 1.4V drop over the led of an opamp which then pulls the currentSense line down to 0V. This informs the uController that a train has entered the section.

This circuit is designed for oneway traffic.

enter image description here

The opamp should correctly filter the pwm to an analog voltage. But I want it to drive a load of about 0.7A max without experiencing a noticeable voltage drop.

At the moment I have a rail to rail opamp in supply, but it cannot provide the desired 700mA.

Questions:

  1. Disregarding any potential heat development, can I simply add a mosfet or a transistor such as the TIP120 darlington behind the opamp without screwing up the voltage level on the tracks? Or will this affect the voltage level in a negative way (which I suspect)
  2. Is it a good idea to pick a stronger opamp such as this one from Mouser which can drive up to 1A
  3. Is it a good idea to use this circuit (with 5V instead of 12V) to 'replace' the potentiometer of an existing buckconverter (essentially I'd be controlling the output of a buck converter using this circuit as input)

Also. I am yet to learn how to run a simulation of a schematic, so no I have not simulated anything.

\$\endgroup\$
6
  • \$\begingroup\$ Comments have been moved to chat here. Too much squabbling to be worth leaving them here. THere is a degree of "talking past each other" happening. Some of the claims on bith sides MAY be right, or not. A mutual working through why the differences of opinion occur would be useful to all. | It would be useful if ALL parties could maintain an at least half polite attitude. Pretty please. \$\endgroup\$
    – Russell McMahon
    Commented Sep 22, 2020 at 10:57
  • \$\begingroup\$ While analog solutions to such a problem are possible they would not typically be chosen today. A modern design would carefully examine the reasons why a PWM solution seemed unsuitable and reach the conclusion that carefully implemented single ended PWM does not challenge trains in a way that ordinary situtions of track power do not already. Similarly the concern of transiting between segments driven at different rates is not an issue when they are powered for travel in the same direction ("OR" gate). Opposite direction junctions are an issue in any scheme, requiring isolation segments. \$\endgroup\$ Commented Sep 22, 2020 at 13:24
  • \$\begingroup\$ While a DCC train won't be able to interpret power PWM as a digital command it can still use it as power, such a train has to start by rectifying and filtering its power supply from its own not all that different command waveform, though in this case unlike that of DCC there would be no reversal of track polarity in the cycle. \$\endgroup\$ Commented Sep 22, 2020 at 13:43
  • \$\begingroup\$ You still seem to disregard the flickering LED issue which is #1 reason for me not to use pwm. And what you say about digitaltrains and pwm is entirely hollow. It could be possible to design a decoder which would work, but these simply don't exist. The decoder I tried (esu V4) started moving at about 90% dutycycle. There was no way to let the train accelerate slowly with pwm, and the lights flickered alot. You might perhaps be able to slowly decelerate a digital train with pwm, but it is unlikely that you will get good results. \$\endgroup\$
    – bask185
    Commented Sep 22, 2020 at 14:12
  • \$\begingroup\$ Those issues are exactly what would be expected when the PWM rate is too low, and are why you need high rate PWM. But even if you want to go with analog, please take time to understand why a single ended PWM circuit won't "short out" when bridged to another track of the same direction. Since it's only on or off, it tolerates that fine. In contrast some analog output solutions would not tolerate that without protection. \$\endgroup\$ Commented Sep 22, 2020 at 14:14

1 Answer 1

1
\$\begingroup\$

Disregarding any potential heat development, can I simply add a mosfet or a transistor such as the TIP120 darlington behind the opamp without screwing up the voltage level on the tracks? Or will this affect the voltage level in a negative way (which I suspect)

Yes. Actually, op-amps are really good at this! You can put any kind of amplifier you want circuit between the op-amp output and the feedback point (where the - input connects) and the op-amp will adjust its output to keep the + and - inputs the same. That means it automatically compensates for any voltage changes caused by the amplifier!

What kind of amplifier should you use? For your circuit, an NPN pass transistor should do. Collector -> power supply, emitter -> tracks (via current sense), base -> op-amp output. This is called an "emitter follower" configuration. Note that the emitter will be about 0.7V lower voltage than the base. The op-amp will compensate by setting the base 0.7V higher than the voltage you ask for. But the op-amp can't set the base higher than the op-amp's own power supply, so this does affect the maximum power. You'll have no problem putting 12V on the tracks if you bump the power supply up to 15V or so.

You could put an NPN transistor in the negative track instead of the positive one - then your minimum drop will be about 0.2V instead of 0.7V - unless the negative track has to be 0V for some reason. You could also use a PNP transistor in the positive track, in which case you also have to swap the + and - because lower base voltage would make the track voltage higher. Either of these make a common collector amplifier, and if you try them, then do put a resistor in series with the base.

By the way, your current sense circuit drops voltage too. Connect the + input after the current sense circuit. That way, it'll compensate for the voltage drop caused by the current sense circuit. And again, the op-amp has to have a high enough voltage for the compensation to be possible.

Is it a good idea to pick a stronger opamp such as this one from Mouser which can drive up to 1A

Sure. If it does what you want, why not? I think you'll learn a little bit more by making a more complicated circuit with a pass transistor, but it's your choice.

Is it a good idea to use this circuit (with 5V instead of 12V) to 'replace' the potentiometer of an existing buckconverter (essentially I'd be controlling the output of a buck converter using this circuit as input)

That depends, how is the potentiometer wired in the circuit?

\$\endgroup\$
10
  • \$\begingroup\$ Yes, you could do this if you want a design from the 1970's. But a modern design wouldn't waste effort on the asker's mistaken belief that PWM is unsuitable, rather than merely needing to be of a suitably chosen switching rate. \$\endgroup\$ Commented Sep 21, 2020 at 18:30
  • \$\begingroup\$ @ChrisStratton Is there a meta question about answering questions as written vs ignoring perceived-irrelevant requirements? \$\endgroup\$ Commented Sep 21, 2020 at 18:39
  • \$\begingroup\$ That would generally fall under the category of an "XY problem" - especially where the asker is someone with a history of such behavior \$\endgroup\$ Commented Sep 21, 2020 at 18:52
  • \$\begingroup\$ ...the asker has explained their reasoning for refusing PWM, and unsurprisingly it is mistaken. \$\endgroup\$ Commented Sep 21, 2020 at 20:01
  • \$\begingroup\$ @user253751Thank you for your awnser, I marked it as the correct one. I am btw fully aware about the voltage drop. This I compensate by adding the very same drop to undetected sections as well. If you were wondering why no PWM, I edited the question with about 4 different reasons. \$\endgroup\$
    – bask185
    Commented Sep 21, 2020 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.