LaTeX forum ⇒ Graphics, Figures & TablesHelp with a circuitikz problem

Information and discussion about graphics, figures & tables in LaTeX documents.
hamzan
Posts: 1
Joined: Fri Jan 01, 2016 6:12 pm

Help with a circuitikz problem

Postby hamzan » Fri Jan 01, 2016 6:24 pm

Hi,I need help , but do not know how to solve that.This is my homework and need help.I need to finish it with circuitikz .Here is photo.Image.Or this url it is same http://s10.postimg.org/owhodist5/zzzzzzzzz.png .Please help me.Thanks in advanced.

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3587
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Mon Jan 04, 2016 1:14 pm

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8544
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Jan 08, 2016 11:54 am

Hi hamzan,

welcome to the forum!

Ramón Jaramillo already wrote such an example. It's with colors but you can easily remove the colors. As it's your homework, you should at least work something with it. You should be able to understand it. The teacher may ask you. If you have questions about a specific detail, just ask.

If you click on "Open in writeLaTeX" you can directly edit it online.

  1. % Block Diagram for TTL IC Multiplexer 74HC153
  2. % Author: Ramón Jaramillo.
  3. \documentclass[tikz,border=10pt,12pt,x11names]{standalone}
  4. \usepackage{tikz}
  5. \usetikzlibrary{circuits.logic.US} % TiKZ Library for US Logic Circuits.
  6. \begin{document}
  7. \begin{tikzpicture}[circuit logic US, every circuit symbol/.style={thick}]
  8. % Logic Gates in Left Side of Multiplexor
  9. \node[buffer gate, point down,inputs={i}] (buf1) at (-1,3) {}; % Input Ea
  10. \node[and gate,inputs={nnnn}, point down] (and1) at (0,-1) {};
  11. \node[and gate,inputs={nnnn}, point down] (and2) at (1.5,-1) {};
  12. \node[and gate,inputs={nnnn}, point down] (and3) at (3,-1) {};
  13. \node[and gate,inputs={nnnn}, point down] (and4) at (4.5,-1) {};
  14. \node[or gate,inputs={nnnn}, point down] (or1) at (2.25,-3) {};
  15. \node[not gate, point down] (not1) at (5.5,4) {}; % Input Sa
  16. \node[buffer gate, point down,inputs={i}] (buf2) at (5.5,2.5) {};
  17. % Left Side connections
  18. \draw [red, very thick] (buf1.output) -- ++(down:26.4mm) -| (and1.input 4);
  19. \draw (and1.output) -- ++(down:5mm) -| (or1.input 4);
  20. \draw (and2.output) -- ++(down:3mm) -| (or1.input 3);
  21. \draw (and3.output) -- ++(down:3mm) -| (or1.input 2);
  22. \draw (and4.output) -- ++(down:5mm) -| (or1.input 1);
  23. \draw (not1.output) -- (buf2.input);
  24. % Logic Gates in Right Side of Multiplexor
  25. \node[not gate, point down] (not2) at (7,4) {}; % Input Sb
  26. \node[buffer gate, point down,inputs={i}] (buf3) at (7,2.5) {};
  27. \node[buffer gate, point down,inputs={i}] (buf4) at (13.50,3) {}; % Input Eb
  28. \node[and gate,inputs={nnnn}, point down] (and5) at (8,-1) {};
  29. \node[and gate,inputs={nnnn}, point down] (and6) at (9.5,-1) {};
  30. \node[and gate,inputs={nnnn}, point down] (and7) at (11,-1) {};
  31. \node[and gate,inputs={nnnn}, point down] (and8) at (12.5,-1) {};
  32. \node[or gate,inputs={nnnn}, point down] (or2) at (10.25,-3) {};
  33. \draw (not2.output) -- (buf3.input);
  34. % Right Side connections
  35. \draw [red, very thick] (buf4.output) -- ++(down:26.4mm) -| (and8.input 1);
  36. \draw (and5.output) -- ++(down:5mm) -| (or2.input 4);
  37. \draw (and6.output) -- ++(down:3mm) -| (or2.input 3);
  38. \draw (and7.output) -- ++(down:3mm) -| (or2.input 2);
  39. \draw (and8.output) -- ++(down:5mm) -| (or2.input 1);
  40. % Inputs and Outputs of Multiplexer
  41. \draw [black,very thick] (buf1.input) -- ++(up:5mm) node [above]{$E_a$};
  42. % Enable Signal a
  43. \draw [black,very thick] (buf4.input) -- ++(up:5mm) node [above]{$E_b$};
  44. % Enable Signal b
  45. \draw [black,very thick] (not1.input) -- ++(up:5mm) node [above]{$S_a$};
  46. % Selection Signal a
  47. \draw [black,very thick] (not2.input) -- ++(up:5mm) node [above]{$S_b$};
  48. % Selection Signal b
  49. % Inputs I_na with n={0, 1, 2, 3}
  50. \draw [black,very thick] (and1.input 1) -- ++(up:4.3) node [above]{$I_{0a}$};
  51. \draw [black,very thick] (and2.input 1) -- ++(up:4.3) node [above]{$I_{1a}$};
  52. \draw [black,very thick] (and3.input 1) -- ++(up:4.3) node [above]{$I_{2a}$};
  53. \draw [black,very thick] (and4.input 1) -- ++(up:4.3) node [above]{$I_{3a}$};
  54. % Inputs I_nb with n={0, 1, 2, 3}
  55. \draw [black,very thick] (and5.input 4) -- ++(up:4.3) node [above]{$I_{0b}$};
  56. \draw [black,very thick] (and6.input 4) -- ++(up:4.3) node [above]{$I_{1b}$};
  57. \draw [black,very thick] (and7.input 4) -- ++(up:4.3) node [above]{$I_{2b}$};
  58. \draw [black,very thick] (and8.input 4) -- ++(up:4.3) node [above]{$I_{3b}$};
  59. % Output of NOT gates
  60. \draw [blue, very thick] (not1.output) -- ++(down:2.5mm)
  61. -- ++(left:5mm) -- (5,0.45);
  62. \draw [blue, very thick] (not1.output) -- (buf2.input);
  63. \draw [Gold3, very thick] (not2.output) -- ++(down:2.5mm) -- ++(left:5mm)
  64. -- (6.5,0.1);
  65. \draw [Gold3, very thick] (not2.output) -- (buf3.input);
  66. % Output of BUFFER gates
  67. \draw [Brown4, very thick] (buf2.output) -- (5.5,1);
  68. \draw [Green4, very thick] (buf3.output) -- (7,0.7);
  69. % Interconnection of AND gates
  70. \draw [red,very thick] (and1.input 4) -- ++(up:3mm) -| (and2.input 4)
  71. -- ++(up:3mm) -| (and3.input 4) -- ++(up:3mm) -| (and4.input 4);
  72. \draw [red,very thick] (and5.input 1) -- ++(up:3mm) -| (and6.input 1)
  73. -- ++(up:3mm) -| (and7.input 1) -- ++(up:3mm) -| (and8.input 1);
  74. \draw [blue,very thick] (and1.input 3) -- ++(up:9mm) -| (and2.input 3)
  75. -- ++(up:9mm) -| (and5.input 3) -- ++(up:9mm) -| (and6.input 3);
  76. \draw [Gold3,very thick] (and1.input 2) -- ++(up:6mm) -| (and3.input 2)
  77. -- ++(up:6mm) -| (and5.input 2) -- ++(up:6mm) -| (and7.input 2);
  78. \draw [Green4,very thick] (and2.input 2) -- ++(up:12mm) -| (and4.input 2)
  79. -- ++(up:12mm) -| (and6.input 2) -- ++(up:12mm) -| (and8.input 2);
  80. \draw [Brown4,very thick] (and3.input 3) -- ++(up:15mm) -| (and4.input 3)
  81. -- ++(up:15mm) -| (and7.input 3) -- ++(up:15mm) -| (and8.input 3);
  82. % Outputs of multiplexer
  83. % Buffers at output of OR logic gates.
  84. \node[buffer gate, point down,inputs={i}] (1y) at (2.25,-4.5) {};
  85. \node[buffer gate, point down,inputs={i}] (2y) at (10.25,-4.5) {};
  86. % Connecting output of OR logic gates to Buffers input
  87. \draw (or1.output) -- (1y.input);
  88. \draw (or2.output) -- (2y.input);
  89. % Outputs of multiplexer
  90. \draw (1y.output) -- ++(down:5mm) node [below]{$1Y$};
  91. \draw (2y.output) -- ++(down:5mm) node [below]{$2Y$};
  92. \end{tikzpicture}
  93. \end{document}


