% Copyright (c):
%
% Philipp Matthias Schäfer (philipp.matthias.schaefer@posteo.de), 2020
%
% This file is part of the KrautStatus' Arduino code.
%
% The Clean CommonMark library is free software: you can redistribute it and/or
% modify it under the terms of the GNU Affero General Public License as
% published by the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% The Clean CommonMark library is distributed in the hope that it will be
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
% General Public License for more details.
%
% You should have received a copy of the GNU Affero General Public License along
% with the Clean CommonMark library. If not, see
% <https://www.gnu.org/licenses/>.
\documentclass[border=1mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{circuitikz}

\begin{document}

\begin{circuitikz}[
  chip/.style = {
    dipchip,
    hide numbers,
    no topmark,
    external pins width=0,
    num pins=14,
  }]
  \ctikzset{multipoles/dipchip/width=1.6}

  % Arduino MKR1000
  \node [chip] (MKR1000) {};
  % align=center enables line breaks in node text
  \node [align=center, rotate=90] at (MKR1000.center){Arduino\\MKR1000};

  \draw (MKR1000.n) -- ++(0,1) node[vcc]{};
  \draw (MKR1000.s) -- ++(0,-1) node[ground] {};

  \node [right, font=\tiny] at (MKR1000.bpin 4) {0};

  \node [left, font=\tiny] at (MKR1000.bpin 12) {VIN};
  \node [left, font=\tiny] at (MKR1000.bpin 11) {A3};
  \node [left, font=\tiny] at (MKR1000.bpin 10) {A4};

  % Arduino MKR RGB Shield
  \node[chip, right=of MKR1000] (RGB) {};
  % align=center enables line breaks in node text
  \node [align=center, rotate=90] at (RGB.center){Arduino\\MKR RGB Shield};

  \draw (RGB.s) -- ++(0, -1) node[ground]{};

  \node [right, font=\tiny] at (RGB.bpin 3) {VIN};
  \node [right, font=\tiny] at (RGB.bpin 4) {A3};
  \node [right, font=\tiny] at (RGB.bpin 5) {A4};

  \draw (MKR1000.bpin 12) -- (RGB.bpin 3);
  \draw (MKR1000.bpin 11) -- (RGB.bpin 4);
  \draw (MKR1000.bpin 10) -- (RGB.bpin 5);

  % Reed switch
  \draw (MKR1000.bpin 4) -- ++(-1, 0) to [normal open switch, name=R] ++(0, -2.96) node[ground]{};

  \node [rotate=90, above] at (R) {Reed Switch};
\end{circuitikz}


\end{document}
