1

I would like to know the basic syntax to draw an electrical circuit. I would like to reproduce this circuit:

enter image description here

My circuit contains two switches (node[spdt]{}), one battery (battery1) and one light (lamp). My biggest issue is that I am not able to connect my component together at the right place. Also, I need to create a special intersection (pink and orange). I drew my circuit on a grid to help me to place correctly my different elements. Would it be possible to explain the syntax to correctly join my components and to guide me with the coordinate?

2
  • and what yo try so far? packages ciruitikz has the most of elements which you need for this circuits. missing one you can draw with tikz macros.
    – Zarko
    Oct 29, 2016 at 7:54
  • Have a look at the questions tagged with circuitikz (and their answers in particular). Pick an example that is similar to your circuit as a starting point. After that you will be able to ask much more specific questions that will be easier to answer. Also look into the circuitikz manual to see which building blocks are available.
    – gernot
    Oct 29, 2016 at 8:31

1 Answer 1

4

Note: Since this is a do-it-for-me question and no MWE was provided, I am not likely to entertain further questions regarding this. I did this for my own exercise.

\documentclass{report}
\usepackage{circuitikz}
\tikzset{% from https://tex.stackexchange.com/a/134090/117534
    declare function={% in case of CVS which switches the arguments of atan2
        atan3(\a,\b)=ifthenelse(atan2(0,1)==90, atan2(\a,\b), atan2(\b,\a));},
    kinky cross radius/.initial=+.125cm,
    @kinky cross/.initial=+, kinky crosses/.is choice,
    kinky crosses/left/.style={@kinky cross=-},kinky crosses/right/.style={@kinky cross=+},
    kinky cross/.style args={(#1)--(#2)}{
        to path={
            let \p{@kc@}=($(\tikztotarget)-(\tikztostart)$),
            \n{@kc@}={atan3(\p{@kc@})+180} in
            -- ($(intersection of \tikztostart--{\tikztotarget} and #1--#2)!%
            \pgfkeysvalueof{/tikz/kinky cross radius}!(\tikztostart)$)
            arc [ radius     =\pgfkeysvalueof{/tikz/kinky cross radius},
            start angle=\n{@kc@},
            delta angle=\pgfkeysvalueof{/tikz/@kinky cross}180 ]
            -- (\tikztotarget)}}}

\begin{document}
    \begin{circuitikz}
        \draw[color=orange,thick] 
         (-2,1) node[spdt,yscale=-1] (bottom-spdt) {}
         (-2,3) node[spdt,yscale=-1] (top-spdt) {}
         (top-spdt.in)      to (bottom-spdt.in)
         (top-spdt.out 2)   to ++(3,0) 
                            to[lamp,/tikz/circuitikz/bipoles/length=1cm] ++(0,-2.5) to ++(0,-1.5)
                            to[battery1] ++(-2,0) node(batt-left){}
                            |- (bottom-spdt.out 1)
         (top-spdt.out 1)   -| node(intersect){} (batt-left)
         ;
        \draw[thick, color=violet!70] 
         (bottom-spdt.out 2)    to[kinky cross=(intersect)--(batt-left)] ++(3,0)
         ;
    \end{circuitikz}
\end{document}

circuit

1
  • nice exercise! (+1)
    – Zarko
    Jun 1, 2017 at 13:27

You must log in to answer this question.

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