Circuit documentation #3

Open
fiveop wants to merge 1 commit from fiveop/documentation into master
7 changed files with 159 additions and 113 deletions
Showing only changes of commit 19b89e0e2b - Show all commits

View file

@ -0,0 +1,6 @@
#!/bin/sh
trap 'rm -f circuit.aux circuit.log circuit.pdf' 0
# create circuit.png
pdflatex -shell-escape circuit

59
docs/circuit/circuit.md Normal file
View file

@ -0,0 +1,59 @@
# Space Status Circuit
The status of Krautspace's door is captured, displayed and broadcast into the
internet by an Arduino, a Raspberry Pi, and some circuitry. The following
diagram shows a detailed representation of the circuit.
The Arduino is (and should be only) responsible for the sensor read out and the
local status display (traffic light).
The Raspberry Pi is (and should be only) responsible for grabbing the status
from the Arduino and broadcasting it to the internet.
![Circuit diagram](circuit.png)
## Sensor
The locked-unlocked-state of the door is determined by a reed switch
embedded in the strikeplate hole, that is triggered by a magnet glued to the
lock's deadbolt.
The switch is connected to the Arduino via two wires.
## Arduino
The system uses an Arduino Duemilanove. It monitors the state of the reed switch
and controls three LEDs on the breadboard.
The reed switch is connect to a 5V pin and pin D13. Note, that pin D13 also
controls the on-board LED, so whenever the switch is in the closed state (DOES
THIS CORRESPOND TO THE DOOR BEING IN THE CLOSED STATE?), the on-board LED is on.
Three LEDs, green, yellow, and red, on a breadboard have their anodes connected
to pins D10, D11, and D12 and their cathodes to GND.
The Arduino gets its power via a USB cable from the Raspberry Pi. This gives
them with a common ground. If this were not the case, the connection between
their grounds via the breadboard, as it exists right now and is shown in the
diagram, would be required.
The logic of how the state of the reed switch is converted into the state of the
LEDs is discussed in the documentation of the Arduino software.
## Circuit
The circuit uses 120Ω series resistors for the LEDs.
The circuit also includes a voltage divider for the Raspberry Pi's connection
to the anode of the green LED. The voltage is reduced from 5V to
1.8kΩ/(1.8kΩ + 2.1kΩ) * 5V ~= 0.5 * 5V ~= 2.5V.
## Raspberry Pi
The system uses a Raspberry Pi Model 3.
The Raspberry Pi grabs the state of the green LED from its anode on the
breadboard. This is done via pin GPIO18.
The logic of how this state is communicated to the internet is discussed in the
documentation for the Raspberry Pi software.

BIN
docs/circuit/circuit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

94
docs/circuit/circuit.tex Normal file
View file

@ -0,0 +1,94 @@
\documentclass[border=10, convert={outfile=\jobname.png}]{standalone}
\usepackage[european resistor]{circuitikz}
\usetikzlibrary{fit, shapes.misc}
\usepackage{siunitx}
\begin{document}
\begin{circuitikz}[]
% Raspberry Pi 3B
\draw (0.5, 3.5) rectangle (3, -2);
\node[right] at (1, 3) {\textbf{Raspi}};
\draw (3.5, 2) to [short] (2.5, 2) node [left] {GND};
\draw (3.5, 0) to [short] (2.5, 0) node [left] {GPIO18};
\draw (1.75, -1.5) node [above] {USB}
to [short] (1.75, -2.5);
% Bread Board
\draw (4, 3.5) rectangle (11.5, -4);
\node[right] at (4.5, 3) {\textbf{Breadboard}};
\draw (3.5, 2) to [short] (4.5, 2) node [circ] {}
to [short] (6.5, 2) node [circ] {}
to [short] (12, 2);
\draw (3.5, 0) to [short] (4.5, 0) node [circ] {}
to [R, l=$\SI{1.8}{\kilo\ohm}$] (6.5, 0)
to [short] (10.5, 0);
\draw (12, 1)
to [short] (10.5, 1)
to [R, l_=$\SI{120}{\ohm}$] (8.5, 1)
to [empty led, l_=Green] (6.5, 1) node [circ] {};
\draw (12, -1.5)
to [short] (10.5, -1.5)
to [R, l_=$\SI{120}{\ohm}$] (8.5, -1.5)
to [empty led, l_=Yellow] (6.5, -1.5) node [circ] {};
\draw (12, -3)
to [short] (10.5, -3)
to [R, l_=$\SI{120}{\ohm}$] (8.5, -3)
to [empty led, l_=Red] (6.5, -3) node [circ] {};
\draw (11, -3) to [short] (12, -3);
\draw (4.5, 2) to [R, l=$\SI{2.1}{\kilo\ohm}$] (4.5, 0);
\draw (6.5, 2) to [short] (6.5, -3);
\draw (10.5, 1) node [circ] {}
to [short] (10.5, 0);
% Arduino Duemilanove
\draw (12.5, 3.5) rectangle (16, -3.5);
\node[right] at (13, 3) {\textbf{Arduino}};
\draw (12, 2) to [short] (13, 2) node [right] {GND};
\draw (12, 1) to [short] (13, 1) node [right] {D10};
\draw (12, -1.5) to [short] (13, -1.5) node [right] {D11};
\draw (12, -3) to [short] (13, -3) node [right] {D12};
\draw (16.5, 2) to [short] (15.5, 2) node [left] {\SI{5}{\volt}};
\draw (16.5, 0) to [short] (15.5, 0) node [left] {D13};
\draw (15, -3) node [above] {USB}
to [short] (15, -4);
% Sensor
\draw (17, 3.5) rectangle (19.5, -0.5);
\node[right] at (17.5, 3) {\textbf{Sensor}};
\draw (16.5, 2) to [short] (18, 2);
\draw (16.5, 0) to [short] (18, 0);
\draw (18, 2) to [normal open switch, name=switch] (18, 0);
\node [rounded rectangle, line width=1pt, draw, fit=(switch), inner ysep=1pt, inner xsep=10, rotate=90] at (switch.center) {};
% USB cable
\draw (1.75, -2.5)
to [short] (1.75, -5)
to [short, l=Power for Arduino] (15, -5)
to [short] (15, -4);
\end{circuitikz}
\end{document}
%%% Local Variables:
%%% coding: utf-8
%%% mode: latex
%%% TeX-engine: xetex
%%% End:

