# step-up and/or step-down transformer symbol for circuitikz

I want to incorporate a more intuitive symbol for step up/down transformer in some of my drawings, such as the following:

or "cute inductor" version:

I tried to do what this link suggested; to copy the type of code used to define an "inductor" in pgfcircbipoles.tex ie, define a "long_inductor" to use in code like, but it isn't clear to me how to fit it all together:

\begin{circuitikz}
\draw (1,5) to[short, o-] (2, 5)
to [long_inductor, l = Primary] (2, 0)
to [short, -o](1,0);
\draw (2.3,5) -- (2.3,0);
\draw (2.4,5) -- (2.4,0);
\draw (4,4) to[short, o-] (3,4)
to [inductor,l = Secondary] (3,1)
to [short, -o](4,1);
\end{circuitikz}


I've seen examples using pstricks, but I only just started learning tikz and circuitikz so at this point I'm more interested in discovering how to use these tools... including, defining my own shapes for use.

The number of coils can be configured, also within a picture:

\begin{circuitikz}[]
\begin{scope}
\ctikzset{bipoles/cuteinductor/width/.initial=1.2}%default 0.6
\ctikzset{bipoles/cuteinductor/coils/.initial=10}%default 5
\draw (0, 0)  to [short, o-] +(1, 0)
to [cute inductor]  +(0, 3)
to [short, -o] +(-1, 0);
\end{scope}
%% vertical bare fore the core.  The middle is in y=1.5
\draw[thick] (1.4, 0.5) -- (1.4, 2.5);
\draw[thick] (1.6, 0.5) -- (1.6, 2.5);
%% Secondary
\draw(3, 0)  to [short, o-] +(-1, 0)
to [cute inductor]  +(0, 3)
to [short, -o] +(1, 0);
%%American inductor version(only working using the most recent gitversion!)
\begin{scope}[xshift=4cm]
\begin{scope}
\ctikzset{bipoles/americaninductor/width/.initial=1.6}%default 0.8
\ctikzset{bipoles/americaninductor/coils/.initial=8}%default 4
\draw(0, 0)  to [short, o-] +(1, 0)
to [inductor]  +(0, 3)
to [short, -o] +(-1, 0);
\end{scope}
%% vertical bare fore the core.  The middle is in y=1.5
\draw[thick] (1.4, 0.5) -- (1.4, 2.5);
\draw[thick] (1.6, 0.5) -- (1.6, 2.5);
%%Secondary
\draw (3, 0)  to [short, o-] +(-1, 0)
to [inductor]  +(0, 3)
to [short, -o] +(1, 0);
\end{scope}
\end{circuitikz}


While testing this, i found a bug, therefore, the code for the american inductor(not the cute/curly one)) is only working using the most recent git version or adjusting the code following this commit: https://github.com/circuitikz/circuitikz/commit/1dc2ee4cef798bcd8f9a5fabbaf83f66afeaf0f2

Best regards, Stefan

One alternative could be do make the coils youself using decorations. Then they work exactly as lines, but drawn with bumps for the first one and coil for the second. I have not compared with the coils in circuitikz, that probably gives some change in the settings. The only difference between the Primary and Secondary winding is the mirroring. This can also be done by changing the direction of the line.

\documentclass[border=1cm]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{circuitikz}[%
line width=1pt,
MyPrimaryBumps/.style={decorate,decoration={bumps,amplitude=10pt,segment length=10mm,mirror}},
MySecondaryBumps/.style={decorate,decoration={bumps,amplitude=10pt,segment length=10mm}},
MyPrimaryCoil/.style={decorate,decoration={coil,amplitude=10pt,segment length=4.8mm,mirror}},
MySecondaryCoil/.style={decorate,decoration={coil,amplitude=10pt,segment length=4.7mm}},
]
\draw[o-] (0,0) -- +(2,0);
\draw[MyPrimaryBumps] (2,0) -- +(0,3.01);
\draw[-o] (2,3) -- +(-2,0);
\draw(2.45,0) -- +(0,3);
\draw(2.54,0) -- +(0,3);
\draw[o-] (5,0.5) -- +(-2,0);
\draw[MySecondaryBumps] (3,0.5) -- +(0,2.01);
\draw[-o] (3,2.5) -- +(2,0);
\begin{scope}[xshift=8cm]
\draw[o-] (0,0) -- +(2,0);
\draw[MyPrimaryCoil] (2,0) -- +(0,3.01);
\draw[-o] (2,3) -- +(-2,0);
\draw(2.45,0) -- +(0,3);
\draw(2.54,0) -- +(0,3);
\draw[o-] (5,0.5) -- +(-2,0);
\draw[MySecondaryCoil] (3,0.5) -- +(0,2.01);
\draw[-o] (3,2.5) -- +(2,0);
\end{scope}
\end{circuitikz}
\end{document}


• This answers my primary goal of getting a picture that "looks right". I would still be interested in seeing an answer that "modifies a circuitikz symbol" because I don't know how to do that. – 2nd.Bridger Feb 3 '17 at 11:13

My solution is, to use two inductors two create a bigger coil.

Here is my MWE:

\documentclass[12pt]{article}
\usepackage[americaninductors]{circuitikz}

\begin{document}

\begin{circuitikz}
%% left side of the transformer  This has two coils to indicate more
%% windings.  Use relative coordinates, counting from the startpoint
%% The horizontal width is from y=0 to y=1
\draw
(0, 0) node[inductor] (P) {}
to [short, o-] +(1, 0)
to [inductor]  +(0, 1.2)
to [inductor]  +(0, 1.2)
to [short, -o] +(-1, 0);
%% vertical bare fore the core.  The middle is in y=1.5
\draw (1.4, -0.1) -- (1.4, 2.5);
\draw (1.6, -0.1) -- (1.6, 2.5);

% %% right side of the transformer, being smaller than the first
% side.  The width is y=3 to y=2
\draw
(3, 0) node[inductor] (S) {}
to [short, o-] +(-1, 0)
to [inductor, mirror]  +(0, 2.5)
to [short, -o] +(1.2, 0);
\end{circuitikz}
\end{document}


And the result

I must admit, that I used the option mirror at the right transmitter, to mirror the coils of both transmitter sides. I also tried to use the mirror-option on the left side of the coils, but it gave ugly connections between the connecting lines. :-(

• That almost works for the American style of inductors, but not at all for the "cute" style. Maybe if a vertical shift of a component is done, both styles of inductors would work. – 2nd.Bridger Feb 2 '17 at 11:17