# How to draw this circuit (or something similar) with circuitikz?

I've been playing around with circuitikz, and am really loving it so far. The only problem is that I really don't know how to adapt it when there a symbol that I want is not present.

For example, I would like to draw the following circuit:

The specific problem that I am having is that I don't know how to terminate both ends with a +5V and -5V symbol. This is the best that I could come up with:

\documentclass{article}
\usepackage[american voltages,siunitx]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) to [battery,l=\SI{-5}{V}] (0,0)
to [empty led,l=LED1] (0,3)
to [R=\SI{510}{\ohm}] (0,5)
to [battery,l=\SI{5}{V}] (0,5);
\end{circuitikz}
\end{document}


Another related question: How do I flip the LED direction in the code above without starting from the top (0,5) and going to (0,0)? I tried something like [empty led,l<=LED1] but that didn't work.

Thank you for any advice or suggestions!

-

circuitikz uses tikz, so you can use the usual tikz constructs (such as \draw). Here's a simple version of the code producing what you need (of course, feel free to improve it according to your needs):

\documentclass{article}
\usepackage[american voltages,siunitx]{circuitikz}
\begin{document}

\begin{circuitikz}
\draw (0,5) to [R={\parbox{1cm}{R1\\\SI{510}{\ohm}}}] (0,3)
to [empty led,l=LED1] (0,0);
\draw (-0.5,0) -- node[anchor=north,align=center] {\SI{-5}{V}  \\ IR-LED } (0.5,0);
\draw (-0.5,5) --  node[anchor=south] {VCC} (0.5,5)  node[anchor=west] {\SI{5}{V}};
\end{circuitikz}

\end{document}


Following a suggestion by Harish Kumar, you can flip the LED direction by interchanging its coordinates:

\documentclass{article}
\usepackage[american voltages,siunitx]{circuitikz}

\begin{document}

\begin{circuitikz}
\draw (0,3) to [empty led,l=LED]  (0,0);
\draw (0,3) to  [R={\parbox{1cm}{R1\\\SI{510}{\ohm}}}, mirror] (0,5);
\draw (-0.5,0) -- node[anchor=north,align=center] {\SI{-5}{V}  \\ IR-LED } (0.5,0);
\draw (-0.5,5) --  node[anchor=south] {VCC} (0.5,5)  node[anchor=west] {\SI{5}{V}};
\end{circuitikz}

\end{document}


-
To flip the direction of LED, just interchange the co-ordinates. \draw (0,0) to [empty led,l=LED1] (0,3); to \draw (0,3) to [empty led,l=LED1] (0,0); – Harish Kumar Mar 12 '12 at 23:38
@HarishKumar: thanks! I've updated my answer with your suggestion. – Gonzalo Medina Mar 12 '12 at 23:45
It should be \draw (0,0) to [empty led,l=LED1] (0,3); in the first line to flip the direction of LED in your second code. – Harish Kumar Mar 13 '12 at 0:35
Forgive me for editing your answer @Gonzalomedina. Did I edit properly? – Harish Kumar Mar 13 '12 at 0:42
@HarishKumar: no problem; you can freely edit ;-) However, I think the OP originally had the LED pointing as in your edit but wanted it flipped the other way around (as in my first example code)? – Gonzalo Medina Mar 13 '12 at 1:15