What's new
What's new

For VFD academics and circuit level fans. VFD internal operation question?


Mar 5, 2009
California, USA
My interest is looking at somebodies way of interpreting current and voltage readings at the output of a VFD.
And then adjusting the PWM pulse widths accordingly. Flow charts or just anything that describes how it is done.
That is just writing up to three timer counter registers with the next value in a feedback loop. So my question is how do I loop?


There is a circuit I made in 2016 and some test sockets. Generated space vector PWM.
Adjusting one or all of those pulse widths in a single cycle, depending on measured conditions and what mode is programmed.
Fascination for more expensive VFDs with color LCD screens cannot be helped. Got reminded about all this while shopping for a new VFD.

I have a couple VFDs that have easy access to the components and the goal is to use the existing drive circuits.
Last edited:
VFDs using sensorless vector control do this. They adjust the waveforms on the fly based on feedback from the windings of the running motor. You might start by looking at the algorithms they use for this.
I'm trying to ask here who would know of any algorithms. Sensorless vector is one way. PID is easy to look up.
"feedback from the windings" - how is it done? What devices are used?
Last edited:
For sensing, current transformers or maybe hall effect sensors (DC) would be my expectation. Current shunts are possible but a bit lossy. The software looks at the current waveform, compares it to the voltage waveform, and does lots of maths. Sensorless vector involves a lot of maths.

