5

I have spent one hour on this, one of my first Tikz circuit. I'm trying to reprocedure this.

enter image description here

I haven't finished it though. I have some questions as I feel confused while making the drawing not sure if I do it right.

  1. How would you create the pin with square and X inside like that?
  2. My drawing is much bigger than the original. Is that normal? I have to do this as the components's size seem to be 1cm long for each.
  3. How can I add the "Supply Voltage" like that?

enter image description here

\documentclass[border={5mm}]{standalone}
\usepackage[american,siunitx]{circuitikz}

\begin{document}

\begin{tikzpicture}[line width = 0.5, voltage shift=0.5] \draw [gray] (0,0) rectangle (4,9); \draw (0,2) to [short,-*] ++(-1,0) coordinate(C1) to [short, -o] ++(-3,0); \draw (C1) to [C] ++(0,-1) node[ground]{}; \draw (0,4) to [short,-*] ++(-1,0) coordinate(C2) to [short] ++(-1,0) to [cute inductor] ++(-1,0) to [short, -o]++(-1,0); \draw (C2) to [C] ++(0,-1) node[ground]{}; \draw (0,6) to [short,-*] ++(-1,0) coordinate(C3) to [short] ++(-1,0) to [cute inductor] ++(-1,0) to [short, -o]++(-1,0); \draw (C3) to [C] ++(0,-1) node[ground]{}; \draw (0,8) to [short,-*] ++(-1,0) coordinate(C4) to [short] ++(-1,0) to [cute inductor] ++(-1,0) to [short, -o]++(-1,0); \draw (C4) to [C] ++(0,-1) node[ground]{};

\end{tikzpicture} \end{document}

internet
  • 569

1 Answers1

7
\documentclass[tikz, border=1cm]{standalone}
\usepackage[american, siunitx]{circuitikz}  
\begin{document}
\begin{tikzpicture}[transform shape, scale=1,]
\ctikzset{
inductors/scale=0.5,
capacitors/scale=0.3,
power supplies/scale=0.5,
}
\draw[ultra thick, gray] (2.8,4) rectangle +(3,-5);

\draw[yshift=3cm] (0,0) to[short, o-] ++(1.6,0) to[cute inductor] ++(0.4,0) to[short,-*] ++(0.4,0) coordinate(C1) to[short] (2.8,0) node[osquarepole]{} to[short] ++(0.8,0) node[draw, fill=white, minimum height=1.2cm, minimum width=1.8cm, right]{Core};
\draw (C1) to[C] ++(0,-0.4) node[vee]{};

\draw[yshift=2cm] (0,0) to[short, o-] ++(1.2,0) to[cute inductor] ++(0.4,0) to[short,-*] ++(0.4,0) coordinate(C2) to[short] (2.8,0) node[osquarepole]{} to[short] ++(0.6,0) node[draw, fill=white, minimum height=1.2cm, minimum width=1.8cm, right]{Memory};
\draw (C2) to[C] ++(0,-0.4) node[vee]{};

\draw[yshift=1cm] (0,0) to[short, o-] ++(0.8,0) to[cute inductor] ++(0.4,0) to[short,-*] ++(0.4,0) coordinate(C3) to[short] (2.8,0) node[osquarepole]{} to[short] ++(0.4,0) node[draw, fill=white, minimum height=1.2cm, minimum width=1.8cm, right]{Camera};
\draw (C3) to[C] ++(0,-0.4) node[vee]{};

\draw[yshift=0cm] (0,0) to[short, o-] ++(0.8,0) to[short,-*] ++(0.4,0) coordinate(C4) to[short] (2.8,0) node[osquarepole]{} to[short] ++(0.2,0) node[draw, fill=white, minimum height=1.2cm, minimum width=1.8cm, right, align=center]{LED\\Driver};
\draw (C4) to[C] ++(0,-0.4) node[vee]{};

\end{tikzpicture}
\end{document}

Circuit diagram with boxes

Edit: With custom cross pins

\documentclass[tikz, border=1cm]{standalone}
\usepackage[american, siunitx]{circuitikz}
\begin{document}
\begin{tikzpicture}
\tikzset{
cross/.style={
draw, fill=white, inner sep=2pt, 
path picture={\draw
(path picture bounding box.south east) --
(path picture bounding box.north west)
(path picture bounding box.south west) --
(path picture bounding box.north east);
}}}
\ctikzset{
inductors/scale=0.5,
capacitors/scale=0.3,
power supplies/scale=0.5,
}

\draw[ultra thick, gray] (2.8,4) rectangle +(3,-5);

\draw[yshift=3cm] (0,0) to[short, o-] ++(1.6,0) to[cute inductor] ++(0.4,0) to[short,-*] ++(0.4,0) coordinate(C1) to[short] (2.8,0) node[cross]{} to[short] ++(0.8,0) node[draw, fill=white, minimum height=1.2cm, minimum width=1.8cm, right]{Core}; \draw (C1) to[C] ++(0,-0.4) node[vee]{};

\draw[yshift=2cm] (0,0) to[short, o-] ++(1.2,0) to[cute inductor] ++(0.4,0) to[short,-*] ++(0.4,0) coordinate(C2) to[short] (2.8,0) node[cross]{} to[short] ++(0.6,0) node[draw, fill=white, minimum height=1.2cm, minimum width=1.8cm, right]{Memory}; \draw (C2) to[C] ++(0,-0.4) node[vee]{};

\draw[yshift=1cm] (0,0) to[short, o-] ++(0.8,0) to[cute inductor] ++(0.4,0) to[short,-*] ++(0.4,0) coordinate(C3) to[short] (2.8,0) node[cross]{} to[short] ++(0.4,0) node[draw, fill=white, minimum height=1.2cm, minimum width=1.8cm, right]{Camera}; \draw (C3) to[C] ++(0,-0.4) node[vee]{};

\draw[yshift=0cm] (0,0) to[short, o-] ++(0.8,0) to[short,-*] ++(0.4,0) coordinate(C4) to[short] (2.8,0) node[cross]{} to[short] ++(0.2,0) node[draw, fill=white, minimum height=1.2cm, minimum width=1.8cm, right, align=center]{LED\Driver}; \draw (C4) to[C] ++(0,-0.4) node[vee]{};

\end{tikzpicture} \end{document}

Circuit diagram with boxes and custom pins

  • Thank you, very nice figures. When you want to embed this into a .tex file, do you normally to make it exactly same as the place where you want to put or would you just draw it in whatever size you like and then scale it in the target location? – internet Dec 10 '22 at 12:26
  • It depends on who you ask. Personally I would not scale text because a scaled text is not the same as change in font size. I would also not scale line widths. To stay consistent, I would where possible only use predefined sizes and widths \normalsize, \small, ... and thin, thick, ... – hpekristiansen Dec 10 '22 at 12:39
  • I'm a bit confused as llike the example above, as people would probably generate images of different sizes. And then if you want to export that and insert into a document, you could use scale. I wonder if there is any problem doing that way. The rectangle you drew is 3x5 size. I could probably did it with 6x10 or 9x15. And all other components assume to small the same amount, then would there is any problem doing that way? – internet Dec 10 '22 at 12:43
  • 1
    If you are happy scaling, then you should do it. I would not do it because of ugly font and inconsistent sizes throughout the document. https://tex.stackexchange.com/questions/425453/why-not-scale-elements-that-contain-text – hpekristiansen Dec 10 '22 at 12:59
  • Then I can't just draw all my figures before writing a document as I'll have to know the size for each figure first. – internet Dec 10 '22 at 13:20
  • How can I make the connectors bigger? node[osquarepole, nodes width = 10pt]{} isn't correct and I don't see example in the manual. – internet Dec 10 '22 at 17:22
  • 2
    It is a TikZ node, you need to look i the TikZ manual. e.g. node[osquarepole, scale=2]{} – hpekristiansen Dec 10 '22 at 17:32
  • 1
    @hpekristiansen the fact that power supplies/scale=-0.5 works at all is a (fortunate) coincidence. Better use power supplies/scale=0.5 and use a vee node... – Rmano Dec 10 '22 at 18:37
  • It is not important but the symbol in the original post is ground and it is actually confusing. – internet Dec 11 '22 at 10:09