multiplexer.png
multiplexer.png (34.35 KiB) Viewed 4509 times


Stefan
Site admin

User avatar
Stefan Kottwitz
Site Admin
Posts: 8544
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Jan 08, 2016 12:19 pm

Here's another electric circuit TikZ example I made, showing what I like: at first, placing all nodes worth names in a matrix like way, then connecting the nodes by elements.

  1. % https://www.packtpub.com/hardware-and-creative/latex-cookbook
  2. \documentclass[border = 10pt]{standalone}
  3. \usepackage{tikz}
  4. \usetikzlibrary{circuits.ee.IEC}
  5. \begin{document}
  6. \begin{tikzpicture}[
  7. circuit ee IEC,
  8. x = 3cm, y = 2cm,
  9. every info/.style = {font = \scriptsize},
  10. set diode graphic = var diode IEC graphic,
  11. set make contact graphic = var make contact IEC graphic,
  12. ]
  13. \foreach \i in {1,...,3} {
  14. \node [contact] (lower contact \i) at (\i,0) {};
  15. \node [contact] (upper contact \i) at (\i,1) {};
  16. }
  17. \draw (upper contact 1) to [diode] (lower contact 1);
  18. \draw (lower contact 2) to [capacitor] (upper contact 2);
  19. \draw (upper contact 1) to [resistor = {ohm = 6}]
  20. (upper contact 2);
  21. \draw (lower contact 2) to [resistor = {adjustable}]
  22. (lower contact 3);
  23. \draw (lower contact 1) to [
  24. voltage source = {near start,
  25. direction info = {volt = 12}},
  26. inductor = {near end}]
  27. (lower contact 2);
  28. \draw (upper contact 2) to [make contact = {near start},
  29. battery = {near end,
  30. info = {loaded}}]
  31. (upper contact 3);
  32. \draw (lower contact 3) to [bulb = {minimum height = 0.6cm}]
  33. (upper contact 3);
  34. \end{tikzpicture}
  35. \end{document}


circuits.png
circuits.png (16.78 KiB) Viewed 4506 times


If you need to know how to make a specific detail, let us know.

Stefan
Site admin

User avatar
Stefan Kottwitz
Site Admin
Posts: 8544
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Jan 08, 2016 2:58 pm

I saw you follow-up question to the crosspost. As I started here, I simply continue here.

What I would improve at first:
  • Avoid having coordinate numbers everywhere. Working on it, it's hard to remember what (3.5,4) actually means. It's better to use a name such as (E2) for it, so you always know the meaning. You can even label the coordinates, so no need for extra nodes.
  • Use length or macros, build coordinates on parameters, which makes changes easier, such as shifting a whole row of coordinates upwards.
  • Use styles for all what has formatting or color, so later re-styling is much easier.
  • Let TikZ calculate points such as midpoints, so it will adjust automatically when you change coordinates.
  • Use spacing to have a better readable code.

Here's a complete sample, adding + and - and the colored lines with rounded corners and arrow to your code. Not perfect, but to show what I mean. The option american current source should be removed for the desired label positioning near the line instead of the component.

  1. \documentclass{article}
  2. \usepackage[european]{circuitikz}
  3. \usetikzlibrary{arrows.meta,quotes,positioning}
  4. \def\distance{0.5}
  5. \def\leftColor{red}
  6. \def\rightColor{blue}
  7. \def\Top{4}
  8. \def\Bottom{1}
  9. \tikzset{
  10. sign1/.style={anchor=center, text=\leftColor},
  11. sign2/.style={anchor=center, text=\rightColor},
  12. }
  13. \begin{document}
  14. \begin{figure}[ht!]
  15. \begin{circuitikz}
  16. \coordinate (LeftTop) at ( -8,\Top);
  17. \coordinate (RightTop) at ( 7,\Top);
  18. \coordinate ["$B_1$"] (B1) at ( -6,\Top);
  19. \coordinate ["$B_2$"] (B2) at ( 0,\Top);
  20. \coordinate ["$E_1$"] (E1) at ( -3,\Top);
  21. \coordinate ["$E_2$"] (E2) at (3.5,\Top);
  22. \coordinate ["$C_1$"] (C1) at ( -1,\Top);
  23. \coordinate (ZT) at (5.5,\Top);
  24. \coordinate (LeftBottom) at ( -8,\Bottom);
  25. \coordinate (RightBottom) at ( 7,\Bottom);
  26. \coordinate (B2B) at ( 0,\Bottom);
  27. \coordinate (E1B) at ( -3,\Bottom);
  28. \coordinate ["below:$C_2$"] (C2) at (3.5,\Bottom);
  29. \coordinate (ZB) at (5.5,\Bottom);
  30. %\draw (LeftTop) to [open, v=$u_{ul}$,o-o] (LeftBottom);
  31. \draw (LeftTop) -- (B1);
  32. \draw (B1) to[R,l_=$h_{ie1}$,i>=$i_{b1}$,*-] (E1);
  33. \draw (B1) to [R,l=$R_{B1}$,i>=$i_{B1}$,-*] (-6,1);
  34. \draw (-0.5,4) to[european inductor,l_=$L_i$,i>=$i_{12}$,*-*] (-0.5,1);
  35. \draw (E1) to[C,l_=$C_{E1}$,i>=$i_{e1}$,*-] (-3,1);
  36. \draw (3.5,1) to[american current source,color=magenta,l=$h_{fe}i_{b2}$] (3.5,4);
  37. \draw (C1) to[american current source,color=magenta,l=$h_{fe}i_{b1}$] (-3,4);
  38. \draw (-0.5,4) to[R,l_=$h_{ie2}$,i>=$i_{b2}$,*-*] (3,4);
  39. \draw (5.5,4) to[R,l_=$Z_{E2}$] (5.5,1);
  40. \draw (RightTop) to[R,l_=$R_p$] (RightBottom);
  41. \draw (LeftBottom) -- (RightBottom);
  42. \draw (E2) -- (5.5,4);
  43. \draw (5.5,4) -- (RightTop);
  44. \draw (C1) -- (B2);
  45. %\draw (7.5,4) to [open, v=$u_{iz}$,] (7.5,1);
  46. \node (plus1) [below = \distance of LeftTop, sign1] {$+$};
  47. \node (minus1) [above = \distance of LeftBottom, sign1] {$-$};
  48. \draw [rounded corners, \leftColor, ->, >=Triangle]
  49. ($(plus1)!.5!(minus1)+(\distance,0)$) --
  50. ($(plus1)+(\distance,0)$) --
  51. ($(E1) -(\distance,\distance)$) --
  52. ($(E1B)+(-\distance,\distance)$) ->
  53. ($(minus1)+(\distance,0)$)
  54. ;
  55. \node (plus2) at ($(B2)+(0,-\distance)$) [sign2] {$+$};
  56. \node (minus2) at ($(B2B)+(0,\distance)$) [sign2] {$-$};
  57. \node (plus3) at ($(RightTop)+(\distance,-\distance)$) [sign2] {$+$};
  58. \node (minus3) at ($(RightBottom)+(\distance,\distance)$) [sign2] {$-$};
  59. \draw [rounded corners, \rightColor, dashed, ->, >=Triangle]
  60. ($(B2)!.5!(B2B)+(\distance,0)$) --
  61. ($(B2)+(\distance,-\distance)$) --
  62. ($(ZT) + (\distance,-\distance)$) --
  63. ($(ZB) + (\distance,\distance)$) ->
  64. ($(minus2)+(\distance,0)$)
  65. ;
  66. \end{circuitikz}
  67. \end{figure}
  68. \end{document}


electrical-circuit.png
electrical-circuit.png (10.87 KiB) Viewed 4491 times


Let me know if you have a question about specific things here.

Stefan
Site admin

Aemika
Posts: 1
Joined: Tue Aug 08, 2017 10:39 pm

Postby Aemika » Tue Aug 08, 2017 10:46 pm

Dear Admin and folks,

I would like to know if we can inverter(three phase) switching configuration with operating switches and current flow? mean at any given instant only 2 switches operate with one connected to positive supply and other to ground. Like if UVW are phases with 6 switches , U+W- conduct. I just started to use Latex today so i am not aware of complete commands to draw a electrical circuit.Please guide me through this.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 8 guests