6

I'm trying to do the next schematics about the 741 opamp:
enter image description here

but I don't know where to anchor the first transistor or even which should be done first, and how to do the transistor with double emitter. I'm looking for a start.

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}

\begin{document}
\begin{tikzpicture}[american voltages, european resistors]
    \draw (-0.5,4)
     node[pmos](Ap){}
     (Ap.D) to [short] ++(0,-1) node[nmos, anchor = D](An){}
     (Ap.G) to (An.G)
     ($(Ap.G)!0.5!(An.G)$) to [short,-o] ++(-1,0) node[anchor=east]{$V_i$}
     ($(Ap.D)!0.5!(An.D)$) to [short,-o] ++(1,0) node[anchor=west]{$V_p$};
 
\end{tikzpicture}\end{document}  

enter image description here
Thanks.

UPDATE

Thanks for the great ideas and superb support! I'll post the advance of the circuits, here.

1
  • 3
    Note that you can use (A-|B) to locate the point left or right of (A) and above or below (B). This will help when lining up components. Sep 29, 2021 at 16:54

3 Answers 3

6

Consider locating all multi-outlet components as nodes; Where possible using relative locations, not absolute as in my code, I did it to nest them in a for loop, to do so you can use help lines, then you can start creating the connections with the corresponding bipoles using the coordinates of each node created, Also add the code to be able to place 2 lines in the names of the components. For the rest such as the use of endings, changing the size of each family of components consult the manual of course. I also recommend that you consult the visual manual of tikz so that you can see how to use relative locations, in midpoints and intersections.

RESULT:

enter image description here

MWE:

\documentclass[tikz,border=1cm]{standalone}
\usepackage[american currents]{circuitikz}
% This code is from Claudio Fiandrino https://tex.stackexchange.com/a/65792/154390
% Ads new label styles to allow aditional labels like two line descriptions.
\makeatletter
\ctikzset{lx/.code args={#1 and #2}{ 
        \pgfkeys{/tikz/circuitikz/bipole/label/name=\parbox{1cm}{\centering #1  \\ #2}}
        \ctikzsetvalof{bipole/label/unit}{}
        \ifpgf@circ@siunitx 
        \pgf@circ@handleSI{#2}
        \ifpgf@circ@siunitx@res 
        \edef\pgf@temp{\pgf@circ@handleSI@val}
        \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
        \edef\pgf@temp{\pgf@circ@handleSI@unit}
        \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
        \else
        \fi
        \else
        \fi
}}

\ctikzset{lx^/.style args={#1 and #2}{ 
        lx=#2 and #1,
        \circuitikzbasekey/bipole/label/position=90 } 
}

\ctikzset{lx_/.style args={#1 and #2}{ 
        lx=#1 and #2,
        \circuitikzbasekey/bipole/label/position=-90 } 
}
\makeatother


\begin{document}
    \begin{tikzpicture}[]
    %Size adjust
    \ctikzset{nodes width/.initial=0.05}
    \ctikzset{transistors/arrow pos=end}
    \ctikzset{bipoles/thickness=0.75}
    \ctikzset{sources/scale=0.75}
    \ctikzset{diodes/scale=0.5}
    % Canvas help lines.
    \def\wcanvas{15}
    \def\hcanvas{12}
    \draw[red!5,step=0.25] (0,0) grid (\wcanvas,-\hcanvas);
    \draw[cyan!40,step=1,line width=1] (0,0) grid (\wcanvas,-\hcanvas);
    \foreach \x in {0, ..., \wcanvas} {%
        \node[anchor=-90] at (\x,0) {\tiny\x};
        \node[anchor=90] at (\x,-\hcanvas) {\tiny\x};
    }
    \foreach \y in {0, ..., \hcanvas} {%
        \node[anchor=0] at (0,-\y) {\tiny-\y};
        \node[anchor=180] at (\wcanvas,-\y) {\tiny-\y};
    }

    %Create each transistor by type, orientation, ID,name,xposition,yposition.
    %
    \foreach \nodetype/\xscal/\alias/\name/\px/\py in {
        npn/1/Q1/Q1/2/-3,
        npn/-1/Q2/\ctikzflipx{Q2}/5/-3,
        pnp/-1/Q3/\ctikzflipx{Q3}/2/-4.25,
        pnp/1/Q4/Q4/5/-4.25,
        npn/-1/Q5/\ctikzflipx{Q5}/2/-9,
        npn/1/Q6/Q6/5/-9,
        npn/1/Q16/Q16/7/-8.25,
        npn/1/Q17/Q17/9/-9, 
        npn/1/Q22/Q22/11/-8.25, 
        npn/1/Q14/Q14/13/-4,
        npn/1/Q20/Q20/13/-7%%       
    }{\node[\nodetype,xscale=\xscal](\alias) at (\px,\py) {\name};}
    \draw[color=black!40!red]
    (6,-1.5) 
        node[anchor=-90,inner sep=7pt]{$V_{CC}$}
        to [short,o-*] ++(0,-0.5) coordinate (lineVcc)
        -| (Q1.C)
    (Q1.B)
        to [short,-o] ++ (-0.25,0)
        node[anchor=0,inner sep=7pt]{$V_{P}$}
    (Q3.B)
        -- (Q4.B)
    ($(Q3.B)!0.5!(Q4.B)$)
        to [I,*-o,lx_=$Q_{10}$ and $I_1$] ++ (0,-1.5) 
        node[anchor=90,inner sep=7pt]{$V_{EE}$}
    (Q3.C)
        -- (Q5.C)
        to [short,*-] ++ (1.5,0) coordinate (temp)
        to [short,-*] (Q5.B-|temp)
    (Q5.B)
        -- (Q6.B)
    (Q5.E)
        |- (6,-10) coordinate (lineVee)
        to [short,*-o] ++ (0,-0.5)
        node[anchor=90,inner sep=7pt]{$V_{EE}$};
    
    \draw[color=black!40!green]
    (Q2.C)
        to [short,-*] (Q2.C|-lineVcc)
    (Q2.B)
        to [short,-o] ++ (0.25,0)
        node[anchor=180,inner sep=7pt]{$v_{N}$}
    (Q4.C)
        -- (Q6.C)
        to [short,*-](Q16.B)
        (Q4.C)
    (Q6.E)
        to [short,-*](Q6.E|-lineVee)
    (Q16.C)
        to [short,-o]++(0,0.25)
        node[anchor=-90,inner sep=7pt]{$V_{CC}$}
    (Q16.E)
        -- (Q17.B)
    (Q17.C|-lineVcc)
        to [I,*-,lx_=$Q_{13A}$ and $I_2$] (Q17.C|-Q14.B)
        to [short,-*] (Q17.C)
        to [short] (Q22.B)
    (Q17.E)
        to [short,-*](Q17.E|-lineVee);
        
    \draw[color=black!40!blue]
    (lineVcc)
        -| (Q14.C)
    (Q14.E)
        -- (Q20.C)
    ($(Q14.E)!0.5!(Q20.C)$) coordinate (mid1)
        to [short,*-o]++(0.5,0)
        node[anchor=180,inner sep=7pt]{$v_{O}$}
    (Q20.E)
        |- (lineVee)
    (Q22.C|-lineVcc)
        to [I,*-*,lx_=$Q_{13B}$ and $I_3$] (Q22.C|-Q14.B) coordinate (inter)
        to [short] (Q14.B)
    (inter)
        to [D,l_=$Q_{18}$](inter|-mid1)
        to [D,l_=$Q_{19}$,-*](inter|-Q20.B)
    (Q20.B)
        -| (Q22.C)
    (Q22.E)
        to [short,-*](Q22.E|-lineVee);
    
\end{tikzpicture}
\end{document}
4
  • 1
    Thanks for the great idea, its very clever and creative. I think its a great tool for this and future schematics!!
    – riccs_0x
    Sep 29, 2021 at 20:47
  • 2
    Why do you redefine lx? Did not ` l2 halign=c, l2=...` work? (nice drawing, btw!)
    – Rmano
    Sep 30, 2021 at 9:30
  • 2
    Wow, I thought it was not integrated, but I already saw that it is resolved and with a complete alignment treaty in manual 1.4.3 - section 5.1.4, for that matter it should be then: [I,*-*,l2 halign=r,l2_=$Q_{13B}$ and $I_3$]; thanks for letting me know.
    – J Leon V.
    Sep 30, 2021 at 18:05
  • @JLeonV. I'm trying still to do it, I have studied and learn a lot of your answert, its a great code!!
    – riccs_0x
    Oct 1, 2021 at 16:20
6

For the multi-emitter (and multi-collector) transistors you can look at the section "multi-terminal bipolar transistors" in the manual: https://texdoc.org/serve/circuitikz/0#subsubsection.4.14.2.

There is an example later in the section; in that case I started by positioning Q1 at the origin and then I started building everything around using only relative ana perpendicular coordinates. That way you can move the circuit around freely:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
    \ctikzset{transistors/arrow pos=end}
    \draw (0,0) node[bjtpnp, xscale=-1](Q1){%
    \scalebox{-1}[1]{Q1}};
    \draw (Q1.B) node[bjtpnp, anchor=B, collectors=2]
    (Q2){Q2} (Q1.B) node[circ]{};
    \draw (Q1.E) node[circ]{} node[vcc]{} (Q2.E)
    node[vcc]{} (Q1.E) -| (Q1.B);
    \draw (Q1.C) to[R, l_=$R_0$, f=$I_0$] ++(0,-3.5)
    node[ground](GND){};
    \draw (Q2.C) -- ++(0,-0.5) coordinate(a);
    \draw (Q2.C1) -- ++(1,0) coordinate(b) -- (b|-a);
    \draw (a) ++(0,-0.1) node[flowarrow, rotate=-90,
    anchor=west]{\rotatebox{90}{$I_0$}};
    \draw (b|-a) ++(0,-0.1) node[flowarrow, rotate=-90,
    anchor=west]{\rotatebox{90}{$I_0$}};
    \path (b) ++(0.5,0); % bounding box adjust
\end{circuitikz}
\end{document}

enter image description here

1
  • 2
    I'm reading the manual and trying your approach, thanks!!
    – riccs_0x
    Sep 29, 2021 at 15:47
5

To know in which direction to take the diagram, in fact we can take several which will ultimately give the right diagram but sometimes with more complex paths.

To help you:

  • name the transistors as in the diagram. For example : \draw (0,0) node[below]{$v_p$} to[short, o-] (0.5,0) node [npn, anchor=B](Q1){Q1};. So to connect a component to the emitter of transistor Q1, you can use as coordinate (Q1.E)
  • to flip a component, use the command xscale=-1
  • do not hesitate to abuse the name of nodes. An example: for the node located between two transistors Q3 and Q4, you can name it q3q4 with the command coordinate(q3q4)
2
  • 2
    Thanks, excelent ideas. Using the same numbering for the transistors is a basic one, I dont know why didnt think it before.
    – riccs_0x
    Sep 29, 2021 at 6:02
  • 4
    Yes, this is a good idea.
    – Rmano
    Sep 29, 2021 at 7:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .