This is only a preview of the June 2021 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
Circuit Surgery
Regular clinic by Ian Bell
Transformers and LTspice – Part 1
T
his month, we will look at the
basics of transformers and some
aspects of simulating transformer
circuits in LTspice.
A transformer is a passive electronic
device that transfers electrical energy, in the
form of alternating current, from one circuit
to another without using an electrically
conductive connection. A transformer
comprises two or more coils (looped
conductors) in close physical proximity,
one of which is used for the energy/signal
input (called the primary winding). This
coil creates an alternating magnetic field
which, by virtual of their closeness, passes
through the other coil(s) (the secondary
winding(s)), producing a voltage across
these windings, which will cause current
to flow if they are connected to a load.
Transformers come in a very wide
range of formats, from tiny surfacemount RF devices to the huge (size of
a house) power transformers used in
national electrical distribution networks.
In between are the transformers used
in linear and switched-mode power
supplies, pulse transformers used in
communications, audio transformers
and many other specialist types. The
key properties of transformers are that
they provide electrical isolation between
Mag netic f lux
C hang ing
current
Ind uced
vo ltag e
P rimary
Second ary
Fig.1. Basic transformer: two coils linked
by magnetic flux.
Simulation files
Most, but not every month, LTSpice
is used to support descriptions and
analysis in Circuit Surgery.
The examples and files are available
for download from the PE website.
58
circuits, they can change voltage levels and
they change they effective impedance of
a load connected via a transformer rather
than directly.
Electromagnetic induction
Electric current (DC or AC) creates a
magnetic field around a wire. If the wire
is wound in a loop the field in the centre
of the loop is more concentrated. The
fundamental physics of the transformer is
called ‘electromagnetic induction’ and was
discovered by Michael Faraday and Joseph
Henry in the 1830s (for which they were
honoured by having important SI units
named after them – the farad and henry).
Electromagnetic induction is the creation
of electromotive force (‘emf’, measured in
volts) across an electrical conductor by a
changing magnetic field. In a transformer,
a changing current in one conductor
creates a changing magnetic field which
induces an emf in another conductor. A
changing magnetic field is required for
electromagnetic induction, so although a
steady (DC) current creates a magnetic field,
AC is required for transformer operation.
Electromotive force
Electromotive force is not a mechanical
force – it is the electrical action produced
by a non-electrical energy source (eg,
chemical energy from a battery or
the electromagnetic induction in a
transformer). It drives current to flow in
a conducting circuit or produces voltage
across an open circuit due to the separation
of charge. For an open circuit, the charge
separation creates an electric field which
opposes the separation of charge in balance
with the emf driving the separation. The
open-circuit voltage is equal to the emf.
Transformer action
Fig.1 shows two coils in close proximity.
Applying a varying current to one coil
will create the magnetic field, which is
visualised as magnetic flux lines. Some
of the magnetic flux will pass through
the second coil, resulting in an induced
emf (and hence voltage across the coil).
Not nearly all of this flux passes through
the second coil so this arrangement will
Mag netic f lux
C ore
P hasi ng
d ot
C hang ing
current
+
+
–
–
P rimary: N
1 turns
Second ary: N
Ind uced
vo ltag e
2 turns
Fig.2. Transformer with core – this is much
more efficient than the transformer in Fig.1.
produce a poor transformer – it will not
be efficient in transferring energy from the
secondary to the primary. The situation can
be improved by using a transformer core,
as shown in Fig.2. If the core material and
structure is carefully chosen (particularly
its magnetic properties), then the majority
of the flux will be contained in the core and
it will therefore pass through both coils,
resulting in an efficient transformer. In the
ideal case 100% of the flux is delivered
to the second coil.
Transformer circuit symbols usually
consist of back-to-back coil/inductor
symbols corresponding with the windings.
Lines between the coils may be used to
indicate the type of core material. Some
examples are shown in Fig.3.
Fig.2 indicates the direction of the input
current and induced voltage. In order to
use the transformer correctly it is often
necessary to know which way round
the connections are. This is indicated
by using dots on the device and on the
schematic symbols, known as phasing
dots. The dotted terminals have the same
instantaneous voltage polarity – when
the dotted primary is being driven by the
positive half of the AC cycle the dotted
secondary will have a positive polarity
with respect to the non-dotted terminal.
A ir core
Ferrite/ metal
pow d er core
Metal (iron) core
Fig.3. Transformer symbols – note the
cores and phase dots.
Practical Electronics | June | 2021
Transformers
During the positive cycle the current will
flow into the dotted primary terminal and
out of the dotted secondary.
Inductors and transformers
𝑁𝑁!
A coil on 𝑣𝑣its
own
𝑣𝑣is# an inductor. In fact, a
! =
𝑁𝑁
straight wire has" inductance, but usually
an inductor component is formed from
one or more loops (turns) of insulated
Primary and secondary coil turns
wire (sometimes very many turns). The
The relationship between the primary and
# related to the number
inductance
(L)𝑁𝑁is
secondary voltage for an ideal transform
𝑖𝑖! =
𝑖𝑖#
𝑁𝑁
! (N2), but the specific
of turns squared
is determined by the relative number of
turns in each winding. Specifically, for a
relationship depends on the type, structure
primary voltage (vp) applied to a winding
and dimensions of the inductor. In general,
we can write L = kN2 so N = √(L/k) for a
with NP turns, and a secondary with NS
&𝑁𝑁! ⁄type
𝑁𝑁# (𝑣𝑣and
𝑣𝑣#
𝑣𝑣
𝑁𝑁!% of structure,
𝑁𝑁!%where k
size
turns the secondary voltage will be:
#
! given
𝑅𝑅$ = =
=
) an
*ideal
) *transformer
= ) % * 𝑅𝑅$& we
%
is
a
constant.
For
𝑖𝑖!
𝑁𝑁#
𝑖𝑖#
𝑁𝑁#
&𝑁𝑁# ⁄𝑁𝑁! (𝑖𝑖#
𝑁𝑁!
can assume k is the same for the primary
𝑣𝑣! =
𝑣𝑣#
𝑁𝑁"
and secondary windings, so substituting
into the voltage relationship above we get:
The secondary voltage is the primary
voltage multiplied by the turns ratio. This
𝐿𝐿#
+𝐿𝐿# ⁄𝑘𝑘
relationship applies to both the rms and
𝑣𝑣! =
𝑣𝑣# = . 𝑣𝑣#
𝑁𝑁#
𝐿𝐿!
peak
+𝐿𝐿! ⁄𝑘𝑘
𝑖𝑖! =values
𝑖𝑖# of the voltages. If the turns
!
ratio is 𝑁𝑁
larger
than 1 then the secondary
The turns ratio is equal to the square root
voltage will be larger than the primary and
of the inductance ratio of the windings
we have a step-up transformer. The other
(considered as individual inductors). This
way round is a step-down transformer.
%
𝑣𝑣#
𝑣𝑣! &𝑁𝑁! ⁄𝑁𝑁
𝑁𝑁!is
𝑁𝑁!%used
inductance ratio is important for setting
The
commonly
# (𝑣𝑣#latter
& in linear
𝑅𝑅$ = =
= ) % * ) * = ) % * 𝑅𝑅$
up transformers in SPICE simulations.
power
supply
𝑖𝑖!
𝑁𝑁#
𝑖𝑖circuits
𝑁𝑁to
&𝑁𝑁# ⁄𝑁𝑁
#
# obtain a low
! (𝑖𝑖#
Transformers are not simply inductors
voltage from the mains supply.
– the discussion above indicates that
A transformer transfers power from
an ideal transformer with a resistor
primary to secondary. An ideal transformer
connected to the secondary looks like
is 100% efficient so the input power will
𝐿𝐿# power, for primary and
+𝐿𝐿# ⁄𝑘𝑘the output
a resistor to the source. The inductance
equal
𝑣𝑣! =
𝑣𝑣#! = . 𝑣𝑣#
𝑁𝑁
𝐿𝐿!
of transformers does matter though, as it
secondary
(ip and is) we have
𝑣𝑣! ⁄=𝑘𝑘 𝑣𝑣#currents
+𝐿𝐿
𝑁𝑁
affects circuit behaviour and performance.
power vsi"s = vpip. From the turns equation
However, it is of less importance in some
above, this implies the current in the
applications such as mains transformers.
secondary is:
If the degree to which the primary and
𝑁𝑁#
secondary are coupled is not perfect,
𝑖𝑖
=
𝑖𝑖
!
#
Transformers
𝑁𝑁!
then the transformer will behave as part
transformer and part inductor – this is
Thus, a step-down transformer
will
take
𝑁𝑁!
𝑣𝑣! =primary
𝑣𝑣# than is
referred to as leakage inductance. Another
less current from the
𝑁𝑁
important non-ideal characteristic is the
delivered via the secondary." For example,
%
𝑣𝑣# vs = 𝑁𝑁
𝑣𝑣! &𝑁𝑁! ⁄𝑁𝑁
𝑁𝑁!% and
resistance of the windings – ideally, this
if# (𝑣𝑣
vp# = 240V
12V
(turns
ratio
!
&
𝑁𝑁
𝑅𝑅$ = = !
= ) % * ) * = ) % * 𝑅𝑅$
𝑣𝑣!𝑖𝑖!= &𝑁𝑁
𝑣𝑣## ⁄𝑁𝑁
is zero, but wires in real transformers
20:1)
and
1A
is
taken
from
the
secondary
𝑁𝑁
𝑖𝑖
𝑁𝑁
(𝑖𝑖
#
#
#
! #
𝑁𝑁"
will have some resistance. The many
the current in the primary will be 50mA
𝑁𝑁#
properties of the core are also important
(1/20A).
𝑖𝑖! =
𝑖𝑖#
! ) across the
in real transformers – one important but
If we connect a resistor𝑁𝑁(R
L
complex factor is core saturation, which
secondary, Ohm’s law tells us that vs/is = RL.
𝑁𝑁#
+𝐿𝐿# ⁄𝑘𝑘the turns𝐿𝐿ratio
#
is a limit on the maximum magnetic flux
relationships,
we
get:
𝑖𝑖! = 𝑣𝑣𝑖𝑖#= Using
𝑣𝑣# = . 𝑣𝑣#
𝑁𝑁! !
𝐿𝐿!
leading to often undesirable outcomes
+𝐿𝐿! ⁄𝑘𝑘
𝑣𝑣! &𝑁𝑁! ⁄𝑁𝑁# (𝑣𝑣#
𝑁𝑁!% 𝑣𝑣#
𝑁𝑁!% & as waveform distortion. (The one
𝑅𝑅$ = =
= ) % * ) * = ) % *such
𝑅𝑅$
𝑖𝑖!
𝑁𝑁#
𝑖𝑖#
𝑁𝑁# exception
to this effect demonstrates
&𝑁𝑁# ⁄𝑁𝑁! (𝑖𝑖#
Fig.4. Two inductors in LTspice – not a
transformer!
an advantage of the otherwise weak
performance of air-cored inductor – they
do not saturate.)
Working with LTspice
Simulating transformers in LTspice is
not as straightforward as other passive
components such as resistors and
capacitors – we cannot simply drop a
transformer symbol onto the schematic.
A transformer is made up of two or more
coils, so we can draw a transformer symbol
by suitably placing two inductors on
the schematic, as shown in Fig.4. The
symbols can be reflected and rotated
using the Ctrl-E and Ctrl-R keys, but it
may also be necessary to use the move
tool to change the position of the label
and value to get the transformer looking
right. Fig.4 has a 100Hz, 1V sinewave
driving a ‘transformer’ comprising two 1H
inductors. The transformer should have
a 1:1 ratio, so it should output 1V, but if
we simulate this circuit, we will get no
output signal, as shown in Fig.5.
The problem is that as far as LTspice is
concerned we just have two completely
separate coils with no relationship
between them. We have to tell LTspice
that they form a transformer. This is done
by declaring the two inductors to be a
mutual inductance, which requires a
statement to be placed on the schematic.
As you may know, the real input to the
simulator is not the schematic drawing
but the netlist obtained from it. A netlist
is a text description of the circuit plus
commands to instruct the simulator what
to do. It is generated automatically, but
𝑁𝑁! ⁄𝑁𝑁# (𝑣𝑣#
𝑁𝑁!% 𝑣𝑣#
𝑁𝑁!%
= ) % * ) * = ) % * 𝑅𝑅$&
𝑁𝑁#
𝑖𝑖#
𝑁𝑁#
𝑁𝑁# ⁄𝑁𝑁! (𝑖𝑖#
𝐿𝐿 ⁄𝑘𝑘
𝐿𝐿#
Where R'L = vp𝑣𝑣/i! p=is+
the# effective
resistance
𝑣𝑣# = .
𝑣𝑣
𝐿𝐿 #
⁄
𝑘𝑘
+𝐿𝐿
of the primary as seen by
! the source !driving
it. Thus, the transformer has changed the
𝐿𝐿#
+𝐿𝐿# ⁄𝑘𝑘
value of the load resistor to (Np2/
𝑣𝑣! =
𝑣𝑣# = .effective
𝑣𝑣#
𝐿𝐿
2
+𝐿𝐿! ⁄𝑘𝑘
N!s )RL. If a resistor RL is connected to the
secondary of an ideal transformer then
the transformer will look like a resistor
of value R'L to the source driving the
primary. This argument can be applied
more generally to impedances (circuits
with capacitance and inductance as well
as resistance) connected to the secondary.
This property of the transformer has uses
in impedance matching.
Practical Electronics | June | 2021
Fig.5. Simulation results from the circuit in Fig.4.
59
inductors have initial letter K –
the perhaps more obvious M, or T
for transformer are already taken
by MOSFETs and transmission
lines. The syntax of the mutual
inductance statement is:
Fig.6. Adding the mutual inductance statement.
Fig.7. LTspice transformer circuit.
you can view it from the menu using View
> Netlist. For Fig.4, the netlist is:
L1 In 0 1
L2 Out 0 1
V1 In 0 SINE(0 1 100)
.tran 100m
.backanno
.end
All of this can be set up via drawing or
through menu operations (the .tran
simulation command is generated via
the Edit Simulation Cmd menu item).
The .backanno and .end commands
are automatically added to every netlist.
It should be obvious what .end is for.
The .backanno command causes data
to be stored that facilitates probing
for currents by clicking on schematic
symbol pins.
To create a transformer we need to
add a mutual inductor component to the
netlist, but this cannot be done directly
via the menus. We have to add the netlist
line for a mutual inductor as text to the
schematic. All components start with a
specific initial letter (L for inductor, V
for voltage source and so on). Mutual
[L3
...]
This is a name starting with K, followed
by the list of inductors which are coupled
together (the windings of the transformer),
followed by the coupling coefficient. For
ideal transformers the coupling coefficient
is 1, but this parameter can be set in the
range 0 to 1 to model transformers where
not all of the magnetic flux perfectly
links the coils (the non-coupled part
forms the leakage inductance). Circuit
behaviour can be complex for non-unity
coupling coefficients, may result in slow
simulations, and is often not necessary.
It is recommended that simulations are
first run with a coupling coefficient of 1,
even if other values are to be investigated
later. For the circuit in Fig.4, we need:
K1 L1 L2 1
To add the mutual inductance statement
to the schematic use the Spice Directive
(.op) menu item (see Fig.6). Make sure the
SPICE directive option is selected (not the
comment) or it will not work. Place the
text by clicking on the schematic close to
the transformer (see Fig.7). Note that once
you have added the mutual inductance
statement LTspice will automatically
add the phasing dots to the schematic –
reorientate the inductors if these are not
the right way round for how you want
your schematic drawn.
Cores and coupling in LTspice
The core lines (see Fig.3) are not part of
the LTspice inductor symbol but can be
added as additional graphic elements. This
should be done using right-click > draw
> line, not by drawing a wire. Drawing
Fig.8. Simulation results for the circuit in Fig.7.
60
Kxxx L1 L2
<coefficient>
Fig.9. Output phase changed with
respect to the circuit in Fig.7.
these as part of the transformer symbol
will have no effect on the simulation.
Although we may use an ideal coupling
coefficient it is usually a good idea to
include the winding’s series resistance
in the simulation (ideally this is zero
but will not be so for a real transformer).
This can be measured or obtained from
the transformer’s specification. For the
circuit in Fig.7, we have added this to
the voltage source, which means it can
be displayed on the schematic, but this
only works because we have a voltage
source connected directly to the winding.
Series resistance can also be added to
the inductor directly by right clicking
directly on the inductor symbol. However,
this value is not displayed, which could
be misleading. It can also be added as a
separate resistor, which may in general
be the best option.
Simulating the circuit in Fig.7 produces
the output shown in Fig.8 – the expected
1V signal.
Fig.9 is the same as Fig.7, except the
opposite end of the winding has been
grounded (as indicated by the changed
position of the phasing dot for L2. The
resulting output is 180° (half a sinewave)
out of phase with the input (see Fig.10
and compare with Fig.8).
Inductance values for LTspice
transformers
The examples so far have used two
equal inductors, so the input and output
inductors are equal on the LTspice
schematic. As the transformer in LTspice
is configured from inductors there is no
direct way to set the turns ratio – we have
to set the ratio of the inductor values to the
square of the transformers turns ratio. For
example, if we want a step-up transformer
with ratio 1:2 then we need an inductor
ratio of 1:4. This is shown in the circuit in
Fig.11. The resulting waveforms (Fig.12)
show a 2V output for a 1V input.
This raises the question of what
inductance values to use in a real design –
these examples just use round numbers for
convenience. Obviously, if the inductance
values are specified for a real device, then
that indicates what to use. Otherwise, if
you have a suitable meter (eg, a DC LRC
meter) then the value can be measured
Practical Electronics | June | 2021
Fig.11. Step-up transformer with 1:2 ratio.
Fig.10. Simulation results for the circuit in Fig.9.
(with the other windings open circuit).
Failing this, the inductance should be
chosen to give a sensible current (I) in
the context of the circuit using I = V/ZL
where V is the expected winding voltage
and ZL is the impedance of the inductor at
the operating frequency (f), found using
ZL = 2πfL.
Fig.12. Simulation results for the circuit in Fig.11.
Real transformers have complex
behaviours with significant non-ideal
characteristics, which can make simulation
(and circuit design) challenging. A key
characteristic for simulation is the winding
resistance that we have already mentioned,
which should always be included
to prevent excessive DC currents. DC
currents clearly occur if DC is present in
the defined input voltage, or as a result of
the circuit’s behaviour, but may also occur
less obviously due to the initial conditions
used by the simulator at start-up. Ticking
the ‘Skip initial operating point solution’
(uic) option for a transient simulation can
help prevent problems caused by this.
Leakage inductance can be modelled with
additional inductors of the mutual inductor
coupling coefficient. Modelling nonlinear
effects due to the core saturation requires
more complex equivalent circuits.
ESR Electronic Components Ltd
All of our stock is RoHS compliant and CE
approved. Visit our well stocked shop for
all of your requirements or order on-line.
We can help and advise with your enquiry,
from design to construction.
3D Printing • Cable • CCTV • Connectors • Components •
Enclosures • Fans • Fuses • Hardware • Lamps • LED’s •
Leads • Loudspeakers • Panel Meters • PCB Production •
Power Supplies • Relays • Resistors • Semiconductors •
Soldering Irons • Switches • Test Equipment • Transformers
and so much more…
JTAG Connector Plugs Directly into PCB!!
No Header!
No Brainer!
Monday to Friday 08:30 - 17.00, Saturday 08:30 - 15:30
Our patented range of Plug-of-Nails™ spring-pin cables plug directly
into a tiny footprint of pads and locating holes in your PCB, eliminating
the need for a mating header. Save Cost & Space on Every PCB!!
Station Road
Cullercoats
North Shields
Tyne & Wear
NE30 4PQ
Solutions for: PIC . dsPIC . ARM . MSP430 . Atmel . Generic JTAG . Altera
Xilinx . BDM . C2000 . SPY-BI-WIRE . SPI / IIC . Altium Mini-HDMI . & More
www.PlugOfNails.com
Tag-Connector footprints as small as 0.02 sq. inch (0.13 sq cm)
Tel: 0191 2514363 sales<at>esr.co.uk www.esr.co.uk
Practical Electronics | June | 2021
61
|