For most situations (except where you want the maximum possible ramp rates, and/or aren't using induction motors), plain old V/f is much simpler to implement and perfectly adequate. You don't need the current sense except for overload detection, perhaps reduce ramp rate to prevent an overload trip, and for monitoring.

This would be my approach...

You determine the desired output frequency, and only 'slow' changes (e.g. 2 second ramp) are made to this, except in a trip.

Have a 'clockface' that sweeps through the 360 degrees in a circle. Each software 'tick' (e.g. 1-2ms, likely each 1/2/3/4 PWM periods), you advance the clock by the number of degrees required given the current operating frequency. E.g. at 10Hz output, you are doing 3600deg/sec, or 3.6deg/ms. Radians might be better, or just fractional revolutions.

Each tick, you calculate based on the clockface position what the sine of each of the three phases is - this might be a lookup table, because running a few thousand sine calculations a second is beyond basic micros.

You then scale each of those sines by the voltage demanded by your current frequency - either a lookup table or a multiplication. This gets you the value that gets fed into your PWM channels.
I have all that done. The software that adjusts PWM frequency is here. The names MCMAT0, MCMAT1, MCMAT2 are timer registers that control each three phase output.
This interrupt handler executes at the carrier frequency using a 512 element cosine lookup table is used to avoid math functions.

So I can imagine in a real VFD the output does not always follow a sine wave hump. I here it comes down to constantly adjusting the variables tsv0, tsv1, tsv2.

void MCPWM_IRQ_Handler(void)
register uint32_t tsv1_index;
register uint32_t tsv2_index;
register uint32_t tsv0;
register uint32_t tsv1;
register uint32_t tsv2;

/* Clear limit interrupt */

tsv1_index = integrator >> INTEGRATOR_SHIFT_FOR_INDEX;
tsv2_index = (COSINE_TABLE_SIZE - 1) - tsv1_index;
tsv1 = (cosine_table[tsv1_index] * delta_t_2) / COSINE_TABLE_SCALER;
tsv2 = (cosine_table[tsv2_index] * delta_t_2) / COSINE_TABLE_SCALER;
tsv1 = (cosine_table[tsv1_index] * delta_t_2) / COSINE_TABLE_SCALER;
tsv1 = (tsv1 * modulation_index) / 100;
tsv2 = (cosine_table[tsv2_index] * delta_t_2) / COSINE_TABLE_SCALER;
tsv2 = (tsv2 * modulation_index) / 100;
tsv0 = ((delta_t_2) - tsv1 - tsv2) / 2;

case 1:
MCMAT0 = tsv0;
MCMAT1 = tsv0 + tsv1;
MCMAT2 = tsv0 + tsv1 + tsv2;
case 2:
MCMAT1 = tsv0;
MCMAT0 = tsv0 + tsv2;
MCMAT2 = tsv0 + tsv2 + tsv1;
case 3:
MCMAT1 = tsv0;
MCMAT2 = tsv0 + tsv1;
MCMAT0 = tsv0 + tsv1 + tsv2;
case 4:
MCMAT2 = tsv0;
MCMAT1 = tsv0 + tsv2;
MCMAT0 = tsv0 + tsv2 + tsv1;
case 5:
MCMAT2 = tsv0;
MCMAT0 = tsv0 + tsv1;
MCMAT1 = tsv0 + tsv1 + tsv2;
case 6: /* fall through */
MCMAT0 = tsv0;
MCMAT2 = tsv0 + tsv2;
MCMAT1 = tsv0 + tsv2 + tsv1;

integrator += (angle_delta / 100);
if (integrator > INTEGRATOR_SIZE - 1)
integrator = integrator >> INTEGRATOR_SHIFT_FOR_INDEX_OVERFLOW;
if (sextant == 6)
sextant = 1;
Last edited:
I designed VFDs for about 20 years and could go into this in more depth but not right now.
When I look at articles like this I find the need to ask questions.

I have this Allen Bradley 3 Hp VFD and the daughter board on top is the control. I thinking about adding my own control board with a color LCD display.

I have two other Hitachi Tosvert-130 15 Hp VFDs that came out of a high school dumpster. I asked the school principal if I could haul them away. She said ok.
The two VFDs had something to do with the schools swimming pool water pump(s) during renovations.
Anyway, the feedback theory and feedback devices is where I'm lacking.

Last edited:
The intricacies of FOC/vector maths is a bit beyond me.

I will note that if you're at all limited by compute power, then those divide-by-100s ought to go. Division by power of two (e.g. 128) is a single-cycle command as it's implemented by bitshift. Integer division is often implemented as a single cycle command on expensive silicon (e.g. Cortex M3/M7). Cheaper/slower options use e.g. 17 cycles on some ARM M23 cores, and tens to hundreds if it's implemented in software by the compiler. M0, M0+, and M1 have no hardware divide function. Even where a 'single-cycle' hardware divide is present, pipelining can result in unexpected performance issues.

Addition and subtraction are usually single-cycle and multiplication is often (but not always) single cycle too.
LPC1769 Cortex M3 with built-in 3-phase motor control.

Look at the "Summary" section. The expanding/contracting pulses (pink,purple,green) are the widths of the three timer outputs.
They are added/subtracted to produce what is in post #1. The stuff I wrote in the interrupt handler came from a book with a table of transistor on times.
A two channel scope on the pink output and the purple inverse outputs with a add function produces the scope waveform in post #1.
Every time I look back at this stuff I have to re-learn it.

Last edited:
The "how" of feedback has various answers. A classic way to do it is to read the current between pulses, so that you get the response from the winding. That will be the actual winding current, the result.

What also can be done, is to first model the motor, which is done via the test currents that typical vector drives do when being set up. Then the VFD calculates what the current should be, given all the inputs. Measurements on the fly are theoretically not required but may be done.

Then, when a particular current and phase angle are desired, the appropriate pulse and pulse timing can be calculated.

That normally requires a good deal of processor HP, even though the calculation can be done "in spare time" via interrupts etc.
Last edited:
Voltage is easy; big voltage dividers.

For current, yeah, hall effects are one option, but also just a good old-fashioned shunt resistor. I know some people are doing fancy work in the power electronics space by using the (calibrated and probably temperature compensated) on-state resistance of switching FETs as the current shunt, but I don't think that's a thing in the VFD space - it doesn't work with IGBTs.

Eaton has an application note with some info about how some of their drives do it:

Current control and overcurrent protection on the
9000X drive is based on motor current measure-
ment in all three phases. In the FR9/CH61 and
above drives, the current sensors are built into
the IGBT SKIP modules, and the current signals
are combined and fed into a 14-bit A/D converter
on the lower ASIC board. The ASIC board sends
the current levels to the control board via a fiber
optic serial link. In the smaller drives, FR8/CH5 and
below, the measured current signal is fed directly
to the control board. The SVX has a 10-bit A/D
converter and the SPX has a 14-bit A/D converter.
It isn't really sensor-less mode. It's no sensors on the motor side but sensors on the VFD side.
The issue is reading a analog current/voltage with a device that scales it to say a 16 bit number.
Only need two sensors for current and two sensors for voltage.
Last edited:
Just read the current or voltage... I know. Another part of "how" is what device(s) do modern VFDs use?

The hall effect sensors are reasonably cheap, and work well. They also have very little voltage drop. Voltage is just a divider from the appropriate point, possibly with some extras depending on how the analog inputs work on the processor..

The controller is normally on the "hot side", with the communication handled by some optical couplers from the hot side to the interface controller and accessible control terminals. So the controller can usually take the signals directly.

In some very high power units, the controller may be isolated. That takes extra parts and complication.
It isn't really sensor-less mode. It's no sensors on the motor side but sensors on the VFD side.
Yes, no external sensors. Many older drives, servo drives, DC drives, and other kit required shaft encoders on the motor.

Full three-phase sensing is preferable. Otherwise you can end up with near-undetectable ground faults.

I believe most drives I've dealt with have a hot side controller running the sensors and PWM, and a cold-side controller doing IO. This minimises the number of isolators required.
I see categories sensorless vector or vector drive.


For example, the Hitachi P1 (LCD) series is a "vector" drive.
In the description: "V/F free setting (30-400 Hz of base frequency) constant torque and reduced torque of V/F control. Sensorless vector control"

The Hitachi C1 (LED Segments) series is a "sensorless vector" drive.

Last edited:
Sensorless vector drives use the back emf developed when the winding is not energized, to sense the rotor speed. I suspect they use a PID algorithm to adjust the power to the windings to maintain the setpoint speed. The PID constants are computed during an auto-tune sequence where the armature is spun in varying speed ranges - at least in the hitachi drives.
  • Like
Reactions: JST
I have two other Hitachi Tosvert-130 15 Hp VFDs that came out of a high school dumpster. I asked the school principal if I could haul them away. She said ok.
The two VFDs had something to do with the schools swimming pool water pump(s) during renovations.
Anyway, the feedback theory and feedback devices is where I'm lacking.

Idea on this was to use existing high voltage parts and just change out the control board. It was 8051 based.
The lower box is 460 V but there are parts in there like this interlocked switch which might be useful.
Center: both off. Right: left switch on. Left: right switch on.
The switch is used to direct normal input 3 phase or the generated 3 phase to the output terminals.

Here is the half-bridge driver board. Notice the six white connectors on the right. Fire pulses to the IGBTs.
The cpu board mounts to the reverse side.
Here is older style IGBT packs. Toshiba MG50N2YS1 half bridge. I would have thought it isn't so great to have a bunch of wires hanging all over.

Here is the current sensor for total incoming current.

Here is the current sensor for the 3 phase output. Only two wires out of three need a measurement. Sum of currents rule.
Last edited:

Here is the current sensor for the 3 phase output. Only two wires out of three need a measurement. Sum of currents rule.
Theoretically, yes.

In reality, not so much.

It leaves the one unsensed output vulnerable to currents which do not return on one of the other wires. For instance, line to ground faults, which can blow the IGBTs with no sensing and so no drive cutoff.
How to size a reactor according to the net. Agree/disagree?

A 3% line reactor will drop 3% of applied voltage at full rated current.

L = Xl / (2 * pi * f)

Xl - X sub-l which is the inductive reactance.
pi - 3.14159
f - frequency
L - inductance

example for 3%:
Applied voltage = 240 Vac
Current = 25 A
240 V / 25 A = 9.6 ohms
9.6 * .03 = 0.288 ohm
L = 0.288 / (2 * pi * 60) = .763 mH

What about a load reactor dealing with frequency changes?
Why do you want a 5% instead of a 3% reactor?
Last edited: