1

I needed a dipchip symbol with exact pin to pin distance. I want to show how many dual inline ICs will fit on acertain PCB board size. I wrote a minimal example:

\documentclass[11pt] {article} 

\usepackage[utf8]{inputenc} 
\usepackage{graphicx} 

\usepackage{tikz}
\usetikzlibrary{circuits}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}

\draw[step=0.1in,gray,very thin] (0,0) grid (1in,2in);
\draw (0.1in, 0.1in) [red] rectangle (20.0mm, 30.0mm);

\ctikzset{multipoles/dipchip/pin spacing=0.180675} % 0.180675 = 72.27 / 400  ; 72.27 pt = 1in

 \draw (0.4in,0.55in) node[dipchip,
 num pins=16,
 hide numbers,
 external pins width=0.2,
 external pad fraction=4, xscale=0.5 ](C){IC1};
 \end{circuitikz}

\end{document}

I got this image;

enter image description here

The pins of the IC fit exactly to the 0.1 inch grid as requested.

But I needed these settings:

\ctikzset{multipoles/dipchip/pin spacing=0.180675} % 0.180675 = 72.27 / 400  ; 72.27 pt = 1in
external pad fraction=4, xscale=0.5 ](C){IC1};

for pin spacing and xscale.

xscale is needed for the exact pin rows horizontal distance of 0.4 inch and vertical spacing for distance in a row of 0.1 in.

Why is the pin spacing defined using the strange unit pt, electronic industry uses inch and mm for that measures. If I don't use xscale, the width of the chip is much too big.

Am I doing wrong something or is there an error in the CircuiTikz library?

0

3 Answers 3

4

Pretty much everything in circuitikz get multiplied by \pgf@circ@Rlen.

\documentclass[11pt] {standalone} 

\usepackage[utf8]{inputenc} 
\usepackage{graphicx} 

\usepackage{tikz}
\usetikzlibrary{circuits}
\usepackage{circuitikz}

\makeatletter
\let\Rlen=\pgf@circ@Rlen
\makeatother

\begin{document}
\begin{circuitikz}

\draw[step=0.1in,gray,very thin] (0,0) grid (1in,2in);
\draw (0.1in, 0.1in) [red] rectangle (20.0mm, 30.0mm);

\ctikzset{multipoles/dipchip/pin spacing={0.1in/\Rlen}}

 \draw (0.4in,0.55in) node[dipchip,
 num pins=16,
 hide numbers,
 external pins width=0.2,
 external pad fraction=4, xscale=0.5 ](C){IC1};
 \end{circuitikz}

\end{document}

demo

3
  • Thanks a lot. I found \pgf@circ@Rlen in the CircuiTikZ manual, chapter 3.28.2 Seven segments customization on page 139 "You can change several parameters to adjust the displays: 1 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen (scalable) 2 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness (not scaled)"
    – Uwe
    Commented Jan 29, 2021 at 6:14
  • Nice! If you glimpse at the links I posted, you can avoid the ugly scale by setting the chip width also
    – Rmano
    Commented Jan 29, 2021 at 6:40
  • @Uwe the size concept is explained at the start of the manual, really. I will give a better point as soon as I reach a computer. But please look at the link I added, you can coerce chips to whatever geometry you need.
    – Rmano
    Commented Jan 29, 2021 at 6:43
4

Neither... circuitikz is designed to make schematics, not for drawing PCB nor serigraphy for PCB.

So the real size is not important, because you use the same schematic for, say, a through-hole mounting or a SMD one which are physically very different. The fact that the chip symbol seems like a physical one is just a coincidence... Thinks logic ports, transistors or whatever.

Other tools, like KiCad, solve that problem (and will let you show the board in 3D!) . In circuitikz, by design, the default size of every component, not only chips, is basically arbitrary. Chips are designed so they play well with logic ports, nothing more.

Anyway, if you want to see how the chip sizes can be manipulated, there is something here: Placing CircuiTikZ components aligned with respect to their pins and here: Alignment of DIP chips in CircuiTikZ

For example, if you want 0.1 inches between pins, 0.4 inches width, you can just change the basic length and adjust the parameter (manual, section 3.27.1 today, around page 135, "DIP and QFP customization"; also 3.1.4.1, around page 27, "Component size" for a definition of the basic length), you can do this --- no need to use strange numbers of strange asymmetric scales:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
% set the basic length to 0.5in (1 in is very big, but could work)
% SET THIS ONCE and only in the preamble.
\ctikzset{bipoles/length=0.5in}
% pin spacing is in basic lengths, see manual, section 3.27.1, around page 135
\ctikzset{multipoles/dipchip/pin spacing=0.2} %0.1in
\ctikzset{multipoles/external pins width=0.2} %0.1in
\ctikzset{multipoles/dipchip/width=0.8}       %0.4in
\ctikzset{multipoles/dipchip/width=0.8}       %0.4in
\ctikzset{multipoles/external pad fraction=4} %draw the pad
\begin{document}
% work with units of pin distance
\begin{circuitikz}[x=0.1in, y=0.1in]
    \draw [cyan, ultra thin](0,0) grid[step=0.1in] (10,10);
    \foreach \x in {0,2,...,9} \node[below, font=\tiny, inner sep=1pt] at(\x,0) {.\x};
    \node[below, font=\tiny, inner sep=1pt]  at(10,0) {1$\,$in};
    \path (2,9) node[dipchip, anchor=pin 1, num pins=16]{\rotatebox{90}{DIP}};
\end{circuitikz}
\end{document}

enter image description here

If you want an even less schematic, and more "positioning" style diagram, you probably would prefer to put the "pads" on the coordinates; just a bit of changes gives you this:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
% set the basic length to 0.5in (1 in is very big, but could work)
% SET THIS ONCE and only in the preamble.
\ctikzset{bipoles/length=0.5in}
% pin spacing is in basic lengths, see manual, section 3.27.1, around page 135
\ctikzset{multipoles/dipchip/pin spacing=0.2} %0.1in
\ctikzset{multipoles/external pins width=0.1} %0.05in
\ctikzset{multipoles/dipchip/width=0.8}       %0.4in
\ctikzset{multipoles/dipchip/width=0.7}       %0.35in body + 2*0.025in half pads 
\ctikzset{multipoles/external pad fraction=4} %draw the pad
\begin{document}
% work with units of pin distance
\begin{circuitikz}[x=0.1in, y=0.1in]
    \draw [cyan, ultra thin](0,0) grid[step=0.1in] (10,10);
    \foreach \x in {0,2,...,9} \node[below, font=\tiny, inner sep=1pt] at(\x,0) {.\x};
    \node[below, font=\tiny, inner sep=1pt]  at(10,0) {1$\,$in};
    % notice that the anchor is at the border of the pad, you have to shift half pad to place it in the center of the grid
    \path (1.75,9) node[dipchip, anchor=pin 1, num pins=16, hide numbers]{\tiny\rotatebox{90}{DIP}};
\end{circuitikz}
\end{document}

enter image description here

Now, if this coincides with the real size of the chip, depends also on how precise is your printer and all the LaTeX transformations to obtain a PDF. But it should be correctly scaled.

6
  • I dont want to make schematics, not for drawing PCB nor serigraphy for PCB, I only want a drawing how many RAM ICs would fit on a board 160 * 233.4 mm. I prepare a study about memory modules used in a computer 40 years ago when 4K RAM were used.
    – Uwe
    Commented Jan 28, 2021 at 23:18
  • 1
    @Uwe well, it depends on you definition. For me, everything touching physical size is PCB design (or placement --- it seems that you are not interested in routing, that 40 years ago was a problem, when 8-layer PCBs where not so available --- I did have a C-64!). And about the manual... I wrote that part, so I know it ;-)
    – Rmano
    Commented Jan 29, 2021 at 8:08
  • Thanks a lot for the edits. Very helpful to me. I am writing a computer history paper about a Multiprozessor research project I was working for after study. After a memory extension, the 5 processors shared 1 MB, 512 KB ferrite core memory and 512 kB of semiconductor memory using 4K x1 dynamic RAMs. Core mem filled the backside of 4 large computer cabinets, silicon mem needed less than 1/4 of the core mem volume. But silicon memory needed over 1024 chips on 16 boards of 160 * 233.4 mm. On each board 76 chips. I am preparing a picture of such a board filled to over 80 % with memory chips.
    – Uwe
    Commented Jan 29, 2021 at 12:34
  • I agree about correct scaling, that is what I needed. I was astonished about the magic number 0.180675 based on pt and not on mm, inch or mil. But in a german Latex manual I found an info about the smallest Latex unit 1sp, 65536sp = 1pt, 1 sp = 5.4 nm (nanometer !) So there is much more resolution than neccessary. PCB CAD systems are not better than this. Some words about computer memory 40 years ago,: we had 1024 KB memory for 5 processors of the research project, my PC here has 16 GB built with about 16 chips. The 1024 kB built with silicon memory only using more than 2161 chips.
    – Uwe
    Commented Jan 29, 2021 at 13:19
  • Any reason for setting the width twice?
    – Louis
    Commented Jun 2, 2022 at 8:33
3

This is not an answer, I only wanted to show my result of the pcb floor plan. The 80 chips do fit on the pcb size, but there is very few space left.

enter image description here

So circuitikz may be used for the drawing of pcb's too if no traces are to be shown, only the placement of the chips.

Thanks a lot for the help.

3
  • please share was this done with Latex -- I am also an electronics engineer and would like to learn how
    – js bibra
    Commented Feb 21, 2021 at 2:10
  • 1
    @jsbibra Sorry for the late reaction, I saw your comment today just by accident. It was possible only by using both Python and LaTex. The for loops necessary to handle 80 chips are coded in Python, writen to a file and this file is included in LaTex. There is a LaTex command for each of the 80 chips with individual x and y position as well as chip name 'IC 1.23' in this generated file. Only the chips are handeIed with Python, everything else is done with LaTex. I will write a question with answer about this theme later.
    – Uwe
    Commented Mar 1, 2021 at 11:29
  • @jsbibra See this question
    – Uwe
    Commented Mar 1, 2021 at 13:41

You must log in to answer this question.

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