View file

@ -1,3 +0,0 @@
circuits.aux
circuits.log
circuits.pdf

View file

@ -1 +0,0 @@
xelatex circuits.tex

View file

@ -1,109 +0,0 @@
\documentclass[a4paper]{scrartcl}
\usepackage{tikz}
\usepackage[european resistor]{circuitikz}
\usepackage{siunitx}
\begin{document}
\begin{figure}
\begin{circuitikz}
% Raspberry Pi
\draw (0.5, -0.5) rectangle (3, 3.5);
\node at (1.5, 3) {\textbf{RPi}};
\draw (3.5, 2) to [short] (2.5, 2) node [left] {GND};
\draw (3.5, 0) to [short] (2.5, 0) node [left] {GPIO18};
% Bread Board 1
\draw (4, -0.5) rectangle (7.5, 3.5);
\node at (5, 3) {\textbf{BB1}};
\draw (3.5, 2) to [short] (4.5, 2) node [circ] {}
to [short] (5.5, 2) node [circ] {}
to [short] (8, 2);
\draw (3.5, 0) to [short] (4.5, 0) node [circ] {}
to [short] (5.5, 0) node [circ] {}
to [R, l=$R_2$] (7.5, 0)
to [short] (8, 0);
\draw (4.5, 2) to [push button] (4.5, 0);
\draw (5.5, 2) to [R, l=$R_1$] (5.5, 0);
% Bread Board 2
\draw (8.5, -3.5) rectangle (11.5, 3.5);
\node at (10, 3) {\textbf{BB2}};
\draw (8, 2) to [short] (9, 2) node [circ] {}
to [short] (12, 2);
\draw (9, 1) node [circ] {} to [empty led] (11, 1) node [circ] {}
to [short] (12, 1);
\draw (8, 0) to [short] (9.5, 0)
to [empty led] (11.5, 0)
to [short] (12, 0);
\draw (9, -1) node [circ] {} to [R, l=$R_3$] (11, -1)
to [short] (12, -1);
\draw (10, -2) to [short] (12, -2);
\draw (11, -3) to [short] (12, -3);
\draw (9, 4) to [short] (9, -1)
to [R, l=$R_4$] (9, -3)
to [short] (9, -4);
\draw (10, -2) to [short] (10, -4);
\draw (11, 4) to [short] (11, 1);
\draw (11, -3) to [short] (11, -4);
% Door
\draw (8.5, 4.5) rectangle (11.5, 6.5);
\node at (9.5, 6) {\textbf{Door}};
\draw (9, 5) to [empty led] (11, 5);
\draw (9, 5) to [short] (9, 4);
\draw (11, 5) to [short] (11, 4);
% ADMN
\draw (12.5, -3.5) rectangle (15, 3.5);
\node at (13.5, 3) {\textbf{Arduino}};
\draw (12, 2) to [short] (13, 2) node [right] {GND};
\draw (12, 1) to [short] (13, 1) node [right] {D12};
\draw (12, 0) to [short] (13, 0) node [right] {D10};
\draw (12, -1) to [short] (13, -1) node [right] {A0};
\draw (12, -2) to [short] (13, -2) node [right] {\SI{5}{\volt}};
\draw (12, -3) to [short] (13, -3) node [right] {D13};
% Sensor
\draw (8.5, -4.5) rectangle (11.5, -7);
\node at (9.5, -6.5) {\textbf{Sensor}};
\draw (9, -4) to [short] (9, -5) node [rotate=90, left] {black};
\draw (10, -4) to [short] (10, -5) node [rotate=90, left] {blue};
\draw (11, -4) to [short] (11, -5) node [rotate=90, left] {red};
\end{circuitikz}
\caption{
$R_1 = \SI{33}{\kilo\ohm} \pm \SI{2}{\percent}$,
$R_2 = \SI{28}{\kilo\ohm} \pm \SI{2}{\percent}$,
$R_3 = \SI{68}{\kilo\ohm} \pm \SI{1}{\percent}$,
$R_4 = \SI{200}{\ohm} \pm \SI{1}{\percent}$,
}
\end{figure}
\end{document}
%%% Local Variables:
%%% coding: utf-8
%%% mode: latex
%%% TeX-engine: xetex
%%% End: