Simple Controllers for DC Motors (inc PWM) Inertia and Braking (sim)
by marshon in Circuits > Electronics
70740 Views, 68 Favorites, 0 Comments
Simple Controllers for DC Motors (inc PWM) Inertia and Braking (sim)
Simple Controllers a modular approach.
These controllers were designed to drive model locomotives but the circuits should work with any single phase DC motor as long as the power requirements are taken into account when selecting components.
In order to control a model locomotive, we need to supply it with electrical power at varying levels for speed control, and we need to be able to reverse the polarity for directional control.
This article attempts to describe simple, effective ways that the home constructor can achieve this. The controllers are kept as simple as possible and are intended for DC (as opposed to DCC) use with N, OO or HO gauge, but should work with any nominally low voltage (12 - 18V) rated DC motors.
Before we begin to look at controllers a few words of warning. Firstly I am not an electrical engineer, most of these circuits have been adapted from well tried and tested ideas. Secondly MAINS VOLTAGES CAN KILL! Do not attempt to work on any type of mains voltage supply unless you are confident that you know what you are doing. For testing purposes I would recommend that you look at the section where power sources are discussed, or use an old 12V car battery as your power source.
I wanted a custom built control panel and therefore a custom made controller. As ever, being poor, it had to be cheap and easy to understand.
Here's my control panel. The motor controller is the lower right hand side of the panel.
Explanation
In the early days of electric model railways the controllers most often found were of the ‘split rheostat’ type. This consisted of two semi-circular wire wound resistors with a wiper and an electrically dead centre. With the control knob at the centre, no power is supplied to the track. As the knob is advanced either to the left or the right, power is applied to the rails, but with the resister ahead of the wiper, both voltage and current are reduced. As the knob (and therefore the wiper) are advanced further, the amount of resistance is reduced and the voltage and current to the track is increased. In this way speed control is achieved. Reversing was simply accomplished by moving the control knob back passed the centre dead section and in the other direction.
The advantages of this arrangement were, no need for any directional switching, robustness (many of these controllers are still in use) and heat dissipation being achieved via the rheostat itself. The major disadvantages were cost of manufacture (rheostats are expensive), erratic behaviour as the wiper contacts begin to wear and get dirty, and finally the one that will haunt all further discussion. Poor starting and slow speed operations.
The problem of slow speed and starting control is a common one. Locomotive motors develop most power and torque at or near their main operating voltage (nominally 12Vdc). In order to start moving they have to overcome inertia, magnetic force and friction from bearings and gears. This means that you may have to move your speed control to 60 or 70 percent of full power, then the loco will race off at an unrealistically high speed. Once moving you find that you can back the control off for slow running, but at certain slow speeds performance can be erratic as the voltage and current drop to a level where the motor is struggling.
Using more modern (and cheaper) components we will attempt to address these problems one by one.
Below are three initial circuits so you can see where we are going. More detailed information in the next steps.
The Circuits
Figs 1, 1a and 1b (below) show a simple variant on the variable voltage theme. VR1 is a potentiometer, or variable resistor. There is no split rail so we have to add SW1 a double pole double throw switch to reverse the polarity for direction. VR1 is configured as a voltage divider. This means that when the knob is fully anti-clockwise, the full resistance is in circuit and no current flows through the wiper. As the knob is advanced in a clockwise direction the resistance on the positive side drops and the resistance on the negative side increases. Current flows to the wiper terminal in direct proportion to the difference in resistances on either side. When the knob is fully clockwise, all the resistance is on the negative side and full power flows to the wiper. This gives us speed control. Reversing the throw of the DPDT switch reverses the polarity to the rails and we have direction control.
The problem here is that VR1 (which must be a linear potentiometer) is only capable of sinking around 125mA, whilst even a well run in motor will draw between about 100mA and 250mA once moving. An old, worn or stubborn loco motor might draw as much as 1A and therefore a double header could draw 2A. The potentiometer won’t last long! We need to amplify the signal to reduce strain on VR1
Fig 1a shows the addition of an NPN power transistor to ‘gate’ the current and protect VR1. As the wiper voltage passes 0.7V into the base of TR1 the transistor ‘switches on’ and current flows between the collector and the emitter. This effectively puts the current strain through TR1 not VR1. The voltage passing through the transistor will remain at 0.7V lower than the voltage presented at the base. The transistor ‘taxes’ the circuit 0.7V, which is a small price to pay for protecting VR1. However, TR1 must now sink all the unused power as heat so a heat-sink needs to be fitted. The circuit will work as a basic controller but you would be surprised at how hot this arrangement will get.
Fig 1b shows a much improved version using two transistors as an amplifier. TR1 feeds TR2 for a total loss of 1.4V (0.7V for each transistor). The big advantage of this system is that the amplification achieved is the amplification of TR1 times the amplification of TR2. VR1 is now under no real strain, and the heat dissipation required by TR2 is reduced. A heat-sink would still be required at TR2.
This classic circuit is known as a ‘Darlington Pair’ and is recognised and used throughout the electronics industry. We will use this simple circuit as the final output basis of all the controllers in this article. Fig 1b also includes R1 as a current limiting resistor and F1, a one amp fuse as some basic overload protection. The values for the components can be quite varied, in theory VR1 can be any value since it is a voltage divider, but realistically you would want to use one between about 5K and 50K, I find 10K gives the best overall control. R1 should be between about 330R (Ohms) and 500R. TR1 can be any small signal or general purpose NPN such as 2N2222A, BC107, BC109 the list goes on. Be sure it can sink 100mA and over 20V to be safe. TR2 could be any NPN power transistor capable of handling at least 3A and 20V such as TIP31A, TIP31C, TIP41A or 2N3055. Again there are many choices here.
The cost of this circuit? Less than £3.00 at time of writing. VR1 will be the most costly at about £1.50. You would need to add an enclosure or panel of some kind and a control knob, but these can be almost anything you have available, and all the parts will fit into an area of about an inch square. Construction can be ‘Bug style’, ‘
So having overcome cost, what are the disadvantages? Well aside from the aforementioned starting and slow running issues, the overload/short circuit protection is very poor, there is no EMF protection, and we have no indicator lights of any kind.
An Improved Version
If we place a small resistance in the return path, and place a transistor across it, we can monitor the power output and at a pre-defined level get the transistor to drain the current away to earth. This is a very satisfactory method of overload protection because once the problem is removed or rectified the controller will automatically return to it’s normal operating state. The problem is the value of the resistance required. A value of between 0.3 and 0.9 Ohms is required to give protection from about 1A to 1.5A. These values for resistors are often hard to come by, however if we link 2 or more resistors in parallel we can achieve these values. Two 1.3R resistors in parallel will give us a total resistance of 0.65R which is acceptable. Refer to Fig 2 for the circuit diagram. The LEDs give warnings for power to the tracks and an overload situation. The 1A fuse can be left in circuit as added protection, but this will need up-rating to 2A if you intend double heading. There are three further optional components added to this diagram. D2 across the output helps to prevent EMF (a feedback situation from the motor which happens when power is cut, the motor acts as a dynamo for a moment generating stray currents in the system). C1 and C2 are designed to accentuate the valleys in the output and aid slow running. C1 and C2 can be omitted, in fact it is recommended that you leave C1 and C2 out if you are going to use the PWM controller described later.
Adding PWM
So we have covered everything except starting and slow running performance, and although the basic controller in Fig 2 will perform well we still haven’t addressed this problem. The cheapest and easiest way to overcome this is to use Pulsed Width Modulation or PWM. This involves controlling speed by sending the motor pulses of FULL POWER of varying widths. This means that the motor has much more power and torque at low speeds than a standard controller can provide. Furthermore, the problem of overcoming inertia as the motor starts is done away with because the motor gets a big injection of power from a series of very short pulses allowing the motor to ‘pull’ at what appears to be crawling speed.
We can create a simple PWM without very complex or expensive electronics. If we use the tried and tested ‘555’ timer chip there are a number of different configurations we can try. Furthermore we can simply supply the pulse output from our timer chip to feed the final output and overload circuit already described by feeding the output pulse from the circuit here to the base of TR1
The 555 chip can be wired up to perform a vast number of functions. It’s timed output is defined by an ‘RC’ network. This is the effect created when a resistor and a capacitor are wired together. I will not try to go into detail here, suffice to say that if we use resistors and capacitors of known values then we can get a timing pulse of a known frequency. There are literally hundreds of websites devoted to the 555 timer chip including calculators and basic circuits. What is of particular interest to us is pin 5 of the 8 pin DIL 555 chip. Pin 5 is rarely used in standard 555 circuits, but to us it is a godsend. The function of pin 5 is to alter the length of the output pulses from the chip in relation to a ‘reference voltage’ applied at the pin. In essence, our standard voltage divider VR1, if fed to pin 5 of the chip will alter the length of the pulses issued by the chip. These can then be fed directly into our output stage and give us a pulse width modulated controller!
The resistor between pin 7 and Vcc is simply to prevent it from being left ‘hanging’. The resistor between pins 2 and 3, along with the capacitor between 2 and ground set the operating frequency. The capacitor should be a non-polarised 0.1uF (100nF) type (usually marked ‘104’). You can use a ceramic disk if that’s all you can find but I recommend you use a higher quality mica or polystyrene type.
The value of the resistor between pins 2 & 3 should be between about 33K and 150K. Using a 100K resistor will do fine. The resistor value should set the mid range frequency to around 150Hz (pulses per second). The reason is that I have found that model loco motors will judder below about 30Hz and complain or give up entirely above 1kHz.
The circuit shown does not follow standard practice, I can’t remember where I first came across it, but I have used it for more than 10 years as a basic PWM generator and it works, so credit must really go to whoever designed the original version. When 0V is applied to pin 5 a multi-meter will read the pulses as the equivalent of between 5 and 8 volts at the output, but an oscilloscope reveals that it is actually less than ‘1 volt’ since the pulses are less than 2% of the wavelength. As the voltage at pin 5 is increased to Vcc the output goes up to 98% of full power.
Unfortunately, although the lowest setting will bring the loco to a halt, a series of tiny pulses is still present in the rails, this can lead to strange sounds coming from certain loco motors. If you can get hold of a 10K linear potentiometer fitted with an ‘off’ position SPST switch then wiring this into the output will ‘kill’ all pulses at the output. If not I would add a SPST switch somewhere in the output from the 555 to prevent stray noise.
This circuit is not the most elegant PWM solution we could have arrived at using the 555. One potential problem is that this circuit changes the frequency as well as the pulse width. As long as the frequency remains well within the limits discussed this should not prove to be a problem.
We could have done better by using two 555’s. The first set up as a fixed frequency generator, triggering a second 555 as the PWM generator, however that remains for another day.
Simulated Inertia and Braking
Now, since we are controlling the loco from basically a simple voltage divider (VR1), there is no reason why, since we have now overcome the problems of starting and slow running, that we cannot finally introduce simulated acceleration and braking. In this scenario, capacitance is used to slowly build up the voltage fed to pin 5 and slowly reduce it under ‘braking’ for a more realistic operating practice. I like to be able to switch this in or out so that the controller can be used conventionally as well. The circuit below shows how our original voltage divider becomes simulated inertia and braking.
Output 'A' is fed to either pin 5 of the 555 circuit .... or ....
As an aside, the inertia and braking could be added to the circuit in Fig 2 if PWM is not required.
Power Sources
All these controllers, including the final version, are low parts count and simple in execution. I usually build mine on vero-board, but if you have access the PCB making equipment then you could probably shrink even the final version to a very small board. Indeed the PWM version should not need a heat-sink since the final drive transistor is not put under any real load. Good quality enclosures, knobs and components can be sourced from RS, Farnells, Maplin and Radio Shack (amongst others) and designing your own panel mounts is easy using these controllers. Pricing the final version including a suitable enclosure came to less than £15.00 at time of writing, and this compares very favourably to a similar PWM controller with simulated inertia and braking (£65.00 retail from at least one manufacturer).
Because of the inherent losses and ‘taxing’ in these circuits you should feed them with between 15 and 19Vdc, excellent and cheap sources of regulated or smoothed supplies are car battery chargers, CB radio PSUs or PSUs from old laptops or printers. These are available second hand from about £5.00 at boot fairs or e-bay and generally you can run one controller per 2 amp rating. Since most CB power supplies start at 3A they can easily run a controller and lots of accessories such as LEDs etc on your layout.
Anyone with additions or ideas for these or other simple controllers can feel free to contact me.