6

Im trying to do in tikz the next amplifier schematic: enter image description here

But Im stuck here enter image description here

I dont know why the source works for a pin and the other takes the line and write in the image. And the stealth is moved to the right, when at the beginning there were in the right site over the + and - inputs.

\documentclass[preview]{standalone}

\usepackage[siunitx]{circuitikz}

\ctikzset{bipoles/capacitor/height/.initial=.4854}
\ctikzset{bipoles/capacitor/width/.initial=.1}

\begin{document}%
\begin{tikzpicture}
  \draw
  (0,0) node[fd op amp] (opamp) {} node[left] {\\}
 
   (opamp.-) node[circ] {} to[$text1$,*-*] ++(-1.5,0) node[ocirc] {} node[left] {\(v_p\)}
  (opamp.+) node[circ] {} to[$text2$, l=\(C_s\)] ++(-0.8,0) node[ocirc] {} node[left] {\(v_n\)}
  (opamp.out -) node[circ] {} -- ++(0,0)
 to[battery, l_=\SI{}{-V_{cc}}, invert] ++(0,-2) node[cground](GND){};

(opamp.out +) node[circ] {} -- ++(0,0) 
 to[battery, l_=\SI{}{+V_{cc}}] (0,2) node[cground](GND){};
  
\draw [-stealth](-3,1) -- (-1.5,1)node[pos=0.7, above]{$i_{P}$};

\draw [-stealth](-3,-1) -- (-1.5,-1)node[pos=0.7, below]{$i_{N}$};
\end{tikzpicture}
\end{document} 
4
  • 2
    You did end the path (there is a ;) but afterwards continue to specify things that should be drawn without putting \draw in front of it.
    – Skillmon
    Sep 11, 2021 at 7:51
  • 1
    thats one part to correct, thanks.
    – riccs_0x
    Sep 11, 2021 at 15:32
  • 2
    Another issue you got is the usage of \SI, that is totally the wrong usage of that command. If you want upright symbols in maths use \mathrm. \SI is to print numbers which have a unit, so something like 3 W (three Watt) would be typeset using \SI{3}{\watt} (but note that with siunitx version 3 even that wouldn't be the preferred method, better would nowadays be \qty{3}{\watt}).
    – Skillmon
    Sep 11, 2021 at 15:53
  • 3
    Yet another issue is the usage of $text1$ in the option of to, that isn't supported by both circuitikz and TikZ, afaik (and I have no idea what you want to achieve with it, maybe you wanted to use l=$text$?).
    – Skillmon
    Sep 11, 2021 at 15:54

1 Answer 1

8

The following draws the upper circuit completely. The only thing I didn't bother with was using arrows next to the shorts to show currents.

Everything is positioned relative to each other and using coordinates, so this should be quite easy to customize.

\documentclass[tikz,border=3.14]{standalone}

\usepackage[american]{circuitikz}

\begin{document}
\begin{tikzpicture}
  \draw
    (0,0) coordinate(vp-)
      to[short,o-o] ++(1,0)   coordinate(vn-)
      to[short,-*]  ++(2,0)   coordinate(gnd)
    node[ground]{}
      to[short,-*]  ++(1.2,0) coordinate(vcc)
      to[short,-o]  ++(2,0)   coordinate(vo-)
    (gnd)
      to[battery,-o,v=$-V_{\mathrm{CC}}$] ++(0,1.5)
      to[short,i_=$I_{\mathrm{C}-}$]      ++(0,0.5)
    node[op amp, yscale=-1, anchor=up](amp){}
    (amp.down)
      to[short,-o,i<_=$I_{\mathrm{C}+}$]  ++(0,0.5)
      to[short] ++(0,0.2) coordinate(tmp)
      to[short] (tmp-|vcc)
      to[battery,v=$+V_{\mathrm{CC}}$]   (vcc)
    (amp.+)
      to[short,-o, i<_=$i_{\mathrm{P}}$] (amp.+-|vp-)
      to[open, v=$v_{\mathrm{P}}$]       (vp-)
    (amp.-)
      to[short,-o, i<_=$i_{\mathrm{N}}$] (amp.--|vn-)
      to[open, v=$v_{\mathrm{N}}$]       (vn-)
    (amp.out)
      to[short,-o, i=$i_{\mathrm{O}}$]   (amp.out-|vo-)
      to[open, v^=$v_{\mathrm{O}}$]      (vo-)
    ;
\end{tikzpicture}
\end{document}

enter image description here

3
  • 1
    What wasnt working the two battery's? or why one work and the other not? Thanks superb figure!!
    – riccs_0x
    Sep 11, 2021 at 15:39
  • 2
    @riccs_0x I posted a few comments to your question to list the issues I spotted. But honestly, I didn't look much at your code before creating this answer, I just looked at your circuit and recreated it how I'd have done it.
    – Skillmon
    Sep 11, 2021 at 16:05
  • 1
    Thanks, its very instructive!!!
    – riccs_0x
    Sep 11, 2021 at 16:15

You must log in to answer this question.

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