Figure actuator circuit and signals
authorThomas Pietrzak <thomas.pietrzak@gmail.com>
Tue, 15 Feb 2022 09:19:12 +0000 (10:19 +0100)
committerThomas Pietrzak <thomas.pietrzak@gmail.com>
Tue, 15 Feb 2022 09:19:12 +0000 (10:19 +0100)
figures/actuatorcircuit.tex

index 3025f244a5bec5634809f91493a6c7220c0523c0..ca0b4b43dc2fa702f369d43ee4916a0f7719392c 100644 (file)
@@ -2,32 +2,65 @@
 
 \begin{figure}[htb]
   \centering
+
+  % height
+  % on width
+  % off width
+  % number
+  % thickness
+  % color
+  \newcommand{\sqsignal}[6]{\pgfmathsetmacro{\n}{#4 - 1}
+    \foreach \x in {0,...,\n}
+    {
+      \draw[line width=#5, #6] 
+      ({(#2 + #3) * \x}, 0) --
+      ({(#2 + #3) * \x}, #1) --
+      ({(#2 + #3) * \x + #2}, #1) --
+      ({(#2 + #3) * \x + #2}, 0) --
+      ({(#2 + #3) * (\x + 1)}, 0);
+    }
+  }
+  \definecolor{cellred}{rgb}    {0.98,0.17,0.15}
+  \definecolor{cellblue}{rgb}    {0.17,0.60,0.99}
   
-  %\tikzexternalenable
+  \tikzexternalenable
   \begin{circuitikz}[]
-    %\ctikzset{logic ports origin=center}
     \ctikzset{diodes/scale=0.6}
     \draw (0,0) node[and port] (andgate) {}
-      (andgate.in 1) to[short, -o] ++(-0.5,0) node[anchor=east] {Frequency}
-      (andgate.in 2) to[short, -o] ++(-0.5,0) node[anchor=east, o-] {Amplitude}
+      (andgate.in 1) to[short, -o] ++(-0.5,0) node[anchor=east, cellblue] {Frequency}
+      (andgate.in 2) to[short, -o] ++(-0.5,0) node[anchor=east, cellred] {Amplitude}
       (andgate.out) node[anchor=west] {};
 
     \draw (andgate.out) -- ++(0.5,0) node[nfet,bodydiode, anchor=G](nmos){};
 
     \draw (nmos.S) node[tlground](GND){};
 
-    \draw (nmos.D) to[short] ++(-0.5,0) to[short] ++(0,0.5) to[L, l=actuator] ++(0,1) to[short] ++(0,0.5) to[short, -*] ++(0.5,0) node[vcc](vcc){3V3};
+    \draw (nmos.D) to[short] ++(-0.5,0) to[short] ++(0,0.5) to[L, l=\textbf{Actuator}] ++(0,1) to[short] ++(0,0.5) to[short, -*] ++(0.5,0) node[vcc](vcc){3V3};
 
     \draw (nmos.D) -- ++(0.5,0) to[short] ++(0,0.5) to[D] ++(0,1) to[short] ++(0,0.5) to[short] ++(-0.5,0);
-
-    %\draw (0,0) node[above]{$F$} to[short, o-] ++(0.5,0)
-    %node[ieeestd and port, anchor=in 1](trans){};
-%    node[op amp, noinv input up, anchor=+](OA){\texttt{OA1}};
-
-    
-    %(node[npn]{Q}
-  \end{circuitikz}
-  %\tikzexternaldisable
-  \caption[]{}
+  \end{circuitikz}%
+  \hfill
+  \begin{tikzpicture}[x=0.9mm,y=0.9mm]
+    \draw[dotted, step=10] (0,0) grid (80,50);
+    \begin{scope}[yshift=36mm]
+      \sqsignal{10}{20}{20}{2}{0.4mm}{cellblue}
+      \node[anchor=east, cellblue] () at (0,5) {Frequency};
+    \end{scope}
+    \begin{scope}[yshift=18mm]
+      \sqsignal{10}{3}{1}{20}{0.4mm}{cellred}
+      \node[anchor=east, cellred] () at (0,5) {Amplitude};
+    \end{scope}
+    \begin{scope}[]
+      \node[anchor=east] () at (0,5) {\textbf{Actuator}};
+      \sqsignal{10}{3}{1}{5}{0.6mm}{black}
+      \draw[line width=0.6mm] (20,0) -- (40,0);
+    \end{scope}
+    \begin{scope}[xshift=36mm]
+        \sqsignal{10}{3}{1}{5}{0.6mm}{black}
+        \draw[line width=0.6mm] (20,0) -- (40,0);
+    \end{scope}
+  \end{tikzpicture}
+  \tikzexternaldisable
+  \caption[vibrotactile circuit and signal.]{On the left: electrical diagram for driving the actuators. Two signals, one for Frequency and the other for Amplitude are modulated. On the right: a low-frequency signal with 50\% duty cycle for Frequency, a high-frequency signal with a variable duty cycle for Amplitude, and the modulation of both circuits.}
   \label{fig:actuatorcircuit}
 \end{figure}