On 4qd.co.uk we sell a range of motor controllers and accessories for your projects

Circuits Archive


PWM controllers - Part 5


This is the fifth in a linked series of articles.

Sections, this page


When you suddenly increase demand speed, it is not desirable for the controller to respond immediately. A fine example of the problem this causes is where the input device is a foot operated pedal. Put your foot on the throttle, the vehicle lurches fast forward and your body is thrown back, so your foot reduced pressure on the pedal. A result known as kangaroo electrics!

A similar argument apples to deceleration, as the controller has regenerative braking.

So the controller has to respond at a controlled rate whenever the input changes are rapid. Much can be argued about what acceleration rate is 'best': the short answer is that there is no best and the ideal response depends on the vehicle and on the driver.

The 2QD has only a simple CR ramp, 220K and C8. This is not ideal: it's OK on acceleration, but the ramp rate depends on the level of the applied input, so decelerating is very slow as the controller approaches zero speed. It's also not adjustable.

The TEC library has a page of ramp circuits available to members. Circuit 8 on this is the one that we use on most controllers.

This gives linear ramps (constant dV/dt) which are adjustable separately for positive (acceleration) and negative (deceleration) slopes, over quite a respectable range.

This constant dV/dt appears to be one of the most acceptable ramps for most slow speed vehicles and is widely used in the industry. However it becomes non ideal as the vehicle sped increases. The reason for this is that you need a lower dV/dt so that acceleration occurs for a longer time. But the acceleration ramp starts from zero output. Now any loaded motor will not start doing anything until the current has built up to a value which depends on the machine's mechanics. When ramping up from zero, there is then a pause before anything happens that the rider can perceive. Then the motor current will start to build up until the machine is accelerating at the same rate as the voltage ramp is rising. At this point, the machine will be accelerating at a constant motor current, until near full speed.

It should be evident from this that the ideal ramp is quite complicated - and setting it up properly would require a deal of technical awareness from the installer, even if a manufacturer were to offer a suitably programmable system! So the constant dV/dt is the most used compromise.


There is no reason, in many applications, why the vehicle rider cannot simply throw a double pole changeover switch when they want to reverse and this is exactly what a lot of model locomotive systems do. Of course you must not change direction while the machine is moving: that should be self evident and if anyone trashes their car engine or gearbox by throwing it into reverse at speed, nobody would have sympathy. But for some reason, if an electric vehicle controller or motor can be trashed by trying to reverse at speed, it seems to be blamed on the controller. So reversing controllers have to do so safely. To reverse safely, you must only do so while the motor is either stopped or rotating slowly. In most commercial controllers, this involves measuring the motor speed and only allowing reverse at zero armature voltage.

Our early reversing controllers used a different system: they would only change direction if the demand speed (after processing by the ramp) was at zero. This is 'pre-select' reversing in that the direction switch has no effect at all until the user reduces speed to zero. The vehicle will then start off again in the pre-selected direction. The system works fine and would be in use today, but there is one time when it is not acceptable.

Consider a joystick controlled system. Here it is very easy to waggle the stick quickly from forward to reverse. If this is done, then the pre-select will not do anything as the speed has not been held at zero long enough to be accepted, so joystick reversing won't occur! What is needed is a direction latch (which needed anyway, as the demand direction may be changed at anytime, and the present direction has to be remembered) and a comparator of some sort which compares demand direction with latched direction and gives an output when there is a conflict. This 'change direction' request must cause the demand speed to be ramped down to zero, when the direction latch can change and the 'change direction' request will then zero. Then the controller ramps up to the required speed in the new direction.

This is 'Dual Ramp' reversing. The almost universal system used on any reversing controller. It looks a little more complicated than the 2QD! Not all of that has to do with ramping and reversing however.

NCC series controllers

We can now introduce the circuit of the NCC series controllers.

Ignition circuitry

The ignition switch applies a voltage to the base of Tr3, turning it and Tr 2 on. Tr3 turns on the current source (Tr6 and Tr7) which powers up the controller. Tr2, when it is not conducting, allows current to flow from 9v supply through its 10K collector resistor and the diode into the base of Tr25, which is the speed clamp (part of the dual ramp reversing circuitry). The result is that, when the ignition is turned off, Tr25 is turned on and causes demand speed to be reduced to zero, so the controller ramps down to zero speed.

Also into the collector of Tr3, there is a 4K7 resistor. This is fed from the output charge pump, so the 4µ7 (near Tr5 on the circuit) is kept fully charged when the output is switching. When the ignition is turned off, the charge on this capacitor holds on the current source, so the 9v rail is maintained while the controller is ramping down to zero speed. Only then (when the output stops switching) does the 9v rail switch itself off.

There is a slight delay in the switch off: this is necessary because, at full speed, the controller is not switching, so without the delay, the controller would de-power immediately the ignition was switched off. The delay should (if the gain is set up correctly) allow time for the controller to ramp down slightly from full sped, so it is switching before this delay expires.

This method of powering down is also a safety feature. If the MOSFETs have blown, then (just possibly) the drive MOSFETs have failed short circuit. That is dangerous and a failure mode (fortunately very rare) that all controller manufacturers fear as the machine has failed to full speed. But in such an event the output won't be switching, so the relays will de-power after the delay period, bringing the machine to an emergency stop by shorting out the motors.

In fact, we have had controllers 'fail' to full speed. But in every case so far this has been caused by water getting onto the circuit board, or some similar event. Of course, no controller manufacturer can design in response to water contamination, although we do dip every board in a water resistant conformal coating.

Input buffer and Ramp circuitry

IC1a is simply an input buffer, to drive the ramping circuitry. Tr1 s normally turned hard on, so pin 1 is pulled up to 9v by the 10 resistor. At zero speed, pin 1 is low. When speed increases, IC1A pin 1 will go high. Tr21's collector will rise and current will flow through the Accel preset to change the 4µ7 on the base of Tr21. But if the current through the preset is excessive, Tr21 will turn ot, causing Tr20 to rob current. Thus the charge current (which controls the dV/dT) of of the 4µ7 is controlled by the preset.

On deceleration, pin 1 is low and the diode to Tr22's collector carries the discharge current from the 4µ7 ramp capacitor. So the discharge rate is controlled by the Decel preset.

Pot fault protection

Tr1 is turned on by the current in the speed pot. If the current in the speed pot goes too low, Tr1 turns off and there is no longer anything pulling up pin 1 of IC1a, so the demand speed falls to zero. The pot current will go low if a wire to the pot has broken, or if the track of the pot has broken. This circuit then ensures that pot and wiring faults are all fail-safe.

Ramp Clamp

Tr25 is the 'ramp clamp'. It shorts out IC1a pin1, reducing the demand speed to zero, whenever it is turned on. It is turned on either by an output from the direction change request circuit, or by the signal from the ignition circuit, when the ignition is turned off. In either case, tuning off the demand speed will cause the controller to ramp down to zero speed.


You may also note that the pwm oscillator (IC1b) is different to that used on the 2QD. Both circuits have been described on 4QD-TEC PWM Modulators page. The diode oscillator uses fewer components than the earlier one, is more predictable as its and trough level is dependant upon obe diode rather than two resistors, and the waveform doesn't require level shifting before it can be used.

Demand zero detector and Parking Brake driver

IC2d compares the demand speed with a reference voltage of 200mV, derived from the diode. When the demand speed is below this threshold, pin 14 is low. Pin 14 controls the latching of the direction latch, and also operates the parking brake driver, Tr 31 and Tr32. There is a diode/capacitor input to the brake driver so that it powers up quickly (applying power to the parking brake, to release it) but de-powers slowly, removing power from (and applying) the parking brake after a short delay.

Reverse signal inverter

IC2c is an inverter, required because we need to compare the required direction with the latched direction. An inverted is required so there are two signals, one high for forward request and the other high for reverse request.

The direction switch is closed for reverse, so Tr10 is conducting for reverse and pin 10 of IC2c is low. Therefore pin 13 is high for reverse, low for forward requested direction.

These signals are input to the direction change request logic and pin 13 also feeds the direction latch.

Reversing Latch

The reversing latch consists of IC2a and IC2b. It is a two state bistable flip-flop made with two comparators. There seems to be no proper name for this latch: it has 3 states: both outputs off, one high or other high. Both are (low) off when pins 5 and 7 (driven from the demand zero detector) are low, or when there is no demand speed. When there is demand speed, the latch flips or flops, depending on the state of pin 13.

Direction change request logic.

There is a diode bridge connected to the outputs of the direction latch. This is actually two diode-resistor AND gates, with the other two diodes forming an OR gate so the output is high when Forward AND Reverse OR Reverse AND Forward, where one Reverse is demand and the other is Latch. Aren't diodes wonderful....

Reversing relay drivers

The outputs of the latch drive two relay drivers. These are complementary Darlington arrangements (Tr 29 and Tr30, and Tr 28 and Tr28). They are darlingtons because, although the relay current is never more than 100mA, we need a high input impedance (the 100K resistors)or the high states of the latch would not operate the ramp clamp diode logic gates.

Reverse Speed reduction

The output of IC2a (which is defined as being Reverse) drives the base of Tr26. This switches in a 10K resistor to the ramped demand speed line. There is a 10K resistor between the ramp follower (Tr14) and the modulator input, so when half speed engages, the demand speed is halved. There is a pinstrip header which can be removed to disable the reverse speed reduction.

Current limit operation

05-cl To understand the way the current limiting operates, consider the simplified circuit, right. We are trying to sense the current in the bottom MOSFET. When this MOSFET is conducting, it will have across it a voltage drop (Vs) equal to I times Rds(on), since conducting MOSFETs are resistive. This voltage 'lifts' up one end of the potential divider chain R3, R4, D1, so that the voltage on pin 10 of the comparator rises with increasing motor drive current.

When the MOSFET is turned off, there is a high voltage across it, as there is during the period it is switching, So during these periods, the circuitry turns on the transistor shown as Tr15 so that the sensing is disabled. The diode, D1, is of course needed for Tr15 to be able to work (of Tr15 would itself be trying to drive the motor!).

To the other input pin (11) of the comparator is fed a reference voltage. Both this and the sense voltage are derived from the 9v1 rail. Now we have a diode (D1) in the sense path and the drop across a diode is a strong function of its temperature. So another diode, D2, is included in the reference potential divider, so that the two diode temperature changes track each other, cancelling out so don't affect the circuit's operation.

The actual value of the current limit can be altered by varying R1 or R2. The circuit will automatically compensate for a wide variety of MOSFETs, since it uses the MSFET as its own sensor.

However - the Rds(on) of a MOSFET varies as the MOSFETs junction temperature varies, so that the current will cut back automatically as the MOSFET heats. This means that the circuit is very safe and can be reliably pushed close to MOSFET published limits, but it does also mean that the method cannot be used for precision current sensing, except when the MOSFET current is kept low enough that junction heating is insignificant.

Other relevant pages

Part 1
Part 2
Part 3
Part 4
Part 6
Part 7
Part 8
Contact Home Search

Page Information

© 2002-2011 4QD-TEC
First published: 3rd of January, 2002.