PID Control for Current

PID Control for Current: Current Loops in Motor Drives, Power Converters and Constant-Current Systems
Current control is one of the fundamental feedback functions used in motor drives, servo amplifiers, DC/DC converters, battery chargers, power supplies, LED drivers, electromagnets and many other power-electronic systems.
A simplified closed-loop structure is:
Current reference → Current measurement → PI/PID → Voltage or PWM command → Power stage → Load current
But a statement such as “maintain 10 A with PID” is still incomplete.
The engineer first needs to know:
Is this DC current?
AC RMS current?
Instantaneous motor phase current?
A transformed d-axis or q-axis current?
Where does the current reference come from?
What voltage or PWM variable can physically change the current?
In many power-electronic systems, the current loop is one of the fastest control loops. Slower speed, voltage or power controllers often generate a current reference rather than driving the switching devices directly.
For the general feedback concept, see What Is PID?.
What Is Electrical Current?
Electrical current describes the rate of movement of electric charge.
Fundamentally:
I = dQ / dt
and the unit is:
ampere - A.
For control purposes, however, the word current may refer to:
instantaneous current,
average current,
RMS current,
peak current,
phase current,
DC-bus current,
d-axis current,
q-axis current.
The 10 A value shown on an HMI is not necessarily the same signal used by a fast current controller during every PWM cycle.
DC Current and AC Current Control Are Different
In a simple DC circuit, current magnitude and direction can be evaluated directly.
In an AC system, instantaneous current continuously changes with time and may reverse direction every cycle.
Therefore control and monitoring may use:
instantaneous current,
RMS current,
phase currents,
current vectors.
A three-phase motor drive can regulate instantaneous phase-current information at high speed while the operator display shows a slower filtered RMS or motor-current value.
A motor drive displaying “20 A motor current” does not mean its inner current controller is simply holding one constant 20 A value. Vector drives commonly regulate transformed current components inside the motor-control algorithm.
Why Is Current Usually Controlled So Quickly?
For an ideal inductor:
V = L × di/dt
and for a real winding, resistance and back-EMF also matter.
A simplified motor or coil equation can therefore include:
V = R × I + L × di/dt + back-EMF
This means current is changed by applying an appropriate voltage across the electrical load.
In a switching converter or motor inverter, that effective voltage is produced by PWM.
Current changes quickly compared with many mechanical or process variables, and semiconductor current limits are also critical.
For this reason the current loop is normally much faster than outer:
speed loops,
power loops,
voltage loops.
Does Current Control Require Full PID?
No.
The page topic is PID current control, but many real current regulators use PI control rather than full P-I-D.
Current feedback can contain:
PWM switching ripple,
ADC quantization,
sensor noise,
commutation-related components.
Derivative action is sensitive to these high-frequency components.
This is one reason high-performance current regulation is routinely achieved with PI controllers.
Current control does not become “better” simply because a D term is added. In motor FOC and many converter applications, PI current controllers are the normal engineering choice.
The individual terms are discussed in P, I and D components.
How Is Current Measured?
A current loop is only as useful as its feedback measurement.
Common current-sensing technologies include:
shunt resistors,
Hall-effect current sensors,
current transformers - CTs,
Rogowski coils.
These technologies are not interchangeable.
The correct choice depends on:
DC or AC measurement,
isolation requirements,
measurement bandwidth,
current range,
accuracy,
power loss.
Current Measurement with a Shunt Resistor
A shunt is a low-value precision resistor placed in the current path.
Its voltage drop follows Ohm's law:
Vshunt = I × Rshunt
For example:
10 mΩ × 20 A = 200 mV
This voltage can be amplified and measured by an ADC.
But the shunt also dissipates power:
Pshunt = I² × Rshunt
As current increases, dissipation increases with current squared.
Shunt selection is therefore a compromise between:
measurement signal amplitude,
power loss,
thermal drift.
High-Side and Low-Side Current Sensing
Low-side sensing places the shunt near the ground-return path.
The measurement circuit can be relatively simple, but the shunt introduces voltage into the load's ground path.
High-side sensing measures current from the supply side.
This preserves the load-ground connection and can make certain faults easier to detect.
However, the current-sense amplifier may have to tolerate a large and rapidly changing common-mode voltage.
This becomes especially important in PWM motor drives and high-voltage converters.
Hall-Effect Current Sensors
Hall-effect current sensors measure the magnetic field produced by current.
Depending on sensor architecture, they can offer:
galvanic isolation,
low insertion loss,
bidirectional measurement,
DC and AC measurement capability.
Important design considerations include:
offset,
temperature drift,
bandwidth,
response time.
Can a Current Transformer Measure DC?
A conventional current transformer - CT depends on changing magnetic flux.
It is therefore not suitable for directly measuring steady DC current.
CTs are widely used for AC current measurement, power metering and many high-current applications.
Important CT parameters include:
frequency range,
turns ratio,
burden,
core saturation.
Conventional current transformers and Rogowski coils do not directly measure steady DC current. Shunt-based and suitable Hall-effect sensing technologies can.
What Is a Rogowski Coil?
A Rogowski coil is useful for measuring large and rapidly changing AC or pulsed currents.
It does not rely on the same ferromagnetic-core principle as a conventional CT and can provide wide current range and bandwidth.
However, its output is related to the rate of change of current.
An integrator and other signal conditioning are therefore required.
It is not a sensor for steady DC current.
Current-Sensor Bandwidth Matters
If the current loop is fast, the complete measurement chain must also be sufficiently fast.
The chain includes:
current sensor,
amplifier,
analog filter,
ADC,
digital filtering.
Each element can introduce delay.
A current controller cannot correctly regulate information it receives too late.
This makes time delay and system dynamics especially important in current control.
How Does PWM Control Current?
A switching power stage does not normally operate its semiconductor devices continuously in a partially-on linear region.
Instead, the devices are rapidly switched and the effective voltage applied to the load is controlled.
The current loop may operate as:
Current error → PI controller → Voltage command → PWM → Power stage → Current
The load inductance prevents current from following the switching voltage instantaneously.
This allows a high-frequency switched voltage waveform to produce a much smoother controlled current.
PWM Frequency, ADC Sampling and Control Frequency Are Different Things
A converter might operate with:
20 kHz PWM,
a current measurement taken once or twice per PWM period,
a control algorithm executed at a defined synchronized rate.
These are related timing parameters, but they are not the same thing.
In motor-control systems, ADC sampling is often intentionally synchronized with PWM timing to avoid measuring directly on noisy switching edges.
Current-loop tuning is not only Kp and Ki. ADC sampling instant, PWM update delay and calculation time are part of the loop dynamics.
This is directly related to real-time PID control.
Current Control Inside a Motor Drive
In modern VFDs and servo systems, current control is typically an inner high-bandwidth control layer.
A simplified hierarchy can be:
Position loop → Speed loop → Torque/current reference → Current loop → PWM → Motor
This means the speed controller does not directly switch the motor phases.
It generates a torque-producing demand that a much faster current-control layer attempts to realize.
This links current control directly with PID speed control, PID torque control and PID control with servo motors.
What Are Id and Iq in Field-Oriented Control?
Field-Oriented Control - FOC transforms three-phase motor-current measurements into a rotating d-q reference frame aligned with the rotor magnetic field.
The resulting components can be treated approximately as:
Id - flux-related current component,
Iq - torque-producing current component.
Separate PI controllers can regulate Id and Iq.
The PI controllers generate:
Vd
and:
Vq
voltage commands.
Inverse transformations and PWM modulation then convert these voltage commands into switching commands for the three-phase inverter.
FOC does not normally contain one generic “motor current PID”. It can contain separate closed-loop regulators for d-axis and q-axis current components.
Iq and Motor Torque
In many field-oriented motor-control systems, q-axis current is closely related to torque production.
A typical sequence is:
mechanical load increases,
motor speed begins to fall,
speed error increases,
speed controller requests more torque,
Iq reference increases,
current controller produces the required motor voltage vector.
This is why motor current is not merely a parameter observed on the drive display.
It is part of the actual electromagnetic control process.
Current and Torque in DC Motors
For a DC motor, electromagnetic torque is approximately related to armature current by:
T = Kt × I
under the appropriate flux conditions.
A motor-current limit can therefore also act as an approximate torque limit.
Vector-controlled AC machines use a comparable torque-current principle inside a more complex rotating reference-frame model.
Increasing the permitted motor current can mean increasing available mechanical torque, not simply allowing a larger electrical number on the display.
Current Control and Current Limiting Are Not the Same Function
Current control continuously regulates actual current toward a reference.
Current limiting restricts the maximum current the system is allowed to demand or deliver.
For example, a speed controller may request very high torque.
But if the drive reaches its configured current limit, the current reference is restricted.
The drive may no longer be able to maintain the requested speed.
Current limit is not a PID tuning parameter. It is a physical or configured boundary on the amount of electrical and mechanical effort the system may produce.
Motor Overload and Instantaneous Overcurrent Are Different
A motor may tolerate current above rated value for a limited period.
Motor overload protection can use:
current magnitude,
time,
thermal model,
motor temperature
to determine thermal stress.
A semiconductor short circuit or destructive instantaneous current is a completely different event.
Fast protection may use:
hardware comparators,
cycle-by-cycle current limits,
desaturation detection,
fast electronic trip functions.
The normal current PI/PID loop is not short-circuit protection. Semiconductor overcurrent protection may need to act far faster than the normal control loop.
Where Does the Current Reference Come From?
The current setpoint depends on the application.
In a motor drive it may come from:
the speed controller,
a torque reference.
In a battery charger it may come from:
the charging algorithm.
In a power converter it may come from:
a voltage controller,
a power controller.
In an LED driver it may come from:
a brightness command.
The current loop is therefore frequently the inner slave loop of a larger cascade-control system.
Voltage Loop and Current Loop Cascade
A DC power supply or converter can use:
Outer loop: Voltage error → Current reference
Inner loop: Current error → PWM duty
The current loop is designed to respond substantially faster than the voltage loop.
This gives fast electrical control while allowing the outer voltage loop to regulate the overall output.
This is a classic application of cascade control.
Power Loop and Current Loop
If the system objective is controlled power, the structure may become:
Power SP → Power regulator → Current SP → Current regulator → PWM
The outer power loop changes slowly compared with the electrical current loop.
The current regulator directly controls the fast power stage.
d-q Current Control in Grid Converters
Three-phase grid-connected converters can also transform measured currents into a synchronous d-q frame.
With a suitable reference-frame orientation, d- and q-axis current references can be used to manage active and reactive power.
Separate current PI controllers generate converter voltage commands.
This means the fast electrical layer underneath active/reactive power control can again be a current-control system.
Current Control in a Buck Converter
A buck converter can regulate load or inductor current by changing PWM duty cycle.
The simplified process is:
current below reference,
controller increases the required effective voltage,
PWM duty changes,
inductor current rises.
However, the plant changes with:
input voltage,
inductance,
load,
switching frequency.
The same PI gains may not produce exactly the same response at every operating point.
Current Control in a Boost Converter
In a boost converter, inductor current is also a natural fast controlled variable.
Power-factor-correction systems and many regulated power supplies use an outer voltage loop to create a current-amplitude reference.
The faster current loop then forces the input or inductor current to follow the required waveform.
Current control can therefore determine not only current magnitude but also waveform shape.
What Is Current-Mode Control?
The term current-mode control covers several converter-control architectures in which power-stage current information is used directly in switching control.
Examples include:
peak-current-mode control,
average-current-mode control,
digital PI current regulation.
These methods are related but are not identical.
Depending on topology, current-mode control can provide:
fast load response,
cycle-by-cycle current limiting,
simplified outer-voltage-loop dynamics.
When a converter is described as “current controlled”, the actual current-control topology should still be identified.
Current Loop in Power-Factor Correction
A PFC converter normally controls more than DC-bus voltage.
It also shapes input current relative to the AC supply waveform.
A simplified architecture is:
Outer loop: DC-bus voltage → Current-amplitude reference
Inner loop: Input current → PWM
The voltage loop is relatively slow.
The current loop must respond fast enough to control the input-current waveform.
Constant-Current Battery Charging
One important charging mode is:
CC - Constant Current.
During this phase, the charger regulates battery charging current to a defined reference.
As the battery charges, battery voltage rises.
When the required voltage limit is reached, many charger architectures transition to:
CV - Constant Voltage.
In a CC/CV charger, the current and voltage loops do not both demand unlimited control authority. The loop associated with the active charging limit becomes dominant.
Transition from CC to CV
A simplified charging profile is:
1. Battery voltage is below the upper limit → Constant Current operation
2. Battery voltage reaches the regulation limit → Voltage control becomes dominant
3. Battery remains near the voltage target while charging current tapers downward
The actual charging algorithm must still respect:
battery chemistry,
BMS requirements,
temperature limits,
manufacturer specifications.
Current regulation alone is not a complete battery-safety strategy.
CV and CC Modes in a Bench Power Supply
Consider a laboratory power supply configured for:
24 V
with a:
3 A current limit.
When the load requires less than 3 A, the supply normally operates in:
CV - Constant Voltage mode.
If the load tries to draw more than 3 A, the current-control limit takes over and the supply enters:
CC - Constant Current mode.
Output voltage may then fall below 24 V.
A power supply reducing voltage while in current limit is not necessarily malfunctioning; that can be the correct closed-loop response.
LED Constant-Current Control
LED light output depends strongly on drive current.
LED forward voltage also varies with:
temperature,
device variation.
For this reason LED systems commonly use constant-current drivers rather than relying only on constant voltage.
Dimming may use:
analog current adjustment,
PWM dimming.
This also connects the electrical actuator layer with PID light control.
Solenoid and Electromagnet Current Control
Solenoid force depends strongly on coil current and magnetic geometry.
A high current may be needed initially to pull the armature in.
After the armature has moved, a lower holding current can be sufficient.
A driver may therefore use:
peak current
followed by:
hold current.
This can reduce:
coil heating,
energy consumption
while maintaining mechanical holding force.
Electrolysis and Electroplating
In electroplating and electrolysis, process results can depend strongly on electrical current and current density.
A constant-current supply can adjust output voltage as:
bath resistance,
electrode condition,
solution conductivity
change.
The process may also use total ampere-hours as an accumulated production variable.
Again:
instantaneous current
and
accumulated electrical charge
are different quantities.
Do Not Confuse Power Current with a 4-20 mA Process Signal
In industrial automation, the phrase “current signal” often refers to a 4-20 mA process signal.
That signal is typically used to carry measurement information.
The current-control subject on this page includes actual power currents such as:
30 A motor phase current,
10 A battery charging current,
25 A converter inductor current.
A 4-20 mA transmitter loop and a motor's 30 A controlled phase current are not the same engineering problem. One usually carries information; the other carries significant electrical power.
For instrumentation signals, see What Is an Analog Signal?.
Current-Sensor Offset Error
Sensor offset becomes particularly important at low current.
If the real current is:
0 A
but the measurement system reports:
0.3 A
the closed-loop controller treats that offset as real current.
In motor FOC, phase-current offset errors also propagate through the Clarke and Park transformations.
This is why current-sensor offset calibration is commonly performed during startup when known zero-current conditions are available.
Current-Sensor Gain Error
If current-measurement scaling is wrong, a real:
20 A
may be interpreted as:
18 A
or:
22 A.
This is not merely an incorrect HMI reading.
The closed-loop controller can regulate the real current to the wrong physical value.
Torque limiting and current protection thresholds can also become incorrect.
Verify current-feedback scale before tuning current-loop gains.
ADC Saturation
If the current-sense amplifier output exceeds the ADC input range, the digital current reading saturates.
Actual current may continue rising while the ADC remains at its maximum count.
The controller then loses information about the real increase.
The measurement range should cover:
normal operating current,
expected short-duration peak current,
the intended protection range.
Noise and Current Filtering
Switching converters naturally generate high-frequency current components.
Filtering can make current feedback cleaner.
But filtering also introduces delay.
The system therefore needs a balance between:
noise rejection,
measurement bandwidth,
phase delay.
The smoothest-looking current signal is not automatically the best current-control signal. Excessive filtering can make the feedback arrive too late.
Current-Loop Saturation and Anti-Windup
A current regulator may request increasing voltage in order to force current toward its reference.
But the converter has finite available voltage because of:
DC-bus voltage,
maximum PWM duty,
modulation limits.
When the requested voltage cannot be produced, the controller output saturates.
If integral action continues accumulating error, integral windup can occur.
Current-loop anti-windup should therefore be designed together with output saturation.
Why Motor Current Control Becomes More Difficult at High Speed
Motor back-EMF increases with speed.
As speed rises, less inverter voltage remains available to force additional changes in motor current.
Near the inverter voltage limit, the current regulator may request more voltage than the DC bus can physically provide.
This becomes particularly important in the field-weakening region.
A growing current error at high speed therefore does not automatically mean poor Kp/Ki tuning.
The loop may simply be voltage-limited.
This connects directly with motor speed control and power control.
Feedforward in Current Control
Known electrical effects can sometimes be compensated before feedback error develops.
Examples include:
grid-voltage feedforward in grid converters,
back-EMF compensation in motor control,
d-q cross-coupling compensation,
DC-bus voltage feedforward in converters.
The feedback PI controller then corrects the remaining mismatch.
This can improve dynamic response and reduce the effect of changing operating conditions.
Why Use a Current Ramp?
A reference step from:
0 A to 100 A
may be electrically possible but still undesirable.
A sudden current demand can create:
mechanical torque shock,
battery stress,
DC-bus disturbance,
magnetic saturation.
A current-reference ramp can limit current change in:
A/s
or another suitable rate unit.
The ramp generator and the PI current regulator are separate control functions.
Bidirectional Current and Regeneration
In a four-quadrant motor drive or bidirectional power converter, current can change sign.
During motoring, electrical power flows toward the mechanical load.
During regenerative braking, power can flow back toward the DC bus or supply.
The current sensor and control system must preserve:
magnitude,