diff --git a/circuit/little_converter/little_converter.kicad_pcb b/circuit/little_converter/little_converter.kicad_pcb
new file mode 100644
index 0000000..c547853
--- /dev/null
+++ b/circuit/little_converter/little_converter.kicad_pcb
@@ -0,0 +1,2 @@
+(kicad_pcb (version 20241229) (generator "pcbnew") (generator_version "9.0")
+)
\ No newline at end of file
diff --git a/circuit/little_converter/little_converter.kicad_pro b/circuit/little_converter/little_converter.kicad_pro
new file mode 100644
index 0000000..f8c65e3
--- /dev/null
+++ b/circuit/little_converter/little_converter.kicad_pro
@@ -0,0 +1,32 @@
+{
+ "board": {
+ "design_settings": {
+ "defaults": {},
+ "diff_pair_dimensions": [],
+ "drc_exclusions": [],
+ "rules": {},
+ "track_widths": [],
+ "via_dimensions": []
+ }
+ },
+ "boards": [],
+ "libraries": {
+ "pinned_footprint_libs": [],
+ "pinned_symbol_libs": []
+ },
+ "meta": {
+ "filename": "kicad.kicad_pro",
+ "version": 1
+ },
+ "net_settings": {
+ "classes": [],
+ "meta": {
+ "version": 0
+ }
+ },
+ "pcbnew": {
+ "page_layout_descr_file": ""
+ },
+ "sheets": [],
+ "text_variables": {}
+}
diff --git a/circuit/little_converter/little_converter.kicad_sch b/circuit/little_converter/little_converter.kicad_sch
new file mode 100644
index 0000000..dadede7
--- /dev/null
+++ b/circuit/little_converter/little_converter.kicad_sch
@@ -0,0 +1,14 @@
+(kicad_sch
+ (version 20250114)
+ (generator "eeschema")
+ (generator_version "9.0")
+ (uuid 39218834-6d97-472f-bed5-15d4e2519ad2)
+ (paper "A4")
+ (lib_symbols)
+ (sheet_instances
+ (path "/"
+ (page "1")
+ )
+ )
+ (embedded_fonts no)
+)
\ No newline at end of file
diff --git a/presentation/Illustrations/Regression_pos_volt.png b/presentation/Illustrations/Regression_pos_volt.png
new file mode 100644
index 0000000..061729d
Binary files /dev/null and b/presentation/Illustrations/Regression_pos_volt.png differ
diff --git a/presentation/Illustrations/Schema_Forces.png b/presentation/Illustrations/Schema_Forces.png
new file mode 100644
index 0000000..9a644fc
Binary files /dev/null and b/presentation/Illustrations/Schema_Forces.png differ
diff --git a/presentation/Illustrations/StepRespnseRail.png b/presentation/Illustrations/StepRespnseRail.png
new file mode 100644
index 0000000..654e804
Binary files /dev/null and b/presentation/Illustrations/StepRespnseRail.png differ
diff --git a/presentation/Illustrations/StepRespnseRail.svg b/presentation/Illustrations/StepRespnseRail.svg
new file mode 100755
index 0000000..b1b10ac
--- /dev/null
+++ b/presentation/Illustrations/StepRespnseRail.svg
@@ -0,0 +1,460 @@
+
+
+
diff --git a/presentation/Illustrations/allmarginBode.png b/presentation/Illustrations/allmarginBode.png
new file mode 100755
index 0000000..ef1c82d
Binary files /dev/null and b/presentation/Illustrations/allmarginBode.png differ
diff --git a/presentation/Illustrations/bodeCorrecteur.png b/presentation/Illustrations/bodeCorrecteur.png
new file mode 100644
index 0000000..21995b7
Binary files /dev/null and b/presentation/Illustrations/bodeCorrecteur.png differ
diff --git a/presentation/Illustrations/bodeCorrecteur.svg b/presentation/Illustrations/bodeCorrecteur.svg
new file mode 100755
index 0000000..27cb182
--- /dev/null
+++ b/presentation/Illustrations/bodeCorrecteur.svg
@@ -0,0 +1,368 @@
+
+
+
diff --git a/presentation/Illustrations/bodeRail.png b/presentation/Illustrations/bodeRail.png
new file mode 100644
index 0000000..e856c99
Binary files /dev/null and b/presentation/Illustrations/bodeRail.png differ
diff --git a/presentation/Illustrations/bodeRail.svg b/presentation/Illustrations/bodeRail.svg
new file mode 100755
index 0000000..6eb2784
--- /dev/null
+++ b/presentation/Illustrations/bodeRail.svg
@@ -0,0 +1,245 @@
+
+
+
diff --git a/presentation/Illustrations/bodeRail1.png b/presentation/Illustrations/bodeRail1.png
new file mode 100644
index 0000000..b278a75
Binary files /dev/null and b/presentation/Illustrations/bodeRail1.png differ
diff --git a/presentation/Illustrations/bodeRail1.svg b/presentation/Illustrations/bodeRail1.svg
new file mode 100755
index 0000000..a939d43
--- /dev/null
+++ b/presentation/Illustrations/bodeRail1.svg
@@ -0,0 +1,306 @@
+
+
+
diff --git a/presentation/Illustrations/commandeSimulink Global.pdf b/presentation/Illustrations/commandeSimulink Global.pdf
new file mode 100755
index 0000000..a76b4e0
Binary files /dev/null and b/presentation/Illustrations/commandeSimulink Global.pdf differ
diff --git a/presentation/Illustrations/commandeSimulink Rail.pdf b/presentation/Illustrations/commandeSimulink Rail.pdf
new file mode 100755
index 0000000..c2ccc60
Binary files /dev/null and b/presentation/Illustrations/commandeSimulink Rail.pdf differ
diff --git a/presentation/Illustrations/commandeSimulinkComplete.pdf b/presentation/Illustrations/commandeSimulinkComplete.pdf
new file mode 100755
index 0000000..4d5c014
Binary files /dev/null and b/presentation/Illustrations/commandeSimulinkComplete.pdf differ
diff --git a/presentation/Illustrations/fig1.png b/presentation/Illustrations/fig1.png
new file mode 100644
index 0000000..22c814c
Binary files /dev/null and b/presentation/Illustrations/fig1.png differ
diff --git a/presentation/Illustrations/fig1.svg b/presentation/Illustrations/fig1.svg
new file mode 100755
index 0000000..4437f59
--- /dev/null
+++ b/presentation/Illustrations/fig1.svg
@@ -0,0 +1,1831 @@
+
+
+
diff --git a/presentation/Illustrations/fig2.png b/presentation/Illustrations/fig2.png
new file mode 100644
index 0000000..029f31b
Binary files /dev/null and b/presentation/Illustrations/fig2.png differ
diff --git a/presentation/Illustrations/fig2.svg b/presentation/Illustrations/fig2.svg
new file mode 100755
index 0000000..e789da1
--- /dev/null
+++ b/presentation/Illustrations/fig2.svg
@@ -0,0 +1,268 @@
+
+
+
diff --git a/presentation/Illustrations/identificationSimulinkComplete.pdf b/presentation/Illustrations/identificationSimulinkComplete.pdf
new file mode 100755
index 0000000..02c8518
Binary files /dev/null and b/presentation/Illustrations/identificationSimulinkComplete.pdf differ
diff --git a/presentation/Illustrations/multisine1.pdf b/presentation/Illustrations/multisine1.pdf
new file mode 100755
index 0000000..4a702d7
Binary files /dev/null and b/presentation/Illustrations/multisine1.pdf differ
diff --git a/presentation/Illustrations/multisine1.png b/presentation/Illustrations/multisine1.png
new file mode 100755
index 0000000..12794b3
Binary files /dev/null and b/presentation/Illustrations/multisine1.png differ
diff --git a/presentation/Illustrations/multisine1.svg b/presentation/Illustrations/multisine1.svg
new file mode 100755
index 0000000..4437f59
--- /dev/null
+++ b/presentation/Illustrations/multisine1.svg
@@ -0,0 +1,1831 @@
+
+
+
diff --git a/presentation/Illustrations/multisine2.pdf b/presentation/Illustrations/multisine2.pdf
new file mode 100644
index 0000000..1b0fa9b
Binary files /dev/null and b/presentation/Illustrations/multisine2.pdf differ
diff --git a/presentation/Illustrations/multisine2.svg b/presentation/Illustrations/multisine2.svg
new file mode 100755
index 0000000..582c7ce
--- /dev/null
+++ b/presentation/Illustrations/multisine2.svg
@@ -0,0 +1,513 @@
+
+
+
diff --git a/presentation/main.pdf b/presentation/main.pdf
new file mode 100644
index 0000000..9a014e7
Binary files /dev/null and b/presentation/main.pdf differ
diff --git a/presentation/main.tex b/presentation/main.tex
new file mode 100644
index 0000000..4d75774
--- /dev/null
+++ b/presentation/main.tex
@@ -0,0 +1,457 @@
+\documentclass{beamer}
+
+\mode
+{
+ \usetheme{JuanLesPins} % or try default, Madrid, Darmstadt, Warsaw, JuanLesPins, ...
+
+% \AtBeginSection[]{ % Uncomment to add section pages automatically
+% \begin{frame}
+% \vfill
+% \centering
+% \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
+% \usebeamerfont{title}\insertsectionhead\par%
+% \end{beamercolorbox}
+% \vfill
+% \end{frame}
+% }
+
+ \usecolortheme{default} % or try albatross, beaver, crane, ...
+ \usefonttheme{serif} % or try default, structurebold, ...
+ \setbeamertemplate{navigation symbols}{}
+ \setbeamertemplate{caption}[numbered]
+}
+
+\usepackage[french]{babel}
+\usepackage[utf8x]{inputenc}
+\usepackage{chemfig}
+\usepackage[version=3]{mhchem}
+
+%%Bibliotek for blokksjema
+\usepackage{tikz}
+\usetikzlibrary{shapes, arrows.meta, positioning}
+\usetikzlibrary{decorations.pathreplacing}
+
+\tikzstyle{block} = [draw, fill=white, rectangle,
+minimum height=3em, minimum width=6em]
+\tikzstyle{sum} = [draw, fill=white, circle, node distance=1cm]
+\tikzstyle{input} = [coordinate]
+\tikzstyle{output} = [coordinate]
+\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
+
+% On Overleaf, these lines give you sharper preview images.
+% You might want to `comment them out before you export, though.
+%\usepackage{pgfpages}
+%\pgfpagesuselayout{resize to}[%physical paper width=33.87cm, physical paper height=19.05cm]
+
+% Here's where the presentation starts, with the info for the title slide
+\title[Miniprojet automation]{Miniprojet automation - bille sur rail}
+\author[ORVIK, JOHNSEN et TABAN]{ORVIK Oskar, JOHNSEN Brage \& TABAN Aleksander}
+\institute{INSA Toulouse - DGEI - 4AE-SE}
+\date{\today}
+
+
+\begin{document}
+
+
+\begin{frame}
+ \titlepage
+\end{frame}
+
+
+\begin{frame}{Sommaire}
+ \tableofcontents
+\end{frame}
+
+
+\section{Introduction}
+\begin{frame}[fragile]
+ \frametitle{Introduction}
+
+ Le bille sur rail est une manipulation où le but est de stabiliser une bille sur un rail. Le rail est commandé par une tension, et les données lues sont l'angle du rail et la position de la bille. La position est achevé à l'aide d'un lecture d'impedance.
+
+ \begin{figure}[H]
+ \centering
+ \includegraphics[scale=0.4]{./Illustrations/Schema_Forces.png}
+ \caption{Schèma de forces de la bille sur rail}
+ \label{fig:forces}
+ \end{figure}
+\end{frame}
+
+
+\section{Identification du système rail}
+\subsection{Analyse du schèma bloc du système rail}
+\begin{frame}[fragile]
+ \frametitle{Analyse du schèma bloc du système rail}
+
+ L'identification du système se fait en bouclé fermé.
+
+ \begin{figure}[H]
+ \centering
+ \begin{tikzpicture}[auto, node distance=2cm,>=latex]
+ \node [input, name=input] {};
+ \node [sum, right of=input] (sum) {};
+ %%\node [block, right of=sum] (controller) {};
+ \node [block, right of=sum,
+ node distance=3cm] (system) {$G_{Rail}(p)$};
+
+ \draw [->] (sum) -- node[name=u] {$u$} (system);
+ \node [output, right of=system] (output) {};
+ %\node [block, below of=u] (measurements) {Measurements};
+ \coordinate [below of=u] (measurements) {};
+
+ \draw [draw,->] (input) -- node {$r$} (sum);
+ %\draw [->] (sum) -- node {$e$} (system);
+ \draw [->] (system) -- node [name=y] {$y$}(output);
+ %\draw [->] (y) |- (measurements);
+ \draw [-] (y) |- (measurements);
+ %\draw [->] (measurements) -| node[pos=0.99] {$-$}
+ \draw [->] (measurements) -| %node[pos=1.00] {$-$}
+ node [near end] {$y_m$} (sum);
+
+ \coordinate [below=1.7cm of sum] (u1) {};
+ \coordinate [below=1.88cm of y] (u2) {};
+ \draw[decorate, decoration={brace, mirror, amplitude=8pt}]
+ (u1.south west) -- (u2.south east)
+ node[midway, below=10pt] {$H(p)$};
+ \end{tikzpicture}
+ \caption{Schèma-bloc décrivant le système rail}
+ \label{fig:rail}
+ \end{figure}
+\end{frame}
+
+
+\subsection{Mise en œuvre de N4SID}
+\begin{frame}[fragile]
+ \frametitle{Mise en œuvre de N4SID}
+ Nous utilisons la fonction MATLAB "multisine()" pour générer un signal de test de ce système.
+ \begin{figure}[H]
+ \centering
+ \includegraphics[scale=0.2, ]{./Illustrations/multisine1.png}
+ \caption{Le signal d'entrée, de type "multisine" entre 0.1Hz et 4Hz}
+ \label{fig:multisine}
+ \end{figure}
+
+\end{frame}
+
+
+\subsection{Test du modèle obtenu avec N4SID}
+\begin{frame}[fragile]
+ \frametitle{Test du modèle obtenu avec N4SID}
+ Nous trouvons la fonction de transfert en utilisant la fonction MATLAB "n4sid()" en temporel et frequentiel.
+ \begin{figure}[H]
+ \centering
+ \includegraphics[scale=0.45, trim= 0 0.7cm 0 0.7cm, clip]{./Illustrations/fig2.png}
+ \caption{Comportement des differents modèles obtenus}
+ \label{fig:modeles}
+ \end{figure}
+
+ \vspace{-1em}
+ Après comparaison, nous avons choisi "temporel ordre 2".
+
+\end{frame}
+
+
+\subsection{Fonction transfert du système: Rail}
+\begin{frame}
+ \frametitle{Fonction transfert du système: Rail}
+ Cela nous avait mené à résumer le systeme du rail à la fonction de transfert suivante :
+
+ \begin{equation*}
+ \boxed{H(z) = \frac{0,2977 z^{-1} - 0,2962 z^{-2}}{1 - 1,825 z^{-1} + 0,8496 z^{-2}}}
+ \end{equation*}
+
+ \vspace{1em}
+ Après avoir trouvé le modèle souhaité, nous avons ensuite retrouvé la vraie fonction transfert du rail aprés un d2c() :
+
+ \begin{equation*}
+ H(p)=\frac{G(p)}{1+G(p)}\Rightarrow G(p)=\frac{H(p)}{1-H(p)}
+ \end{equation*}
+\end{frame}
+
+
+\subsection{Calcul du correcteur du système : $K_p$}
+\begin{frame}
+ \frametitle{Calcul du correcteur du système : $K_p$}
+ Nous avons conçu un retour PID pour le système du rail. Après avoir parlé avec le professeur, il nous a dit que le système est déjà equipé d'un integrateur. Donc nous avons choisi un système bouclé avec un simple correcteur P. Comme nous pouvons voir ci-dessous:
+
+ \begin{figure}
+ \centering
+ \begin{tikzpicture}[auto, node distance=2cm,>=latex]
+ \node [input, name=input] {};
+ \node [sum, right of=input] (sum) {};
+ \node [block, right of=sum] (controller) {Correcteur : $K_p$};
+ \node [block, right of=controller,
+ node distance=3cm] (system) {$G_{Rail}(p)$};
+
+ \draw [->] (controller) -- node[name=u] {$u$} (system);
+ \node [output, right of=system] (output) {};
+ %\node [block, below of=u] (measurements) {Measurements};
+ \coordinate [below of=u] (measurements) {};
+
+ \draw [draw,->] (input) -- node {$r$} (sum);
+ \draw [->] (sum) -- node {$e$} (controller);
+ \draw [->] (system) -- node [name=y] {$y$}(output);
+ %\draw [->] (y) |- (measurements);
+ \draw [-] (y) |- (measurements);
+ %\draw [->] (measurements) -| node[pos=0.99] {$-$}
+ \draw [->] (measurements) -| %node[pos=1.00] {$-$}
+ node [near end] {$y_m$} (sum);
+
+ \coordinate [below=1.7cm of sum] (u1) {};
+ \coordinate [below=1.88cm of y] (u2) {};
+ \draw[decorate, decoration={brace, mirror, amplitude=8pt}]
+ (u1.south west) -- (u2.south east)
+ node[midway, below=10pt] {$H_C(p)$};
+ \end{tikzpicture}
+ \caption{Schèma-bloc décrivant le système rail avec correcteur}
+ \label{fig:rail_correcteur}
+ \end{figure}
+\end{frame}
+
+\begin{frame}
+ Après avoir conçu le système avec n4sid(), nous avons retrouvé la fonction de transfert :
+
+ \begin{equation*}
+ H(p) = \frac{6,464p + 0,6686}{p^2 + 3,261 p + 10,52}
+ \end{equation*}
+
+ À l'aide de la fonction de transfert du système rail, nous avons recalculé la nouvelle fonction transferte avec le gain proportionnel en boucle fermée :
+
+ \begin{center}
+ $$ G(p)=\frac{H(p)}{1-H(p)} = \frac {5,564 p^3 + 18,72 p^2 + 60,43 p + 6,058 }{p ^4 + 0,5397 p ^3 + 10,14 p ^2 - 0,9659 p + 89,3 } $$
+ $$ G_{BF \ K_p}(p)=\frac{K_p G(p)}{1+K_p G(p)} $$
+ \end{center}
+\end{frame}
+
+
+\begin{frame}
+ Finalement, on essaie des valeurs différentes pour P pour observer le temps de réponse en boucle fermée avec correcteur.
+
+ \begin{figure}
+ \centering
+ \includegraphics[scale=0.4]{./Illustrations/StepRespnseRail.png}
+ \caption{Réponse à un échelon avec des $K_p$ différents }
+ \label{fig:test_gain}
+ \end{figure}
+
+ Nous avons choisi $\boxed{K_p = 1}$, bien rapide.
+\end{frame}
+
+
+\section{Loi de commande du bille sur rail}
+\subsection{Système bouclé avec la bille}
+\begin{frame}
+ \frametitle{Système bouclé avec la bille}
+ \begin{figure}
+ \scalebox{0.65}{\begin{tikzpicture}[auto, node distance=2cm,>=latex]
+ \node [input, name=input] {};
+
+ %Bloc pos/tension
+ \node [block, right of=input] (Kb) {$K_b$};
+
+ %Somme de erreur
+ \node [sum, right of=Kb, node distance=2.5cm] (sum2) {};
+
+ % First controller (Tc) AFTER input
+ \node [block, right of=sum2] (Tc) {$T_c$};
+
+ % Sum AFTER Tc
+ \node [sum, right of=Tc, node distance=3cm] (sum) {};
+
+ % Second controller (P) AFTER sum
+ \node [block, right of=sum] (Pctrl) {$Controleur : K_p$};
+
+ % System
+ \node [block, right of=Pctrl, node distance=3cm] (system) {$G_{Rail}(p)$};
+
+ % Output
+ \node [output, right of=system] (output) {};
+
+ % Connections
+ \draw [->] (input) -- node {$x_c$} (Kb);
+ \draw [->] (Kb) -- node {$V_x$} (sum2);
+ \draw [->] (sum2) -- node {$\epsilon$} (Tc);
+ \draw [->] (Tc) -- node {$r$} (sum);
+ \draw [->] (sum) -- node {$e$} (Pctrl);
+ \draw [->] (Pctrl) -- node[name=u] {$u$} (system);
+ \draw [->] (system) -- node[name=y] {$V_\theta$} (output);
+
+ % Feedback path
+ \coordinate [below of=u] (measurements) {};
+ \draw [-] (y) |- (measurements);
+ \draw [->] (measurements) -| node [near end] {$V_\theta$} (sum);
+
+ % Feedback path 2
+ \coordinate [below=2.7cm of sum2] (measurements2) {};
+ \draw [-] (y) |- (measurements2);
+ \draw [->] (measurements2) -| node [near end] {$V_\theta$} (sum2);
+
+ % Brace 1
+ \coordinate [below=1.7cm of sum] (u1) {};
+ \coordinate [below=1.88cm of y] (u2) {};
+ \draw[decorate, decoration={brace, mirror, amplitude=8pt}]
+ (u1.south west) -- (u2.south east)
+ node[midway, below=10pt] {$H_C(p)$};
+
+ % Brace 2
+ \coordinate [below=2.8cm of sum2] (u3) {};
+ \coordinate [below=3cm of y] (u4) {};
+ \draw[decorate, decoration={brace, mirror, amplitude=8pt}]
+ (u3.south west) -- (u4.south east)
+ node[midway, below=10pt] {$H(p)$};
+ \end{tikzpicture}}
+ \caption{Schèma-bloc décrivant le système bille sur rail en entier}
+ \label{fig:bille}
+ \end{figure}
+
+ Nous aimerions que l'entrée du système soit une position souhaité pour la bille, entre -50cm et +50cm. Commençons donc par trouver un $K_b$ pour transformer la position en tension.
+\end{frame}
+
+
+\subsection{Transformation position - tension}
+\begin{frame}
+ \frametitle{Transformation position - tension}
+ Nous avons calculé la fonction de transfert à partir des equations mecaniques :
+
+ \begin{equation*}
+ \sum F_x = m \ddot{x} = mg \sin(\theta(t))
+ \end{equation*}
+
+ Or, $\theta\approx0$. Nous pouvons donc simplifier avec :
+
+ \begin{equation*}
+ \sin(\theta)\approx\theta
+ \end{equation*}
+
+ Ce qui nous donne :
+
+ \begin{equation*}
+ m\ddot{x}(t) = mg\theta(t)
+ \end{equation*}
+
+ Puis en passant par la transformée de Laplace, nous obtenons :
+
+ \begin{equation*}
+ p^2 X(p)=g\Theta(p)\Leftrightarrow\frac{X(p)}{\Theta(p)}=\frac{g}{p^2} \Rightarrow \boxed{\frac{V_x(p)}{V_\theta(p)}=K_b \frac{g}{p^2}}
+ \end{equation*}
+\end{frame}
+
+
+\begin{frame}
+ Pour calculer le \textit{$K_b$} nous avons fait une regression linéaire.
+
+ \begin{figure}
+ \centering
+ \includegraphics[scale=0.4]{./Illustrations/Regression_pos_volt.png}
+ \caption{Relation entre la position de la bille et la tension de sortie du système pour faire une régression linéaire}
+ \label{fig:regression}
+ \end{figure}
+
+ Ceci nous à donné, dans Microslop Excel, $\boxed{K_b = 1.926}$.
+\end{frame}
+
+
+\subsection{Analyse des frequences importantes au système}
+\begin{frame}
+ \frametitle{Analyse des frequences importantes au système}
+ Pour cette deuxième boucle du système, nous commençons par tracer le diagramme de Bode du système bille sur rail.
+
+ \begin{figure}
+ \centering
+ \includegraphics[scale=0.4]{./Illustrations/bodeRail1.png}
+ \caption{Diagramme de Bode système rail sans bille}
+ \label{fig:bode_rail}
+ \end{figure}
+ \vspace{-1em}
+ Le correcteur choisit est un correcteur avance de phase.
+\end{frame}
+
+
+\begin{frame}
+ Le point critique où il faut ajouter de la marge de phase est quand la magnitude est à 0dB, c.à.d. à 1,4 rad/s. Donc on concoit le correcteur avance de phase pour cela. Le correcteur d'avance de phase a une fonction de transfert sur la forme canonique\footnote{\href{https://homepages.laas.fr/fgouaisb/donnees/M1ICM/slidesM1ICMp8.pdf}{https://homepages.laas.fr/fgouaisb/donnees/M1ICM/slidesM1ICMp8.pdf}} :
+
+ \begin{equation*}
+ T_c(p) = K_p \frac{1 + \alpha T p}{1 + T p} \ , \ avec \ \alpha \ > \ 1
+ \end{equation*}
+\end{frame}
+
+
+\subsection{Calcul des paramètres du correcteur avance de phase}
+\begin{frame}
+ \frametitle{Calcul des paramètres du correcteur avance de phase}
+ Commençons par calculer la marge de phase désirée :
+ \begin{equation*}
+ \Theta_{Marge}=\Theta_{Desir\acute{e}e} - \Theta_{Systeme} = 125^\circ \Rightarrow \Theta_{Desir\acute{e}e} = 55^\circ
+ \end{equation*}
+
+ Puis, calculons $\alpha$ :
+
+ \begin{equation*}
+ \alpha = \frac {1 + \sin(\Theta)}{1 - \sin(\Theta)} = \frac {1 + \sin(55^\circ)}{1 - \sin(55^\circ)} \approx 10
+ \end{equation*}
+
+ Enfin, calculons T :
+
+ \begin{equation*}
+ T = \frac{1}{\omega_m*\sqrt{\alpha}} \Rightarrow T = \frac{1}{1.4*\sqrt 10} \approx 0,22
+ \end{equation*}
+\end{frame}
+
+
+\begin{frame}
+ Ceci nous donne un correcteur avance de phase :
+
+ \begin{equation*}
+ \boxed{T_c(p) = \frac{1+2,2p}{1+0,22p}}
+ \end{equation*}
+
+ \begin{figure}
+ \centering
+ \includegraphics[scale=0.5]{./Illustrations/bodeCorrecteur.png}
+ \caption{Diagramme de Bode du correcteur avance de phase}
+ \label{fig:bode_avance_phase}
+ \end{figure}
+\end{frame}
+
+
+\section{Vérification}
+\subsection{Vérfication expérimentale}
+\begin{frame}
+ \frametitle{Vérfication expérimentale}
+ \vfill
+ \centering
+ \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
+ \usebeamerfont{title}\Huge\textbf{\textrightarrow\ Démonstration \textleftarrow}
+ \end{beamercolorbox}
+ \vfill
+\end{frame}
+
+
+\subsection{Vérfication de la marge de phase}
+\begin{frame}
+ \frametitle{Vérfication de la marge de phase}
+ En utilisant la fonction de allmargin nous trouvons la marge de phase pour le système entier en boucle fermé.
+ \begin{figure}
+ \centering
+ \includegraphics[scale = 0.5]{./Illustrations/allmarginBode.png}
+ \caption{Diagramme de Bode du système entier}
+ \label{fig:bode_allmargin}
+ \end{figure}
+\end{frame}
+
+
+\section{Conclusion}
+\begin{frame}
+ \frametitle{Conclusion}
+ \begin{center}
+ \large \textbf {La boucle est bouclée et la bille est commandée.} \\
+
+ \vspace{2em}
+ ORVIK Oskar, JOHNSEN Brage \& TABAN Aleksander
+ \end{center}
+\end{frame}
+
+
+
+
+\end{document}
diff --git a/rapport/Figures/BLE_Error.png b/rapport/Figures/BLE_Error.png
new file mode 100644
index 0000000..4cc0b53
Binary files /dev/null and b/rapport/Figures/BLE_Error.png differ
diff --git a/rapport/Figures/CompatibiliteL4F4.pdf b/rapport/Figures/CompatibiliteL4F4.pdf
new file mode 100644
index 0000000..e163842
Binary files /dev/null and b/rapport/Figures/CompatibiliteL4F4.pdf differ
diff --git a/rapport/Figures/ESP8266.png b/rapport/Figures/ESP8266.png
new file mode 100644
index 0000000..0638973
Binary files /dev/null and b/rapport/Figures/ESP8266.png differ
diff --git a/rapport/Figures/F0.jpeg b/rapport/Figures/F0.jpeg
new file mode 100644
index 0000000..3ce4e6e
Binary files /dev/null and b/rapport/Figures/F0.jpeg differ
diff --git a/rapport/Figures/HC-05_Bluetooth_Module.jpg b/rapport/Figures/HC-05_Bluetooth_Module.jpg
new file mode 100644
index 0000000..aff51e5
Binary files /dev/null and b/rapport/Figures/HC-05_Bluetooth_Module.jpg differ
diff --git a/rapport/Figures/Motor_currents.pdf b/rapport/Figures/Motor_currents.pdf
new file mode 100644
index 0000000..59c0046
Binary files /dev/null and b/rapport/Figures/Motor_currents.pdf differ
diff --git a/rapport/Figures/Motor_currents.png b/rapport/Figures/Motor_currents.png
new file mode 100644
index 0000000..c988e6f
Binary files /dev/null and b/rapport/Figures/Motor_currents.png differ
diff --git a/rapport/Figures/PC_STOCK.jpg b/rapport/Figures/PC_STOCK.jpg
new file mode 100644
index 0000000..b2ce65e
Binary files /dev/null and b/rapport/Figures/PC_STOCK.jpg differ
diff --git a/rapport/Figures/STM32_Discovery.jpg b/rapport/Figures/STM32_Discovery.jpg
new file mode 100644
index 0000000..f3d4bfa
Binary files /dev/null and b/rapport/Figures/STM32_Discovery.jpg differ
diff --git a/rapport/Figures/Schema_Autom_PIR.pdf b/rapport/Figures/Schema_Autom_PIR.pdf
new file mode 100644
index 0000000..d497818
Binary files /dev/null and b/rapport/Figures/Schema_Autom_PIR.pdf differ
diff --git a/rapport/Figures/Schema_Autom_PIR.pdf:Zone.Identifier b/rapport/Figures/Schema_Autom_PIR.pdf:Zone.Identifier
new file mode 100644
index 0000000..d6c1ec6
Binary files /dev/null and b/rapport/Figures/Schema_Autom_PIR.pdf:Zone.Identifier differ
diff --git a/rapport/Figures/error_fig.png b/rapport/Figures/error_fig.png
new file mode 100644
index 0000000..933afd1
Binary files /dev/null and b/rapport/Figures/error_fig.png differ
diff --git a/rapport/Figures/sys_dyn_matlab.png b/rapport/Figures/sys_dyn_matlab.png
new file mode 100644
index 0000000..9ebfcf0
Binary files /dev/null and b/rapport/Figures/sys_dyn_matlab.png differ
diff --git a/rapport/IA.tex b/rapport/IA.tex
new file mode 100644
index 0000000..f0abb7b
--- /dev/null
+++ b/rapport/IA.tex
@@ -0,0 +1,14 @@
+\section*{Statement on AI Usage}
+The authors acknowledge the use of generative AI tools during this project, both for the development work and for writing this paper.
+
+AI was used as a helper in several parts of the project. This includes support for understanding and structuring technical ideas, and giving suggestions during the development of different subsystems. It was also used to help with writing, rephrasing, and improving clarity in the report.
+
+However, all final decisions, implementations, and validations were done by the authors. The AI outputs were always checked, corrected when needed, and adapted based on reliable technical sources and our own experiments and understanding of the system.
+
+We consider AI as a useful tool to speed up thinking and writing, but not as a source of final technical truth. Everything related to design choices, analysis, and results was verified and fully controlled by the authors.
+
+The use of AI tools in this work follows the IEEE guidelines for generative AI usage in publications.
+
+
+
+
diff --git a/rapport/PIR_MadMax3.bib b/rapport/PIR_MadMax3.bib
new file mode 100644
index 0000000..f5ad28d
--- /dev/null
+++ b/rapport/PIR_MadMax3.bib
@@ -0,0 +1,323 @@
+
+@inproceedings{patil_analysis_2025,
+ location = {{BELGAUM}, India},
+ title = {Analysis of {FOC} \& Trapezoidal Method of {PMSM} Motor for Variable Speed Application},
+ rights = {https://doi.org/10.15223/policy-029},
+ isbn = {979-8-3315-1873-8 979-8-3315-3103-4},
+ url = {https://ieeexplore.ieee.org/document/11140901/},
+ doi = {10.1109/INCET64471.2025.11140901},
+ abstract = {This study compares Field-Oriented Control ({FOC}) and trapezoidal control techniques for Permanent Magnet Synchronous Motors ({PMSMs}) in modern industrial variable-speed applications. Traditionally, variable-speed applications have relied on {DC} machines, which have inherent drawbacks such as increased maintenance, spark losses, higher inertia, and overall higher costs. This {FOC} has emerged as a sophisticated method that enables independent control of torque and magnetization flux in {AC} motors, allowing for precise regulation of torque and speed tailored to the motor's electromagnetic state. {FOC} leverages Sinusoidal Pulse-Width Modulation ({SPWM}) and Space Vector Pulse Width Modulation ({SVPWM}) techniques to enhance {DC} voltage utilization and minimize switching and harmonic losses. In contrast, the paper presents a detailed model of a {PMSM} drive system based on electronic components rather than standard mathematical blocks, leading to more realistic simulation results. All simulation modules, including the inverter and {PWM} generator, were custom-built, allowing for performance comparison under varying speed and torque conditions. Brushless {DC} ({BLDC}) motors, which are typically categorized as {PMSMs} with trapezoidal back-{EMF} waveforms, have gained traction due to their simplicity and cost-effectiveness. The trapezoidal control technique, also known as six-step commutation, simplifies the control process by aligning motor phase switching with the rotor position, resulting in a quasi-square-wave current. However, this method introduces torque ripple and presents control challenges, particularly in low-speed applications. Given the rising economic constraints and stringent governmental standards, there is an increasing demand for efficient, lowinterference, and adaptable electrical systems. This study demonstrates that {FOC} provides a more robust and efficient solution for high-performance applications than the trapezoidal control technique in {PMSMs}.},
+ eventtitle = {2025 6th International Conference for Emerging Technology ({INCET})},
+ pages = {1--9},
+ booktitle = {2025 6th International Conference for Emerging Technology ({INCET})},
+ publisher = {{IEEE}},
+ author = {Patil, Harshal and Argade, Sachin and Mulla, Aabid and Bharambe, Suraj and Barve, Hrishikesh and Suryawanshi, Rohit},
+ urldate = {2025-12-27},
+ date = {2025-05-23},
+ langid = {english},
+ file = {PDF:C\:\\Users\\nolan\\Zotero\\storage\\GIW7I2E7\\Patil et al. - 2025 - Analysis of FOC & Trapezoidal Method of PMSM Motor for Variable Speed Application.pdf:application/pdf},
+}
+
+@inproceedings{lee_advanced_2001,
+ location = {Cambridge, {MA}, {USA}},
+ title = {Advanced {BLDC} motor drive for low cost and high performance propulsion system in electric and hybrid vehicles},
+ isbn = {978-0-7803-7091-3},
+ url = {http://ieeexplore.ieee.org/document/939307/},
+ doi = {10.1109/IEMDC.2001.939307},
+ abstract = {In this paper, we propose an advanced brushless dc motor ({BLDCM}) drive for low cost and high performance electric propulsion system in electricvehicles ({EV}’s) and hybrid electric vehicles ({HEV}’s). It includes reduced parts power converter topologies and an optimal {PWM} control strategy to produce the desired dynamic and static speed and torque characteristics. The theoretical explanation and operational principle are described in detail. And, the performance of the proposed low cost {BLDCM} drive is, compared with the conventional counterpart by informative simulation results.},
+ eventtitle = {International Electric Machines and Drives Conference - {IEMDC} 2001},
+ pages = {246--251},
+ booktitle = {{IEMDC} 2001. {IEEE} International Electric Machines and Drives Conference (Cat. No.01EX485)},
+ publisher = {{IEEE}},
+ author = {Lee, B.K. and Ehsani, M.},
+ urldate = {2025-12-27},
+ date = {2001},
+ langid = {english},
+ file = {PDF:C\:\\Users\\nolan\\Zotero\\storage\\M2ZRVZXS\\Lee et Ehsani - 2001 - Advanced BLDC motor drive for low cost and high performance propulsion system in electric and hybrid.pdf:application/pdf},
+}
+
+@inproceedings{mohammd_taher_new_2021,
+ location = {Tabriz, Iran},
+ title = {A New {MPC}-based Approach for Torque Ripple Reduction in {BLDC} Motor Drive},
+ isbn = {978-1-6654-0366-5},
+ url = {https://ieeexplore.ieee.org/document/9405871/},
+ doi = {10.1109/PEDSTC52094.2021.9405871},
+ abstract = {In this paper, a new model predictive control ({MPC}) is proposed for brushless {DC} motor ({BLDCM}) to reduce the commutation torque ripple ({CTR}). The torque ripples generate vibration noise and reduce the efficiency. With purpose of minimizing the {CTR} of the {BLDCM} and considering the {CTR} sources, the proposed {MPC} scheme is designed by predicting the phase current and electromagnetic torque. The error square of predicted values of non-commutating current and electromagnetic torque, which are minimized in the cost function, determines the optimal switching states. The proposed {MPC} control is applied at commutation moments which is detected by analysis of Hall sensor signal. This control scheme is implemented on the traditional topology of the {BLDCM} driving system which facilitates the implementation. Considering a 210V-2000W {BLDCM}, the comparative analysis using the {MATLAB}/Simulink environment is carried out in terms of the {CTR} reduction, tracking of the reference current under low-speed, high-speed and load torque tracking. The key parameters’ responses of {BLDCM} illustrate the improvement of the {CTR}, fast-transient response and small steady-state errors by using the proposed {MPC} against the conventional {PI}-{PWM}.},
+ eventtitle = {2021 12th Power Electronics, Drive Systems, and Technologies Conference ({PEDSTC})},
+ pages = {1--6},
+ booktitle = {2021 12th Power Electronics, Drive Systems, and Technologies Conference ({PEDSTC})},
+ publisher = {{IEEE}},
+ author = {Mohammd Taher, Seyed and Halvaei Niasar, Abolfazl and Abbas Taher, Seyed},
+ urldate = {2025-12-27},
+ date = {2021-02-02},
+ langid = {english},
+ file = {PDF:C\:\\Users\\nolan\\Zotero\\storage\\9RNPM3Z5\\Mohammd Taher et al. - 2021 - A New MPC-based Approach for Torque Ripple Reduction in BLDC Motor Drive.pdf:application/pdf},
+}
+
+@inproceedings{jomsa-nga_torque_2024,
+ title = {Torque Ripple Mitigation Using Field Oriented Control for {BLDC} in Small Electric Vehicles},
+ url = {https://ieeexplore.ieee.org/document/11004292/},
+ doi = {10.1109/ISC260477.2024.11004292},
+ abstract = {This study introduces a motor control strategy suitable for small electric vehicles, aimed at supporting the Smart City framework. The Field Oriented Control ({FOC}) method is utilized to control Brushless {DC} Motors ({BLDC}) which are chosen for their numerous advantages such as highpower density, superior starting torque, lightweight design, and cost-effectiveness when compared to Permanent Magnet Synchronous Motors ({PMSM}). These characteristics make {BLDC} motors highly suitable for electric motorcycles and other small electric vehicles. However, {BLDC} motors have the drawback of high torque ripple which results in reduced ride comfort and increased mechanical stress. To address this issue, the study employs the {FOC} method which effectively reduces torque ripple, noise, and vibration compared to the traditional Six Step control method. The efficacy of the proposed method has been validated through simulation results obtained using {PSIM} software, as well as through experimental outcomes.},
+ eventtitle = {2024 {IEEE} International Smart Cities Conference ({ISC}2)},
+ pages = {1--6},
+ booktitle = {2024 {IEEE} International Smart Cities Conference ({ISC}2)},
+ author = {Jomsa-Nga, Jirapong and Teesakul, Pinmanus and Tanjaroen, Wason and Supatti, Uthane},
+ urldate = {2025-12-17},
+ date = {2024-10},
+ note = {{ISSN}: 2687-8860},
+ keywords = {{BLDC}, Brushless {DC} motors, Brushless {DC} Motors, Electric Motorcycle, Electric vehicles, Electric Vehicles, {FOC}, Motorcycles, Noise, Simulation, Small Electric Vehicles, Smart cities, Smart city, Testing, Torque, Torque measurement, Torque Ripple, Vibrations},
+ file = {Full Text PDF:C\:\\Users\\nolan\\Zotero\\storage\\6S3FC5Z7\\Jomsa-Nga et al. - 2024 - Torque Ripple Mitigation Using Field Oriented Control for BLDC in Small Electric Vehicles.pdf:application/pdf},
+}
+
+@inproceedings{li_quantitative_2019,
+ title = {Quantitative Characteristic Comparison between Sensorless Six Step and Field Oriented Control Methods for Permanent Magnet Brushless {DC} Motors},
+ url = {https://ieeexplore.ieee.org/document/8912478/},
+ doi = {10.1109/ECCE.2019.8912478},
+ abstract = {Permanent magnet ({PM}) brushless {DC} motors ({BLDCM}) have the advantages of high power density, high efficiency, simple structure and high reliability. {BLDCM} can be categorized into either trapezoidal back-electromotive ({EMF}) motor type, or sinusoidal back-{EMF} motor. There are typically two {BLDCM} control methods: One is six step control method which is easy to realize with simple hardware, the other is field oriented control ({FOC}) method which has better control performance. This paper compares quantitatively the characterization between these two {BLDC} control methods, with respect to torque ripple and power losses. Theoretical analysis and simulation studies are presented to illustrate their advantages and disadvantages. Experimental verification is conducted using a 48V, 4-pole, 4500RPM {BLDC} motor.},
+ eventtitle = {2019 {IEEE} Energy Conversion Congress and Exposition ({ECCE})},
+ pages = {1881--1885},
+ booktitle = {2019 {IEEE} Energy Conversion Congress and Exposition ({ECCE})},
+ author = {Li, Feilang and Yao, Wenxi and Lee, Kevin},
+ urldate = {2025-12-17},
+ date = {2019-09},
+ note = {{ISSN}: 2329-3748},
+ keywords = {Torque, Torque measurement, field oriented control, Mathematical model, {MOSFET}, Permanent magnet brushless {DC} motor, power loss, six step control, Stator windings, Switches, torque ripple},
+ file = {Full Text PDF:C\:\\Users\\nolan\\Zotero\\storage\\32AFSS22\\Li et al. - 2019 - Quantitative Characteristic Comparison between Sensorless Six Step and Field Oriented Control Method.pdf:application/pdf},
+}
+
+@inproceedings{bhatiya_bldc_2024,
+ title = {{BLDC} Motor Trapezoidal Regulation Using Hall Effect Sensor},
+ url = {https://ieeexplore.ieee.org/document/10829278/},
+ doi = {10.1109/ICISAA62385.2024.10829278},
+ abstract = {{BLDC} motors provide excellent performance, durability, and efficiency, making them ideal for a variety of applications. The motor was operated by means of the six-step commutation process of the trapezoidal control approach, which was applied to the exact rotor position data obtained via Hall effect sensors. This approach perfectly times the commutation sequence, reducing torque ripple and improving motor performance. The design, modeling, and experimental findings validated the effectiveness of the proposed control technique, suggesting that it can be used to maximize {BLDC} motor performance in commercial and industrial applications.},
+ eventtitle = {2024 International Conference on Intelligent Systems and Advanced Applications ({ICISAA})},
+ pages = {1--6},
+ booktitle = {2024 International Conference on Intelligent Systems and Advanced Applications ({ICISAA})},
+ author = {Bhatiya, Hansa and Patil, Dushyant and Makune, Shriram and Kadam, Swaraj and Mahajan, Vishal and Vaidya, Harshal},
+ urldate = {2025-12-17},
+ date = {2024-10},
+ keywords = {Torque measurement, {BLDC} motor, Commutation, Hall effect, Hall effect sensors, Motor control strategy, Process control, Regulation, Reliability, Rotors, Sensors, Stability analysis, Trapezoidal control, Velocity control},
+ file = {Full Text PDF:C\:\\Users\\nolan\\Zotero\\storage\\J9NQ9CM8\\Bhatiya et al. - 2024 - BLDC Motor Trapezoidal Regulation Using Hall Effect Sensor.pdf:application/pdf},
+}
+
+@inproceedings{m_speed_2025,
+ title = {Speed Control of Six Step Commutation Trapezoidal by Fuzzy Logic Control of {BLDC} Motor for E-Vehicle},
+ url = {https://ieeexplore.ieee.org/document/11113877},
+ doi = {10.1109/ICOECA66273.2025.00076},
+ abstract = {This paper demand for efficient and sustainable transportation solutions has driven the widespread adoption of Electric Vehicles ({EVs}). Brushless {DC} motors emerging as a popular choice for their high effectiveness, reliability, and low maintenance. This project focuses on the speed control of {BLDC} motors in {EVs} using trapezoidal control fuzzy logic techniques. Trapezoidal control, a common approach for {BLDC} motor commutation, is explored for its advantages in smooth speed control and reduced harmonic distortion. A speed control fuzzy logic algorithm is developed to adjust the motor speed vigorously created on the vehicle's operational requirements, ensuring efficient energy. The system uses the six-step commutation approach to produce the required signals that regulate the inverter that powers of {BLDC} motor while monitoring the motor's speed, current, and rotor position in real-time. The efficiency of the suggested speed control strategy is confirmed by the presentation of simulation results, focusing on achieving rapid acceleration, maintaining a steady cruising speed, and improving torque efficiency.},
+ eventtitle = {2025 5th International Conference on Expert Clouds and Applications ({ICOECA})},
+ pages = {407--412},
+ booktitle = {2025 5th International Conference on Expert Clouds and Applications ({ICOECA})},
+ author = {M, Kirubaharan and S, Haribaskar and Gopalakrishnan, R. and E, Chandrakumar and R, Satheeshkumar},
+ urldate = {2025-12-17},
+ date = {2025-03},
+ keywords = {Simulation, Torque, Commutation, Rotors, Velocity control, {BLDC} Motor, Fuzzy logic, Monitoring, Real-time systems, six-step commutation, Speed control of {EV}, System performance, Transportation, trapezoidal control fuzzy logic techniques},
+ file = {PDF:C\:\\Users\\nolan\\Zotero\\storage\\JV793P7X\\M et al. - 2025 - Speed Control of Six Step Commutation Trapezoidal by Fuzzy Logic Control of BLDC Motor for E-Vehicle.pdf:application/pdf},
+}
+
+@inproceedings{farid_performance_2007,
+ title = {Performance analysis of field-oriented control and direct torque control for sensorless induction motor drives},
+ url = {https://ieeexplore.ieee.org/document/4433783},
+ doi = {10.1109/MED.2007.4433783},
+ abstract = {This paper presents a contribution for detailed comparison between two sensorless control techniques for high performance induction motor drives: Field-oriented control ({FOC}) and direct torque control ({DTC}). The main characteristics of field-oriented control and direct torque control schemes are studied by simulation emphasizing their advantages and disadvantages. The performances of the two control schemes are evaluated in terms of torque and current ripples, and transient responses to load toque variation. We can nevertheless say that the two control schemes provide in their basic configuration, comparable performances regarding the torque control and parameter sensitivity. We can note a slight advance of {DTC} scheme compared to {FOC} scheme regarding the dynamic flux control performance and the implementation complexity. The choice of one or the other scheme will depend mainly on specific requirements of the application.},
+ eventtitle = {2007 Mediterranean Conference on Control \& Automation},
+ pages = {1--6},
+ booktitle = {2007 Mediterranean Conference on Control \& Automation},
+ author = {Farid, Naceri and Sebti, Belkacem and Mebarka, Kercha and Tayeb, Benmokrane},
+ urldate = {2025-12-17},
+ date = {2007-06},
+ keywords = {Induction motor drives, Induction motors, Open loop systems, Performance analysis, Performance evaluation, Pulse width modulation, Sensorless control, Stators, Torque control, Voltage},
+ file = {Full Text PDF:C\:\\Users\\nolan\\Zotero\\storage\\QS3AXW4G\\Farid et al. - 2007 - Performance analysis of field-oriented control and direct torque control for sensorless induction mo.pdf:application/pdf},
+}
+
+@collection{tan_advances_2013,
+ location = {Berlin, Heidelberg},
+ title = {Advances in Swarm Intelligence: 4th International Conference, {ICSI} 2013, Harbin, China, June 12-15, 2013, Proceedings, Part {II}},
+ volume = {7929},
+ rights = {https://www.springernature.com/gp/researchers/text-and-data-mining},
+ isbn = {978-3-642-38714-2 978-3-642-38715-9},
+ url = {https://link.springer.com/10.1007/978-3-642-38715-9},
+ series = {Lecture Notes in Computer Science},
+ shorttitle = {Advances in Swarm Intelligence},
+ abstract = {The Design and Implementation of Motor Drive
+for an Electric Bicycle},
+ publisher = {Springer Berlin Heidelberg},
+ editor = {Tan, Ying and Shi, Yuhui and Mo, Hongwei},
+ editorb = {Hutchison, David and Kanade, Takeo and Kittler, Josef and Kleinberg, Jon M. and Mattern, Friedemann and Mitchell, John C. and Naor, Moni and Nierstrasz, Oscar and Pandu Rangan, C. and Steffen, Bernhard and Sudan, Madhu and Terzopoulos, Demetri and Tygar, Doug and Vardi, Moshe Y. and Weikum, Gerhard},
+ editorbtype = {redactor},
+ urldate = {2025-12-17},
+ date = {2013},
+ langid = {english},
+ doi = {10.1007/978-3-642-38715-9},
+ file = {PDF:C\:\\Users\\nolan\\Zotero\\storage\\BVFW45SK\\Tan et al. - 2013 - Advances in Swarm Intelligence 4th International Conference, ICSI 2013, Harbin, China, June 12-15,.pdf:application/pdf},
+}
+
+@inproceedings{samitha_ransara_modelling_2013,
+ title = {Modelling and analysis of a low cost Brushless {DC} motor drive},
+ url = {https://ieeexplore.ieee.org/document/6505698/},
+ doi = {10.1109/ICIT.2013.6505698},
+ abstract = {This paper presents a buck converter based modelling technique for Brushless {DC} ({BLDC}) motor drives. The proposed technique is a better alternative to model {BLDC} motor drives due to its reduced computational complexity in contrast to the conventional phase-variable model. Using the model, constant speed operation of a {BLDC} motor drive operated without a {DC} link capacitor is analysed. Theoretical behaviour of the motor drive, predicted from the model, is compared with Matlab/Simulink based simulations to demonstrate the validity of the model. Mathematical expressions are derived from the model to evaluate the steady state performance of the {BLDC} motor drive, which is presented, in comparison to a similar sized conventional {BLDC} motor drive. The proposed model and mathematical expressions are expected to be useful at the design stage of the low cost motor drive to achieve comparable performance.},
+ eventtitle = {2013 {IEEE} International Conference on Industrial Technology ({ICIT})},
+ pages = {356--361},
+ booktitle = {2013 {IEEE} International Conference on Industrial Technology ({ICIT})},
+ author = {Samitha Ransara, H. K. and Madawala, Udaya K.},
+ urldate = {2026-01-01},
+ date = {2013-02},
+ keywords = {Brushless {DC} motors, Torque, Mathematical model, Analytical models, Capacitors, Motor drives},
+ file = {Full Text PDF:C\:\\Users\\nolan\\Zotero\\storage\\F7UAHCL6\\Samitha Ransara et Madawala - 2013 - Modelling and analysis of a low cost Brushless DC motor drive.pdf:application/pdf},
+}
+
+@thesis{gasc_conception_2004,
+ title = {Conception d'un actionneur à aimants permanents à faibles ondulations de couple pour assistance de direction automobile},
+ url = {https://hal.science/tel-04297384},
+ abstract = {This study relates to the design of permanent magnet actuator for automotive electric steering assistance and has been supported by the {CNRS} and {RENAULT}.
+The analysis of the specification schedule for automotive electric power steering reveals the need of a very low motor torque ripple. The minimisation of the torque ripple is treated according two ways : a first action consists in optimising the motor design and a second one in compensating the torque ripple by a control law.
+Concerning the design, a study of the mechanical system links the torque sensor stiffness, integrated into the steering column, to the motor inertia brought back to the steering wheel. The low inertia and the high ambient temperature constitute strong constraints of design for a given size. Increasing the shaft stiffness reduces the constraints of design. Analytical electromagnetic and thermal models have been coupled and exploited according to a methodology defined by the specificity of the problem. Finite Element Analysis {FLUX}2D™ is used so as to validate the analytical design and to study torque ripple techniques. A solution based on a structure with a fractional slot number and an original winding is proposed. The realisation and the tests of a prototype have validated some aspects of the design.
+In order to minimise the torque ripple by control laws, simulation models under Simulink were developed. They integrate the torque ripple which has been determined by Finite Element Analysis. Several observer structures taking into account the torque ripple are presented and compared. An original structure based on a Kalman’s filter coupled to a load torque observer based on Luenberger’s theory is updated. This structure enables to manage the control without position encoder while strongly reducing the torque ripple. A state feedback structure and a {RST} controller combined with load torque compensation were implemented on an experimental set-up designed and instrumented with the aim of reproducing the system of electric power-assisted steering.},
+ institution = {Institut National Polytechnique (Toulouse)},
+ type = {Theses},
+ author = {Gasc, Laurent},
+ urldate = {2026-01-02},
+ date = {2004-11},
+ note = {Issue: 2004INPT043H},
+ keywords = {Active compensation, Automobile power steering, Compensation active, Contrôle en position, Direction assistée automobile, Finite Element Analysis, {FLUX}2D, Model, Modélisation, Moteur à aimants permanents, Observateur de couple, Ondulations de couple, Permanent magnet motors, Position control, Ripple torque, Torque observer},
+ file = {HAL PDF Full Text:C\:\\Users\\nolan\\Zotero\\storage\\QQCS4KN4\\Gasc - 2004 - Conception d'un actionneur à aimants permanents à faibles ondulations de couple pour assistance de d.pdf:application/pdf},
+}
+
+@inproceedings{akiki_reduction_2016,
+ location = {Grenoble, France},
+ title = {Réduction des ondulations de couple d'un moteur à aimants en multi-V et bobinage sur dents},
+ url = {https://hal.science/hal-01361708},
+ abstract = {Cet article présente une étude sur la réduction des ondulations de couple d'un moteur électrique à 12 dents et 10 pôles avec des aimants intérieurs en multi-V et bobinage concentré sur dents. Ce type de machine est utilisé pour des applications qui exigent un fort couple à basse vitesse. Cependant, la combinaison 12/10 développe des ondulations de couple élevées. L'objectif de cette étude est de présenter une méthodologie de réduction des ondulations de couple en se basant sur le vrillage du rotor et l'asymétrie des pôles. Dans cet article, l'étude de chacune des techniques est d'abord présentée puis une méthode de combinaison de ces deux techniques est proposée afin de réduire certains harmoniques du couple.},
+ booktitle = {2nd Symposium de Génie Électrique ({SGE} 2016)},
+ author = {Akiki, Paul and Hage-Hassan, Maya and Vannier, Jean-Claude and Dessante, Philippe and Dagusé, Benjamin and Bensetti, Mohamed},
+ urldate = {2026-01-02},
+ date = {2016-06},
+ keywords = {Aimants multi-V, modélisation, ondulations de couple, plan d'expérience, pôles asymétriques, vrillage},
+ file = {HAL PDF Full Text:C\:\\Users\\nolan\\Zotero\\storage\\AFPWJ2YA\\Akiki et al. - 2016 - Réduction des ondulations de couple d'un moteur à aimants en multi-V et bobinage sur dents.pdf:application/pdf},
+}
+
+@book{gieras_modern_2023,
+ location = {Boca Raton},
+ edition = {First edition},
+ title = {Modern permanent magnet electric machines: theory and control},
+ isbn = {978-0-367-61058-6},
+ shorttitle = {Modern permanent magnet electric machines},
+ abstract = {Fundamentals of magnetism -- Soft magnetic materials -- Permanent magnets -- Calculation of magnetic circuits with {PMs} -- Pm brush {DC} machines and control -- Pm brushless {DC} motors and drives control -- Pm synchronous motors and drives control -- Axial and transverse flux. Motors -- High-speed {PM} brushless machines},
+ publisher = {{CRC} Press},
+ author = {Gieras, Jacek F. and Shen, Jian-Xin},
+ date = {2023},
+ doi = {10.1201/9781003103073},
+}
+
+@misc{b1,
+ author = {Benjamin Vedder},
+ title = {VESC BLDC Motor Control Firmware},
+ year = {2024},
+ howpublished = {\url{https://github.com/vedderb/bldc/}}
+}
+
+@misc{b2,
+ author = {Benjamin Vedder},
+ title = {lispBM in VESC},
+ year = {2024},
+ howpublished = {\url{https://github.com/vedderb/bldc/tree/master/lispBM}}
+}
+
+@misc{shamansystems_cheap-focer-2firmware_nodate,
+ title = {Cheap-FOCer-2/firmware at master · shamansystems/Cheap-FOCer-2},
+ url = {https://github.com/shamansystems/Cheap-FOCer-2/tree/master/firmware},
+ abstract = {Low-Cost Motor Controller based on the VESC 6. Contribute to shamansystems/Cheap-FOCer-2 development by creating an account on GitHub.},
+ language = {en},
+ urldate = {2026-05-14},
+ journal = {GitHub},
+ author = {{shamansystems}},
+ file = {Snapshot:/home/wario-crocs/Zotero/storage/WFJTZ3V9/firmware.html:text/html},
+}
+
+@misc{noauthor_darkflippersunleashed-firmware_2026,
+ title = {{DarkFlippers}/unleashed-firmware},
+ copyright = {GPL-3.0},
+ url = {https://github.com/DarkFlippers/unleashed-firmware},
+ abstract = {Flipper Zero Unleashed Firmware},
+ urldate = {2026-05-14},
+ publisher = {Unleashed Firmware Team},
+ month = may,
+ year = {2026},
+ note = {original-date: 2022-03-16T12:46:45Z},
+ keywords = {alternative-firmware, cfw, custom, custom-firmware, darkflippers, firmware, flipper, flipper-plugins, flipper-zero, flipperzero, jailbreak, keeloq, rolling-codes, unleashed, unlocked, unofficial},
+}
+
+@misc{cirlig_huuckflipperzeronrfjammer_2026,
+ title = {huuck/{FlipperZeroNRFJammer}},
+ copyright = {MIT},
+ url = {https://github.com/huuck/FlipperZeroNRFJammer},
+ abstract = {Simple Flipper Zero nRF24 jammer for the 2.4Ghz spectrum},
+ urldate = {2026-05-14},
+ author = {Cirlig, Gabriel},
+ month = may,
+ year = {2026},
+ note = {original-date: 2024-12-03T21:35:41Z},
+}
+
+@misc{noauthor_cycle_nodate,
+ title = {Cycle {Analyst} {V3} - {Grin} {Products} - {Product} {Info}},
+ url = {https://ebikes.ca/product-info/grin-products/cycle-analyst-3.html},
+ abstract = {The Cycle Analyst display is our first flagship product released in 2006 and now in its 3rd generation. While the hardware design may be showing its age, it still has capabilities and functionalities that are unmatched by modern ebike systems with their pretty colour screens. This device also serves as an educational tool so that people understand the nitty gritty of how their ebike is performing, while adding all kinds of customizable control features to tweak your ride.},
+ language = {en},
+ urldate = {2026-05-14},
+}
+
+@misc{noauthor_charrette_nodate,
+ title = {La {Charrette} version montagne ou comment transporter 250kg à vélo par monts et par vaux !},
+ url = {https://veloma.org/2022/10/05/la-charrette-version-montagne-ou-comment-transporter-250kg-a-velo-par-monts-et-par-vaux/},
+ abstract = {Le boom de la cyclologistique voit fleurir de superbes vélocargos, triporteurs, remorques capablesde porter plusieurs centaines de kg qui pour livrer, déménager, transporter ses enfants, matériaux,outils… Tout ce beau matériel fait des miracles en ville et sur des pentes douces ou pas trop longues,mais en...},
+ language = {fr-FR},
+ urldate = {2026-05-14},
+ journal = {Veloma},
+}
+
+@misc{noauthor_outil_2023,
+ title = {Outil de simulation énergétique développé par l'{IFPEN} - {Extrême} {Défi} {ADEME} / {Véhicules} et {Technologie} {XD}},
+ url = {https://forum.fabmob.io/t/outil-de-simulation-energetique-developpe-par-lifpen/1258},
+ abstract = {Ce fil de discussion pour échanger sur un outil de simulation énergétique. Cet outil permettra d’estimer la consommation énergétique sur un trajet donné via un carte à partir de 2 points et des données du véhicule. Il sera utilisé par les territoires, les utilisateurs, les aménageurs pour échanger sur les besoins, sur les offres. En complément, il existe aussi un outil de simulation plus technique : Trip Simulator -UPDATED- - Tools Un échange est prévu le 5/10 pour lancer l’outil : Atelier XD ...},
+ language = {fr},
+ urldate = {2026-05-14},
+ journal = {FabMob},
+ month = sep,
+ year = {2023},
+ note = {Section: Extrême Défi ADEME},
+}
+
+@misc{noauthor_tv1860-3r0107-r_nodate,
+ title = {{TV1860}-{3R0107}-{R} {\textbar} {Supercondensateur} {Eaton}, 100 μ{F} {TV} -10 to 30 \% 0.{011Ω}, {3V} c.c., {Traversant} {\textbar} {RS}},
+ url = {https://fr.rs-online.com/web/p/supercondensateurs/1351097},
+ urldate = {2026-05-14},
+}
+
+@misc{noauthor_green_nodate,
+ title = {Green {Cell}® {GC} {PowerMove} {Batterie} {Vélo} {Electrique} {48V} 14.{5Ah} {Li}-{Ion}},
+ url = {https://batteryempire.fr/batteries-pour-velo-electrique/4916-green-cell-batterie-velo-electrique-48v-145ah-696wh-down-tube-ebike-ec5-pour-samebike-ancheer-avec-chargeur.html},
+ abstract = {Green Cell® GC PowerMove Batterie Vélo Electrique 48V 14.5Ah Li-Ion Down Tube E-Bike avec Chargeur 24 mois de garantie, expédition immédiate, livraison gratuite},
+ language = {fr},
+ urldate = {2026-05-14},
+}
+
+@misc{noauthor_ddf-39_nodate,
+ title = {{DDF}-39 {1000W}},
+ url = {http://www.mxusebikekit.com/pro_info.asp?Pid=25},
+ urldate = {2026-05-14},
+}
+
+@misc{noauthor_PowerGaN_nodate,
+ title = {STPOWER GaN Transistors},
+ url = {https://www.st.com/en/power-transistors/powergan.html},
+ urldate = {2026-05-14},
+}
+
+@misc{noauthor_GaN-manufacturer_nodate,
+ title = {9 Gallium Nitride Manufacturers in 2026},
+ url = {https://us.metoree.com/categories/7137/,
+ urldate = {2026-05-14},
+}
diff --git a/rapport/PIR_MadMax3.bib:Zone.Identifier b/rapport/PIR_MadMax3.bib:Zone.Identifier
new file mode 100644
index 0000000..d6c1ec6
Binary files /dev/null and b/rapport/PIR_MadMax3.bib:Zone.Identifier differ
diff --git a/rapport/aim.tex b/rapport/aim.tex
new file mode 100644
index 0000000..3732a33
--- /dev/null
+++ b/rapport/aim.tex
@@ -0,0 +1,14 @@
+\section{Aim and Research Objectives}
+This work presents the design and implementation of a motor control system for electric bicycles and cargo transport applications developed within the context of the Manufacture Autonome Décentralisée (MAD) initiative at INSA Toulouse. The main objective is to develop a modular, open-source, and locally manufacturable control architecture adapted to low-cost electric mobility systems.
+
+To achieve this, the project is structured into four main technical contributions.
+
+First, a low-cost motor controller is designed based on a six-step (trapezoidal) commutation strategy. The objective is to eliminate the need for a microcontroller by relying exclusively on discrete MOSFETs and standard electronic components, thereby improving repairability, accessibility, and ease of local manufacturing.
+
+Second, a high-performance controller based on Field-Oriented Control (FOC) is developed using an STM32 microcontroller platform. This implementation leverages and adapts the open-source VESC firmware to ensure compatibility with the selected hardware while enabling advanced motor control capabilities.
+
+Third, the security of the wireless communication interface is investigated, with a focus on Bluetooth Low Energy (BLE) vulnerabilities. A Flipper Zero device is used as a diagnostic tool to evaluate potential attack surfaces and identify weaknesses in the communication layer.
+
+Finally, a dynamic model of the bicycle-cargo system is developed to improve rider experience. The objective is to minimize the perceived additional effort when towing a cargo cart. This is achieved through a PID-based (Proportional-Integral-Derivative) control strategy combined with distance sensing, allowing adaptive assistance based on system dynamics.
+
+
diff --git a/rapport/conclusion.tex b/rapport/conclusion.tex
new file mode 100644
index 0000000..8c954cd
--- /dev/null
+++ b/rapport/conclusion.tex
@@ -0,0 +1,17 @@
+\section{Conclusion/Summary}
+
+%\begin{figure}[htbp]
+%%\centerline{\includegraphics{fig1.png}}
+%caption{Example of a figure caption.}
+%\label{fig}
+%\end{figure}
+
+%Figure Labels: Use 8 point Times New Roman for Figure labels. Use words
+%rather than symbols or abbreviations when writing Figure axis labels to
+%avoid confusing the reader. As an example, write the quantity
+%``Magnetization'', or ``Magnetization, M'', not just ``M''. If including
+%units in the label, present them within parentheses. Do not label axes only
+%with units. In the example, write ``Magnetization (A/m)'' or ``Magnetization
+%\{A[m(1)]\}'', not just ``A/m''. Do not label axes with a ratio of
+%quantities and units. For example, write ``Temperature (K)'', not
+%``Temperature/K''.
diff --git a/rapport/discussion.tex b/rapport/discussion.tex
new file mode 100644
index 0000000..02d83a5
--- /dev/null
+++ b/rapport/discussion.tex
@@ -0,0 +1,17 @@
+\section{Discussion}
+This project could be seen as an introduction to the VESC project for someone who don't know about it from beforehand, the challenges the new users face during setup, as well as a demand for clear expectations concerning documentation on the subject. The project the MAD is leading should probably not be a fork of the project, as the project is still in development.
+
+As a final note, this proved to be a project which could easily be developed into several different projects in different fields. Some projects could be continued later on as a different PIR subject, other could be proposed to later years in different specialisations like TLS-SEC, ESPE. Our thoughts on the following projects that could be
+
+The fabrication line for electronics is globalised. This is okay in a stable world, but it could be a problem in a world full of instability, be it war, blockages, or tariffs. The idea of opening a specialisation in cooperation with AIME came up as an idea.
+
+For TLS-SEC the subject could be the design for a fitting mechanism to restrict certain privileges to certified personnel that could be used in the C programming language. Later down the line we could also see the possibility to analyse the Bluetooth frames in order to manipulate them in order to change important parameters.
+
+The continuation on the PCB could be a subject fitting an ESPE specialisation.
+
+The proposition of and supply of a VESC system to play with and troubleshoot could be a good rule of thumb, which allows for a quicker start and gives among other things an idea of the budget and the supply line used by a entity in the sector. Proposing a visit could also be one way to familiarise students with the association.
+
+What should be a clear conclusion from our test with the jammer is that a controller based on Bluetooth alone should be avoided when possible and practical. Examples where this could be relevant include electric skateboards, as cables could impose a tripping hazard. There, an encapsulation of an encrypted control frame could be an thought.
+
+
+
diff --git a/rapport/foc.tex b/rapport/foc.tex
new file mode 100644
index 0000000..67227be
--- /dev/null
+++ b/rapport/foc.tex
@@ -0,0 +1,116 @@
+\section{STM32-Based Field-Oriented Control Motor Drive}
+\label{sec:foc}
+
+This section presents the design and implementation of a high-performance motor controller based on Field-Oriented Control (FOC).
+
+\subsection{Choice of FOC Over Trapezoidal Commutation}
+
+Table~\ref{tab:foc_vs_trap} summarizes the key differences between the two commutation strategies, based on the literature reviewed in Section~\ref{sec:relatedwork}.
+
+\begin{table}[htbp]
+\caption{Comparison between FOC and trapezoidal (six-step) commutation}
+\label{tab:foc_vs_trap}
+\centering
+\begin{tabular}{lcc}
+\toprule
+\textbf{Criterion} & \textbf{FOC} & \textbf{Six-Step} \\
+\midrule
+Torque ripple (at 500 rpm) & \SI{18.4}{\percent} & \SI{35.7}{\percent} \\
+Low-load efficiency & High & Moderate \\
+High-speed switching loss & Higher & Lower \\
+Position sensor requirement & Encoder (high resolution) & Hall sensors \\
+Implementation complexity & High & Low \\
+Hardware cost & Higher & Lower \\
+Dynamic response & Fast & Standard \\
+\bottomrule
+\end{tabular}
+\end{table}
+
+For our cargo bike application, rider comfort and smooth torque delivery are priorities. FOC was therefore selected for the high-performance controller, while a separate low-tech six-step board (Section~\ref{sec:sixstep}) was developed for repairability.
+
+\subsection{Base Design: Cheap FOCer-2 Project}
+
+The starting point was the open-source \textit{Cheap FOCer-2} project, which provides a complete KiCad design for a VESC-compatible board based on an STM32F405 microcontroller. This design includes:
+\begin{itemize}
+ \item A three-phase MOSFET full-bridge power stage.
+ \item Gate drivers with built-in dead-time insertion.
+ \item Shunt resistors for phase current sensing.
+ \item USB and CAN interfaces.
+ \item An expansion header for encoder or Hall sensors.
+\end{itemize}
+
+The existing KiCad schematic and layout were used as the baseline for our adaptations.
+
+\subsection{Integration of the Rocacher FOC Tile}
+
+Mr. Rocacher provided the Kicad schematic of a ready-to-use FOC tile based on an STM32L476 microcontroller.
+
+The initial idea was to make this tile \textit{pluggable} into our carrier board, similar to an Arduino shield. This would allow :
+\begin{itemize}
+ \item Easy replacement of the computing core without re-soldering.
+ \item Modular upgrades of the microcontroller.
+ \item Simplified repair and maintenance.
+\end{itemize}
+
+However, the Cheap FOCer-2 project was not designed for such modularity. Its routing is dense and highly optimized for a single, non-removable F405 chip. Adapting it to accept an L476 tile while preserving all critical functions (PWM, current sensing, USB communication) proved challenging.
+
+\subsection{Pin Compatibility Verification: L476 vs F405}
+Before starting the PCB modifications, a pin compatibility study was carried out between the STM32L476 used on the Rocacher tile and the STM32F405 originally used in the Cheap FOCer-2 design. The objective was to verify that the main functions required by the VESC firmware could still be used after replacing the original microcontroller.
+
+The verification mainly focused on:
+\begin{itemize}
+ \item Physical pinout compatibility in the LQFP64 package,
+ \item PWM timer for Alternate functions,
+ \item USB DP/DM pins (PA11/PA12),
+ \item Analog inputs for current sensing,
+ \item UART communication for BLE integration.
+\end{itemize}
+
+During this analysis, three main pin conflicts were identified.
+
+\begin{figure}[!h]
+
+ \centering
+ \includegraphics[width=\linewidth]{Figures/CompatibiliteL4F4.pdf}
+ \caption{Comparison of F405 and L476 pin configurations}
+
+\end{figure}
+
+The first conflict concerned the SPI\_MISO signal on pin PA6. In the original STM32F405 design, this pin is used for SPI communication related to current sensing. On the STM32L476 tile, the same pin is associated with a DAC output, creating a functional conflict. To solve this issue, the SPI communication line was remapped to PA5 on the L476, which offers a compatible alternate function.
+
+The second issue concerned the EN\_GATE signal. In the original design, this signal was connected to PB5 on the STM32F405. However, this pin is not accessible on the L476 tile. The signal was therefore moved to PC5, configured as a standard GPIO output.
+
+Finally, Hall sensor C was originally connected to PC8 (TIM8) on the STM32F405. Since this pin is not available on the tile connector, the Hall sensor input was reassigned to PB3 using the TIM2\_CH2 alternate function, which preserves the input capture capability required for Hall sensor decoding.
+
+All other important functions remained compatible between the two microcontrollers, including PWM generation, complementary PWM outputs, encoder inputs, UART, USB, and CAN communication. Some differences between the ADC peripherals of the STM32F405 and STM32L476 still remain and will require firmware adaptations in future work.
+
+\subsection{Schematic Design and KiCad Implementation}
+
+The original Cheap FOCer-2 schematic was modified in KiCad in order to replace the integrated STM32F405 microcontroller with connectors for the Rocacher STM32L476 tile. The objective was to make the control part more modular and easier to replace without modifying the power stage of the board.
+
+The main modifications performed on the schematic were:
+\begin{itemize}
+ \item Removal of the STM32F405 and its associated passive components.
+ \item Addition of two 20-pin headers for the L476 tile connection.
+ \item Re-routing of PWM, ADC, USB, and communication signals toward the headers.
+\end{itemize}
+
+Special attention was given to the routing of critical control signals, especially the PWM outputs used for motor commutation and the analogue signals used for current sensing.
+
+After the modifications, the schematic was verified using the KiCad Electrical Rule Check (ERC). No electrical errors were detected during this verification step, which validated the consistency of the schematic before starting the PCB routing phase.
+
+\subsection{Routing Challenges and Current Status}
+
+After validating the schematic, the PCB routing phase was started in KiCad. The original Cheap FOCer-2 board uses a very compact layout with dense routing around the STM32F405 microcontroller and the power stage. Integrating connectors for a removable STM32L476 tile introduced several additional routing constraints.
+
+One of the main difficulties was maintaining proper signal routing while keeping enough space for the tile connectors and preserving the integrity of the control signals. Particular attention had to be given to the PWM signals, current sensing traces, and power connections.
+
+Several issues were encountered during the routing process:
+\begin{itemize}
+ \item Some connector footprints associated with the tile did not appear correctly after importing the schematic into the PCB layout.
+ \item The routing of high-current paths, especially the battery and motor phase connections, become more complex due to the additional connectors and required extra vias.
+ \item Some Decoupling capacitors had to be repositioned, which could potentially affect switching noise and power
+ supply stability.
+\end{itemize}
+
+At the current stage of the project, the schematic has been validated and the PCB layout is still under development. Once the routing is completed, the board will be manufactured and tested using the VESC firmware adapted for the STM32L476 tile.
diff --git a/rapport/futur.tex b/rapport/futur.tex
new file mode 100644
index 0000000..52ea80e
--- /dev/null
+++ b/rapport/futur.tex
@@ -0,0 +1,14 @@
+
+\section{Perspectives and Future Work}
+Based on the results obtained and the limitations identified during this project, several directions for future work are proposed.
+
+\subsection{Hardware Completion and Testing}
+The VESC-based FOC PCB requires routing completion and prototype manufacturing. Once fabricated, the board must be tested under real operating conditions (varying loads, road profiles, and battery voltage).
+
+\subsection{Control Strategy Enhancement}
+Future work includes the implementation and comparison of the PI controller and the cascaded control structure on the cargo cart, in order to evaluate their performance under different conditions (load variations, road profiles, etc.).
+
+In addition, the lack of direct velocity measurements limited the ability to fully characterise the system dynamics. Adding a speed measurement or improving state estimation would allow a more complete analysis of the model.
+
+
+
diff --git a/rapport/gap.tex b/rapport/gap.tex
new file mode 100644
index 0000000..12db3a3
--- /dev/null
+++ b/rapport/gap.tex
@@ -0,0 +1,11 @@
+\section{Research Gap}
+The literature presented in the previous sections shows that significant work has been carried out on BLDC motor control strategies, especially for torque ripple reduction, efficiency improvement, and dynamic performance optimisation. Open-source projects such as VESC also provide high-performance and flexible solutions for electric mobility systems.
+
+However, most existing works mainly focus on control performance and do not consider low-tech constraints such as local manufacturing, hardware repairability, or component accessibility. In many existing controllers, the hardware design remains difficult to reproduce or repair without specialized equipment or advanced electronic knowledge.
+
+In addition, the integration of wireless communication introduces new security concerns. While BLE connectivity simplifies configuration and monitoring, unauthorized access to controller parameters could create safety risks, especially for electric cargo bikes operating in public spaces.
+
+To the best of our knowledge, there is currently no open-source motor controller that simultaneously addresses high-performance control, local manufacturability, repairability, and BLE security for decentralized cargo bike applications.
+
+This project therefore aims to explore a modular and repair-oriented motor controller architecture compatible with VESC while remaining adapted to the constraints of the Manufacture Autonome Décentralisée (MAD).
+
diff --git a/rapport/intro.tex b/rapport/intro.tex
new file mode 100644
index 0000000..5b4504a
--- /dev/null
+++ b/rapport/intro.tex
@@ -0,0 +1,10 @@
+\section{Introduction}
+The fast urbanization of global logistics has positioned electric cargo bikes as a primary solution. At the heart of these vehicles is the motor controller. Current research and industry standards primarily focus on two methods of commutation for the controller: Trapezoidal commutation and Field Oriented Control (FOC).
+
+As motor controllers become smarter, they increasingly incorporate wireless connectivity for tuning and diagnostics. Current research highlights that while Bluetooth Low Energy (BLE) and mobile app integration improve user experience, they often introduce vulnerabilities. Open-source projects, in particular, must balance ease of access for community developers with the need to secure the vehicle.
+
+We also argue the need for general public's safety when it comes to these bikes, as it could be a danger to the traffic. This is especially true when it comes to vehicles carrying a substantial load. This needs to be considered by the MAD, where their responsibility and control begins and ends. Should there be a difference between the firmware loaded on a product from the MAD than what is publicly available?
+
+
+
+
diff --git a/rapport/logiciel.tex b/rapport/logiciel.tex
new file mode 100644
index 0000000..b64ed6b
--- /dev/null
+++ b/rapport/logiciel.tex
@@ -0,0 +1,141 @@
+\section{Software and Connectivity}
+
+\subsection{BLE Compatibility With the VESC}
+
+\subsubsection{First Experiment}
+VESC-controllers are not necessarily equipped with Bluetooth-modules by default. Often, it is necessary to add a BLE-module. A standard HC-05 bluetooth-module compatible with Arduino is a great way to send and receive bluetooth-packets from a host, e.g. a mobile phone, via a bridge translating the bluetooth packets to the UART protocol. This could be demonstrated using a ESP8622's standard library with said module, by letting us send characters from one device to another.
+
+\subsubsection{HC-05 and the VESC}
+By flashing the VESC firmware on a discovery-card and connecting the HC-05 module to the PB10 and PB11-pins, which are the Rx and Tx-pins for the STM32F4xx chip, we discovered that the setup for the bluetooth module was not available in the VESC tool. The inherent BLE capabilities is an important limitation to consider when designing a VESC system. We learned therefore that the HC-05 is not originally adapted for BLE. The need for a bridge also adds on complexity and cost, in the form of extra components and another device to maintain the code of. For the future, choosing a bluetooth module supporting BLE will be the easiest solution. Preferably a module fitting the communication connector on the cheap FOCer project \cite{shamansystems_cheap-focer-2firmware_nodate} could facilitate the relevancy of the PCB project with a microcontroller.
+
+\subsubsection{BLE Vulnerability}
+Bluetooth could be a vulnerability to a VESC if it is to be used as a controller in real-time, as the controller could be jammed. Our test with the Flipper Zero shows the disfunctionnality of Bluetooth with different use cases. We experienced with the jamming of a bluetooth speaker that the music completely stopped. It could also be investigated how the connection to the VESC could be modified using the VESC tool. We will touch more on the accessibility of the code within the VESC tool sooner.
+
+\subsection{Setup of BT-connection with VESC}
+The setup consisted of a main PC/controller, HC-05 Bluetooth module, ESP8266 µ-controller, STM32 Discovery µ-controller, PC with VESC-tool as well as a \textit{FlipperZero}. Our plan of action consisted of flashing the Discovery-card with code for then to read this code via UART to the ESP8266 which was connected to the BT-module. The BT-module would then send packets to the PC. This PC would then act as read/write to read the code having been flashed on the Discovery. Full-band jamming would then be achieved by the implementation of the \textit{FlipperZero} disrupting any transfer of code from PC1 to PC2.The \textit{FlipperZero} was equipped with the firmware \textit{DarkFlippers/unleashed-firmware}\cite{noauthor_darkflippersunleashed-firmware_2026} with the addition of an NRF-jammer from \textit{huuck/FlipperZeroNRFJammer} \cite{cirlig_huuckflipperzeronrfjammer_2026}.
+
+\newpage
+
+\begin{figure}[!h]
+ \centering
+
+\begin{tikzpicture}
+
+% PC_ESP
+\node[
+ draw,
+ rectangle,
+ minimum width=1.5cm,
+ minimum height=1.5cm
+] (PC1) at (2.5,-0.5)
+{
+ \includegraphics[width=1.5cm]{Figures/PC_STOCK.jpg}
+};
+\node[above=2mm of PC1] {PC1 ready to r/w};
+
+
+% HC05
+\node[
+ draw,
+ rectangle,
+ minimum width=1.5cm,
+ minimum height=1.5cm
+] (HC05) at (-0.3,-2.6)
+{
+ \includegraphics[width=1.5cm]{Figures/HC-05_Bluetooth_Module.jpg}
+};
+\node[above=1mm of HC05] {HC-05};
+
+\node[
+ draw,
+ rectangle,
+ minimum width=1.5cm,
+ minimum height=1.5cm
+] (ESP) at (-0.3,-5)
+{
+ \includegraphics[width=1.5cm]{Figures/ESP8266.png}
+};
+\node[below=1mm of ESP] {ESP8266};
+
+\node[
+ draw,
+ rectangle,
+ minimum width=1.5cm,
+ minimum height=1.5cm
+] (PC2) at (-3.6,-2.6)
+{
+ \includegraphics[width=1.5cm]{Figures/PC_STOCK.jpg}
+};
+\node[above=1mm of PC2] {PC2 with VESC-tool};
+
+\node[
+ draw,
+ rectangle,
+ minimum width=1.5cm,
+ minimum height=1.5cm
+] (Disc) at (-3.6,-5)
+{
+ \includegraphics[width=1.5cm]{Figures/STM32_Discovery.jpg}
+};
+\node[below=1mm of Disc] {STM32 Discovery};
+
+\node[
+ draw,
+ rectangle,
+ minimum width=1.5cm,
+ minimum height=1.5cm
+] (F0) at (-1.5,0)
+{
+ \includegraphics[width=1.5cm]{Figures/F0.jpeg}
+};
+\node[above=1mm of F0] {FlipperZero};
+
+% Arrow between boxes
+%\draw[decorate, decoration={snake}] (box1) -- (box2);
+\draw[->, thick] (HC05) -- (ESP);
+\draw[<->, decorate, decoration={snake}] (PC1) -- node[below right]{BT-connectivity} (HC05);
+\draw[->] (HC05) -- node[left]{UART} (ESP);
+\draw[<->] (HC05) -- node[right]{Tx $\leftrightarrow$ Rx} (ESP);
+
+\draw[<->] (ESP) -- node[below]{UART} (Disc);
+\draw[<->] (ESP) -- node[above]{Tx $\leftrightarrow$ Rx} (Disc);
+
+\draw[<->] (Disc) -- node[left]{USB} (PC2);
+
+\draw[->, decorate, decoration={snake}] (F0) -- node[above=3mm]{Jamming} (1.25,-1.5);
+\
+
+\end{tikzpicture}
+ \caption{Setup of BT-connection wih VESC.}
+ \label{fig:BT}
+
+\end{figure}
+
+
+
+\subsection{Code integrity}
+\subsubsection{Context}
+As the project is open source, and the code is freely accessible, there should be no reason to hide the code. It could however be reasonable to protect the code from changes which could hurt other people. Changing following parameters should at least come with a disclaimer and clearly state the dangers possible by proceeding with said changes. We have in mind the maximum speed permitted and the power available to the motors.
+
+\subsubsection{LispBM extraction}
+We caught word that the lisp code for the VESC used by Maillon mobility was easy to extract. By building an older firmware with the Maillon mobility software, we observed this by going to the lispBM tab and clicking read. It's up to the MAD if they would like to reinforce this mechanism. A modification on a parameter and then clicking upload allowed us to easily change the speed limit. This could bring up a public danger. This raises questions on the use of the MAD's equipment, as it's used in a day-to-day traffic environment.
+
+\subsubsection{LispBM Code}
+When we flashed newer firmware from the project made by Benjamin Vedder\cite{b1}, we also observed some difficulties in uploading the lispBM script taken from the one on firmware version 6.06. This could indicate that there needs to be further maintenance of the code in order to get the software up to date. This needs to be documented better for someone to continue the project. This could be a good investment for the MAD.
+
+This documentation could be as simple as referencing the relevant parts of the lispBM documentation. \cite{b2}
+
+\subsubsection{Proposed Solution}
+This risk could be patched by developing a VESC application for the VESC controller or using a binary. This is a solution which is less open source, but defends well against malicious intent.The application could be created using C and use an algorithm known by the MAD in order to secure the access to someone to change the parameters only if they are MAD certified personnel. This encryption would preferably be reduced to the most essential settings in order to align with what our impression of the philosophy of the MAD would be.
+
+
+\subsection{VESC Compiling}
+As mentioned, we have been able to compile the VESC tool and the VESC firmware. This firmware has been put onto an STM32F4xx Discovery card. This card uses the same chip as the aforementioned ``Cheap FOCer'' project. The thought was that using something with the same chip would facilitate the switch from the discovery card to a PCB with the same target.
+
+However, this choice posed several obstacles for our progress on the topic of cybersecurity. We will nonetheless summarise what we have learned and propose some additional work for the future. The challenges we encountered were the following: The lack of bluetooth capabilities. We did not have a module with BLE either. We had access to a HC-05 module, but that only allows for a normal Bluetooth version 2.0 protocol and would require further work on a bridge to UART by using an esp8622 that we had as well. We propose that the next group has access to a VESC controller from the beginning, as well as a motor we could control. This could be in cooperation with the MAD, as the MAD could propose some models they're interested in.
+
+We also found that the information on the VESC is scattered around the internet. The resources is also sometimes based on a Debian-based Linux system which adds more work for someone using another distribution of Linux. This could hinder the implementation facility for new users. We struggled particularly with the Qt packages for positioning and game pad. We would therefore recommend the use of a Debian-based Linux system for the computer working with the VESC for the MAD associates.
+
+
+
+
diff --git a/rapport/lowtech.tex b/rapport/lowtech.tex
new file mode 100644
index 0000000..d094c55
--- /dev/null
+++ b/rapport/lowtech.tex
@@ -0,0 +1,99 @@
+\section{Hardware-Based Six-Step Commutation Controller}
+\label{sec:sixstep}
+
+The basis of this section is the replacement of components who are highly complex, technical and/or are dependant on global supply chains to manufacture. An additional goal is, as for the preceding section, to make a repairable, reliable and manufacturable circuit, this time using these more basic components, based on open-source principles. The controller needs to be performant enough to drive one of the two electric motors used on the LaMAD (La Manufacture Autonome Décentralisée) bicycle cargo trailer.\cite{noauthor_ddf-39_nodate}
+
+\subsection{Constraints}
+The electric motors used are supplied using 36/48 Volts at 1000 W. This means that the six-step chopper transistors need to be able to supply up to 28 Amperes of current. This is a lot, considering our restrictions. Additionally, the heat will need to be managed, which may be an even bigger challenge than the current.
+
+\subsection{Semiconductor facilities in Occitanie}
+The most challenging part of this section is the replacement of semiconductor parts, as these are the most complicated parts to manufacture. Luckily, the city in which the team is located, Toulouse, offers possibilities in semiconductor manufacturing. This may not be a complete list, but the following were identified:
+
+\begin{enumerate}
+ \item ST Microelectronics Labège-Innopôle (formerly Exagan, formerly CEA-Leti)
+ \item LAAS-CNRS (Laboratoire d'Analyse et d'Architecture des Systèmes - Centre National des Recherches Scientifiques) semiconductor lab
+ \item AIME (Atelier Interuniversitaire de Micro-nano Électronique) on-campus at INSA Toulouse
+\end{enumerate}
+
+ST Microelectronics at Labège designs and manufactures gallium nitride transistors under the commercial designation STPOWER PowerGaN, this confirmed by a colleague who visited the plant and engineering teams in late 2022, Etienne Gadefait. Gallium nitride transistors are great for high speed power electronics \cite{noauthor_PowerGaN_nodate} but this is a very recent technology, and none of the big material players in GaN are European, let alone French or Occitanian (US, China, Japan and India are predominant)\cite{noauthor_GaN-manufacturer_nodate}. Because of this and very high costs, we chose to consider this a supply chain-constrained technology, which could not be relied on in a non-global future, and we moved on to other options.
+
+The LAAS semiconductor lab was deemed less reachable and more technologically advanced than the AIME semiconductor lab, as we were told they mostly did research on carbon nanotubes and other fancy semiconductor materials. We therefore chose not to contact the LAAS, and rather prioritise contacting the AIME lab.
+
+The AIME is a small research lab located on our campus. Their capabilities and projects were not publicly available, so we decided to contact them. We met two researchers Mr. Tan and Mr. Lincelles to enquire about the manufacturability of certain components, and eventual costs. The AIME specialises in logic circuits, and has not developed any power components at least a decade. Therefore, the research teams have not maintained any know-how in power semiconductors. However, they were very interested in developing this field in their lab, and came with a proposal to start, based on their existing knowledge. Here are some of AIME's capabilities and prices:
+
+\begin{table}[htbp]
+ \caption{AIME capabilities}
+ \label{tab:AIME_capabilities}
+ \centering
+ \begin{tabular}{lcc}
+ \toprule
+ \textbf{Proposal or capability} & \textbf{Value} & \textbf{Price, if relevant} \\
+ \midrule
+ Silicon wafer & 2'' ($\sim$50mm) & 10 € \\
+ Epitaxial "fancy" wafer & 2'' ($\sim$50mm) & 100-200 € \\
+ AIME-made lithography mask & 10µm canal width & 300 € \\
+ Lab rental & 1 day & $\sim$2000 € \\
+ Transistor canal width & $\sim$1 µm \\
+ Drain-source on resistance & 1 k\textOmega \\
+ \bottomrule
+ \end{tabular}
+\end{table}
+
+The proposed project was based on their logic transistors, scaled up not in size, but in number. As seen in the table above, one of their small logic transistors has a resistance of:
+
+\begin{equation}
+ R_{DS_{on}} \approx 1\ k\Omega
+\end{equation}
+
+As we need a transistor capable of passing 28 Amperes of current, this resistance is unacceptable. Therefore, they proposed to put a great number of transistors in parallel to reduce $R_{DS_{on}}$, on a big surface to better distribute and dissipate the heat (the heat calculations were not made). We can also note here that AIME does not have packaging technology to dissipate high head loads, which could be resolved using external specialist companies (expensive) or making a very thermally efficient transistor. The current also makes the attachment of wires more complicated, as the general relation (not taking into consideration the skin effect in larger diameters) they gave me gives:
+
+\begin{equation}
+ 1\ \frac{mA}{\mu m\ diameter} \Rightarrow diameter = 2,8 cm
+\end{equation}
+
+Which is extremely unrealistic for a small component and needs to be investigated further. The second problem is the voltage, as the small signal transistors they have are made for lower voltages. Therefore, we needed a thicker MOSFET with a thicker n- drift layer between the drain and source to prevent breakdown, which results in us needing a fancy and expensive epitaxial wafer instead of a cheap one. This results in another problem, an even higher Drain-source on resistance $R_{DS_{on}}$, multiplying the already great number of transistors by a good factor. At the end, this is the project they proposed:
+
+\begin{table}[htbp]
+\caption{The project proposed by the AIME}
+\label{tab:AIME_project}
+\centering
+\begin{tabular}{lcc}
+\toprule
+\textbf{Proposal or capability} & \textbf{Value} & \textbf{Price, if relevant} \\
+\midrule
+Transistor count & $\sim$400 000 & \\
+Die size & 1-2 cm$^2$ & \\
+Wafer & 2'' ($\sim$50mm) epitaxial & 100-200 € \\
+Dies per wafer & 1 & 100-200 € per die \\
+Lab rental & subsidised & \\
+Masks needed & 4 & 1200 € \\
+Dies per set of masks & $>$ 1000 dies & \\
+\bottomrule
+\end{tabular}
+\end{table}
+
+These costs are much larger than what we have for this project, but are not insurmountable for a department like the GEI. If we run the calculations of static costs (no lab time), this project would cost 1300-1400 € for 1 transistor, 300-400 € per transistor for 6 transistors and 101-201 € per transistor for 1000 of them (the mask costs being absorbed by the sheer number of produced transistors). This project also needs a lot of time or more people to be completed, more than what we have at our disposal. The researchers were very interested in collaborating on such a project in the future, and considered it very strongly as a replacement for the current AIME project for the 5th year PTP Energie students at INSA Toulouse (currently a CO2 sensor), with GEI's backing and funding.
+
+The complexity and price of manufacturing power transistors made us go for the strategy of choosing readily available and cheap components.
+
+
+\subsection{Replacing an IC}
+Replacing the IC of a motor controller requires using traditional logic gates. This approach can be done in several methods. The AIME would easily be able to produce such a circuit at a relatively low cost, but this is neither easily accessible nor repairable. We therefore needed to use another form of logic gates. The simplest form of gates are diode gates, which use two diodes to make either an AND or OR-gate. They cannot make NOT-gates, which need a CMOS-cell (two transistors). We continued by simulating this in LTSpice XVII, based on Mr. Rocacher's circuits. This circuit ended up needing 4 AND-gates, 2 OR-gates and 1 NOT-gate ("CMOS cell" using two N-Channel MOSFETs and possibly a MOSFET driver) per phase, with additional transistors to compensate for voltage lost at the diodes, as well as one additional OR-gate. The total would be like this:
+
+\begin{table}[H][htbp]
+ \caption{Minimum number of diodes and transistors needed}
+ \label{tab:decompte}
+ \centering
+ \begin{tabular}{lccc}
+ \toprule
+ \textbf{Gate} & Number of gates & \textbf{Number of diodes} & \textbf{Number of transistors} \\
+ \midrule
+ AND & 12 & 24 & 0 \\
+ OR & 7 & 14 & 0 \\
+ NOT & 3 & 0 & 6\\
+ \bottomrule
+ Total & & 38 & 6
+ \end{tabular}
+\end{table}
+
+This is a considerable number of diodes and transistors, but would make the circuit easily repairable and replaceable.
diff --git a/rapport/main.pdf b/rapport/main.pdf
new file mode 100644
index 0000000..1f72be2
Binary files /dev/null and b/rapport/main.pdf differ
diff --git a/rapport/main.tex b/rapport/main.tex
new file mode 100644
index 0000000..0b35362
--- /dev/null
+++ b/rapport/main.tex
@@ -0,0 +1,133 @@
+\documentclass[conference]{IEEEtran}
+\IEEEoverridecommandlockouts
+% The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out.
+\usepackage[UKenglish]{babel}
+\usepackage{float}
+\usepackage{cite}
+\usepackage{amsmath,amssymb,amsfonts}
+\usepackage{algorithmic}
+\usepackage{url}
+\usepackage[hidelinks]{hyperref}
+\usepackage{placeins}
+\usepackage{booktabs}
+\usepackage{siunitx}
+\usepackage{graphicx}
+\usepackage{textcomp}
+\usepackage{xcolor}
+\usepackage{tikz}
+\usepackage{graphicx}
+\usepackage{textgreek}
+\usetikzlibrary{decorations.pathmorphing}
+\usetikzlibrary{positioning}
+
+
+\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
+ T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
+\begin{document}
+
+\title{
+ Design and Implementation of a High-Power Motor Controller for Bicycles
+}
+
+
+\author{\IEEEauthorblockN{Hugo Abescat}
+\IEEEauthorblockA{\textit{GEI Department} \\
+\textit{INSA Toulouse}\\
+Toulouse, France \\
+abescat@insa-toulouse.fr}
+\and
+\IEEEauthorblockN{Karima Attar}
+\IEEEauthorblockA{\textit{GEI Department} \\
+\textit{INSA Toulouse}\\
+Toulouse, France \\
+karima.attar@insa-toulouse.fr}
+\and
+\IEEEauthorblockN{Brage Flønæs Johnsen}
+\IEEEauthorblockA{\textit{GEI Department} \\
+\textit{INSA Toulouse}\\
+Toulouse, France \\
+johnse@insa-toulouse.fr}
+\and
+\IEEEauthorblockN{Oskar Orvik}
+\IEEEauthorblockA{\textit{GEI Department} \\
+\textit{INSA Toulouse}\\
+Toulouse, France \\
+orvik@insa-toulouse.fr}
+\and
+\IEEEauthorblockN{Julien Pavillon}
+\IEEEauthorblockA{\textit{GEI Department} \\
+\textit{INSA Toulouse}\\
+Toulouse, France \\
+pavillon@insa-toulouse.fr}
+\and
+\IEEEauthorblockN{Nolan Reynier Nomer}
+\IEEEauthorblockA{\textit{GEI Department} \\
+\textit{INSA Toulouse}\\
+Toulouse, France \\
+reynier-nome@insa-toulouse.fr}
+\and
+\IEEEauthorblockN{Aleksander Taban}
+\IEEEauthorblockA{\textit{GEI Department} \\
+\textit{INSA Toulouse}\\
+Toulouse, France \\
+taban@insa-toulouse.fr}
+}
+
+\maketitle
+
+\begin{abstract}
+Electric bikes are becoming an increasingly attractive solution for transporting goods between short distances,
+especially in city-wide infrastructures. However, most commercially available controllers rely on complex integrated
+circuits making repair and local manufacturing difficult, particularly for organisations operating in
+resource-constrained or low-tech environments. The Manufacture Autonome Décentralisée (MAD) is developing products
+and solutions, particularly e-bikes, which are more repairable and sustainable. Previous studies have predominantly
+focused on performance optimisation of Field Oriented Control (FOC) and trapezoidal commutation strategies, with limited
+attention to repairability, component sourcing, and community-centred sustainability criteria. This project aims to
+design, assemble, and develop a functional, low-tech and open-source motor controller for electric cargo bikes. The
+current model uses an open-source motor control called VESC (Vedder Electronic Speed Controller) that allows precise
+control of electric motors. The controller needs to be compatible with a VESC controller and easily locally repairable
+by the MAD. By exploring the inner workings of the VESC project, modelling of the physical systems and the Printed
+Circuit Board (PCB) we investigated the ways we could do it in another way. We acquired a VESC controller to compare our
+system and a commercial product. Preliminary results demonstrate that the adapted VESC-based controller successfully
+drives the target motor under both commutation strategies, and that positional control is achievable with the current
+hardware configuration. Security vulnerabilities related to open Bluetooth access were identified. These findings
+suggest that open-source, locally fabricated motor controllers can meet the functional requirements of electric cargo
+bikes while significantly improving repairability.
+\end{abstract}
+
+\begin{IEEEkeywords}
+VESC, Brushless DC motor, Field Oriented Control, Trapezoidal commutation, Low-Tech, PID-Control.
+\end{IEEEkeywords}
+
+
+%% On découpe le projet pour faciliter le travail en commun
+% Début
+\input{intro.tex}
+\input{related.tex}
+\input{gap.tex}
+\input{aim.tex}
+
+% Nos parties
+\input{foc.tex}
+\input{lowtech.tex}
+\input{logiciel.tex}
+\input{modelisation.tex}
+
+% Fin
+\input{resultats.tex}
+\input{discussion.tex}
+\input{futur.tex}
+\input{conclusion.tex}
+\input{remerciements.tex}
+\input{IA.tex}
+
+%Please number citations consecutively within brackets \cite{b1}. The
+%sentence punctuation follows the bracket \cite{b2}. Refer simply to the reference
+%number, as in \cite{b3}---do not use ``Ref. \cite{b3}'' or ``reference \cite{b3}'' except at
+%the beginning of a sentence: ``Reference \cite{b3} was the first $\ldots$''
+
+\bibliographystyle{IEEEtran}
+\bibliography{PIR_MadMax3}
+
+
+\end{document}
diff --git a/rapport/main.tex:Zone.Identifier b/rapport/main.tex:Zone.Identifier
new file mode 100644
index 0000000..d6c1ec6
Binary files /dev/null and b/rapport/main.tex:Zone.Identifier differ
diff --git a/rapport/modelisation.tex b/rapport/modelisation.tex
new file mode 100644
index 0000000..e134f6b
--- /dev/null
+++ b/rapport/modelisation.tex
@@ -0,0 +1,104 @@
+\section{Dynamic Modelling and Control of the Bicycle-Cargo System}
+
+\subsection{Dynamic System Modelling}
+
+The studied system consists of a bicycle towing a cargo cart through a rigid mechanical linkage. This link is only used for steering guidance and does not contribute to the traction force. The main objective is to ensure that the rider perceives minimal additional effort, such that the overall behaviour remains similar to riding a standard bicycle.
+
+From a control perspective, the rider provides a reference motion in terms of speed and position, while the cargo cart is expected to follow this reference with minimal delay. The position error between the bicycle and the cargo cart is computed using a distance sensor, which provides feedback relative to an equilibrium state.
+
+The cargo cart is modelled as the plant of the system. Its rotational dynamics are described using the fundamental equation of rotational motion:
+
+\begin{equation*}
+\sum \tau = J_{\Delta} \times \dot{\omega}
+\end{equation*}
+where $\tau$ is the total torque applied to the system, $J_{\Delta}$ is the equivalent moment of inertia, and $\omega$ is the angular velocity.
+
+The total torque is composed of the motor torque $\tau_m$ and a friction torque modelled as:
+
+\begin{equation*}
+\tau_f = -f \times \omega
+\end{equation*}
+where $f$ is the viscous friction coefficient.
+
+The resulting dynamic equation becomes:
+
+\begin{equation*}
+J_{\Delta} \dot{\omega} = \tau_m - f \omega
+\end{equation*}
+
+In the Laplace domain, this leads to:
+\begin{equation*}
+\omega(s) = \frac{\tau_m(s)}{J_{\Delta} s + f}
+\end{equation*}
+
+Since the linear velocity is related to angular velocity by the wheel radius $R$, we obtain:
+
+\begin{equation*}
+v(s) = R \times \omega(s)
+\end{equation*}
+
+Thus, the transfer function between motor torque and linear velocity is:
+\begin{equation*}
+\frac{v(s)}{\tau_m(s)} = \frac{R}{J_{\Delta} s + f}
+\end{equation*}
+
+
+\subsection{PI-Based Control Strategy}
+\label{subsec:Simulink_model}
+Based on this model, a Simulink representation of the system was developed. The controlled system includes a feedback loop using a PI (Proportional-Integral) controller in order to regulate the position error between the bicycle and the cargo cart.
+
+Since the reference input is a ramp signal (representing the bicycle position over time), an integral action is required to ensure zero steady-state error and accurate tracking of the reference trajectory.
+
+The closed-loop Simulink model of the system is shown in Fig.~\ref{fig:simulink-closedloop}.
+
+The control error is defined as the difference between a desired relative position and the measured displacement between the bicycle and the cargo cart:
+\begin{equation*}
+ e(t) = e_{\text{ref}} - (x_{\text{bike}} - x_{\text{cart}})
+\end{equation*}
+where $e_{\text{ref}} = \SI{-0.5}{\meter}$ represents the desired equilibrium offset between both systems.
+
+\begin{figure}[!h]
+
+ \centering
+ \includegraphics[width=\linewidth]{./Figures/sys_dyn_matlab.png}
+ \caption{Closed-loop model of the bicycle-cargo system with PI control.}
+ \label{fig:simulink-closedloop}
+
+\end{figure}
+
+
+\subsection{Control Architecture Exploration}
+Beyond the standard PI control structure simulated in the previous sections, this project explores a more sophisticated control law: the Cascaded Loop Architecture. This approach is envisioned as a high-level software enhancement to meet the robustness and safety requirements inherent to electric cargo mobility. This means that our control law includes two feedback loops that use two different physical parameters.
+
+The selected cascaded structure is a well-established industry standard, particularly in high-performance motion control and robotics. Similar architectures are widely employed in Automated Guided Vehicles (AGVs) and platooning systems, where a “follower” unit must synchronize its dynamics with a “leader” unit through precise feedback loops.
+
+The proposed approach decomposes the complex task of “cart following” into manageable sub-tasks by nesting control loops:
+\begin{itemize}
+ \item Outer loop: Position control layer.
+ Using a linear encoder or distance sensor mounted on the trailer’s hitch, the system measures the relative displacement (error) between the bicycle and the cargo cart. This error is processed by a Proportional (P) Controller. The primary goal of this stage is to translate physical distance into a target velocity setpoint. By saturating the output of this loop, we can prevent the cargo cart from ever exceeding the bicycle’s speed, thereby ensuring it never “pushes” the cyclist.
+
+ \item Inner loop: Velocity control layer.
+ The velocity setpoint generated by the outer loop is fed into this internal layer, the inner loop is responsible for commanding the motor torque directly to compensate for immediate mechanical disturbances. Because this loop operates at a higher frequency, it can reject disturbances such as sudden changes in rolling resistance or friction, before they significantly impact the overall position error.
+\end{itemize}
+
+\begin{figure}[!h]
+
+ \centering
+ \includegraphics[width=\linewidth]{./Figures/Schema_Autom_PIR.pdf}
+ \caption{Cascaded control architecture for the bicycle-cargo system.}
+ \label{fig:cascaded-loop}
+
+\end{figure}
+
+Fig.~\ref{fig:cascaded-loop} illustrates the cascade architecture for the dynamics of the cargo cart. In this scheme, $x_{\text{ref}}$ denotes the desired position of the bicycle, whereas $x$ represents the measured position of the cargo cart.
+
+An outer Proportional Controller $K_{p,x}$ converts the position error $e_x = x_{\text{ref}} - x$ into a velocity reference $v_{\text{ref}}$, which serves as the set-point for the inner loop.
+The inner Proportional Controller $K_{p,v}$ then transforms the velocity error $e_v = v_{\text{ref}} - v$ into a torque reference $\tau_{\text{ref}}$.
+This command is processed by the motor/actuator block, which delivers the actual torque $\tau$.
+The model of the plant maps this torque to velocity $v$, and the integrator $1/s$ reconstructs the position $x$.
+
+The adoption of a cascaded loop architecture offers decisive advantages but comes with disadvantages. This precision introduces increased complexity: the multiplication of tuning parameters and the requirement for high-resolution feedback sensors, such as encoders, raise hardware costs and must come with high-performance software. These technical constraints represent a significant challenge and may raise other issues.
+
+
+
+
diff --git a/rapport/related.tex b/rapport/related.tex
new file mode 100644
index 0000000..e243bbd
--- /dev/null
+++ b/rapport/related.tex
@@ -0,0 +1,33 @@
+\section{Related Work}
+\label{sec:relatedwork}
+
+\subsection{Modeling of BLDC Motor}
+The electromechanical model of a BLDC (Brushless DC) motor is foundational for understanding its behaviour under different control schemes. BLDC motors are categorized by their back-electromotive force (back-EMF) waveform: trapezoidal or sinusoidal. This distinction is crucial, as the trapezoidal shape inherently leads to torque ripple when the supplied phase currents are not perfectly aligned, directly influencing the choice and effectiveness of the control strategy \cite{patil_analysis_2025}. For a BLDC motor with trapezoidal back-EMF, the electromagnetic torque is given by:
+\[
+T_e = \frac{e_a i_a + e_b i_b + e_c i_c}{\omega_m}
+\]
+where \( e_x \) is the back-EMF and \( i_x \) is the phase current \cite{li_quantitative_2019}. The classical d-q reference frame model, ideal for sinusoidal machines, is less suitable for trapezoidal BLDC motors because it assumes sinusoidal flux distribution. Phase-variable modelling in the natural (abc) frame is therefore more appropriate, as it directly accounts for the non-sinusoidal, trapezoidal nature of the back-EMF and the associated harmonics \cite{mohammd_taher_new_2021}.
+
+\subsection{Trapezoidal Commutation (Six-Step Control) for BLDC Motors}
+% Trapezoidal commutation, or six-step control, uses Hall-effect sensors to synchronize phase current switching every
+% 120 electrical degrees.
+Trapezoidal commutation, or Six-Step control, uses bipolar conduction, with two motor phases conducting at any time and current commutation occurring every 120 electrical degrees \cite{gieras_modern_2023}. As commutation depends on rotor position, Six-Step control requires either position sensors (e.g. Hall sensors, encoders, or resolvers) or sensor-less estimation based on back-EMF detection or observers \cite{gieras_modern_2023, gasc_conception_2004}. This method is renowned for its simplicity of implementation and low hardware cost \cite{bhatiya_bldc_2024}. It enables effective torque control but introduces significant torque ripple during commutation events, especially under high load \cite{jomsa-nga_torque_2024}. This ripple generates noise, increases mechanical stress, and reduces overall efficiency \cite{mohammd_taher_new_2021}. Although PWM techniques can mitigate this ripple, they do not completely eliminate it \cite{li_quantitative_2019}.
+
+\subsection{Field-Oriented Control (FOC) for BLDC Motors}
+FOC is a vector control strategy that decouples the stator flux and torque components. It transforms three-phase currents into orthogonal \( I_d \) and \( I_q \) components, enabling precise torque control and significant ripple reduction \cite{jomsa-nga_torque_2024}. FOC is particularly effective for BLDC motors with sinusoidal back-EMF but can also be applied to trapezoidal back-EMF motors, albeit with less impressive ripple suppression results \cite{li_quantitative_2019}. It requires greater computational power and more precise position sensors (e.g. encoders). Comparative analysis shows that FOC yields a more stable stator current profile and significantly reduces torque variations compared to trapezoidal control \cite{patil_analysis_2025}.
+
+
+\subsection{Comparative Analysis: FOC vs. Trapezoidal for Light Electric Vehicles}
+
+\subsubsection{Torque Ripple and User Comfort}
+Firstly, torque ripple can be reduced for both control methods by selecting appropriate motor parameters, such as the number of stator slots and rotor poles \cite{gasc_conception_2004}.
+FOC substantially reduces torque ripple compared to Six-Step control, directly enhancing ride comfort and minimizing vibrations. Experimental results show a torque ripple of \SI{18.38}{\percent} for FOC versus \SI{35.67}{\percent} for Six-Step control at 500~rpm \cite{jomsa-nga_torque_2024}. Commutation torque ripple (CTR), prominent in Six-Step control, can be specifically targeted and mitigated using advanced control techniques like Model Predictive Control (MPC) while retaining the fundamental simplicity of trapezoidal commutation \cite{mohammd_taher_new_2021}.
+
+\subsubsection{Energy Efficiency}
+FOC optimizes torque per ampere (MTPA), improving efficiency at low loads. Six-Step control exhibits lower switching losses at high speeds \cite{li_quantitative_2019}.
+
+\subsubsection{Complexity, Cost, and Low-Tech Suitability}
+Six-Step control is inherently simpler, cheaper, and more robust, making it a prime candidate for low-tech applications. Research focused on reducing propulsion system costs proposes simplified hardware topologies, such as 4-switch inverters (instead of 6) coupled with direct current control strategies, maintaining acceptable performance while significantly lowering hardware costs \cite{lee_advanced_2001}. FOC, while superior in performance, is more complex to implement and carries higher hardware costs (sensors, processing power).
+
+\subsubsection{Dynamic Response}
+FOC provides faster response times and better load disturbance rejection \cite{jomsa-nga_torque_2024}.
diff --git a/rapport/remerciements.tex b/rapport/remerciements.tex
new file mode 100644
index 0000000..d80c49c
--- /dev/null
+++ b/rapport/remerciements.tex
@@ -0,0 +1,11 @@
+\section*{Acknowledgment}
+The authors would like to thank Pascal Acco and Thierry Rocacher for their continuous technical guidance and support throughout this project. Their expertise in power electronics, embedded systems, and PCB design was invaluable.
+
+We also thank La Manufacture Autonome Décentralisée (LaMAD) for providing the use case, the technical requirements, and the cargo bike platform used for validation.
+
+Finally, we acknowledge the INSA Toulouse GEI department for providing access to laboratory facilities, measurement equipment, and the necessary components for prototyping.
+
+This work was carried out as part of the 4th-year research project (PIR) at INSA Toulouse.
+
+
+
diff --git a/rapport/resultats.tex b/rapport/resultats.tex
new file mode 100644
index 0000000..5ee58b3
--- /dev/null
+++ b/rapport/resultats.tex
@@ -0,0 +1,92 @@
+\section{Results}
+
+\subsection{FOC Controller Validation}
+
+ \subsubsection{Current Status Summary}
+
+ Table~\ref{tab:foc_status} summarizes the current status of the FOC
+ controller development.
+
+ \begin{table}[htbp]
+ \caption{FOC controller development status}
+ \label{tab:foc_status}
+ \centering
+ \begin{tabular}{l c}
+ \toprule
+ \textbf{Task} & \textbf{Status} \\
+ \midrule
+ VESC firmware compilation & Completed \\
+ Pin compatibility (F405 / L476) & Completed \\
+ Schematic design (KiCad) & Completed \\
+ ERC validation & Completed \\
+ PCB routing & In progress \\
+ Tile footprint correction & In progress \\
+ Board manufacturing & Planned \\
+ Hardware testing & Planned \\
+ \bottomrule
+ \end{tabular}
+ \end{table}
+
+\subsection{Bicycle-Cargo System Control Results}
+
+\subsubsection{Simulation Results}
+The closed-loop Simulink model presented in the subsection~\ref{subsec:Simulink_model} was used to evaluate the performance of the proposed PI-based (Proportional-Integral) control strategy.
+
+Figure~\ref{fig:tracking-error} shows the evolution of the tracking error between the bicycle and the cargo cart during simulation. The response exhibits an initial transient phase followed by a progressive convergence toward the desired equilibrium position, demonstrating stable closed-loop behaviour and satisfactory tracking performance.
+\begin{figure}[!h]
+ \centering
+ \includegraphics[width=\linewidth]{./Figures/error_fig.png}
+ \caption{Position tracking error between bicycle and cargo cart.}
+ \label{fig:tracking-error}
+\end{figure}
+
+\subsubsection{Experimental Load Characterization}
+Experimental tests were conducted on flat terrain in order to evaluate the influence of mechanical load on the motor current consumption of the cargo cart system. The system was powered using a \SI{48}{\volt} battery pack.
+
+Current measurements were acquired using an Analog Discovery 2 connected to a computer running the WaveForms software environment. A current clamp probe was used to measure the motor current, and the signals were sampled at \SI{1}{\kilo\hertz}.
+
+During each test, the throttle command was set to its maximum value in order to produce the highest possible acceleration. Once the maximum speed was reached, the motor current naturally decreased and stabilised as the motor only compensated for rolling resistance and friction effects.
+
+Three loading conditions were investigated corresponding approximately to one, two, and three passengers inside the cargo cart. The motor current measured during these experiments is shown in Fig.~\ref{fig:motor-currents}.
+
+\begin{figure}[!h]
+ \centering
+ \includegraphics[width=\linewidth]{./Figures/Motor_currents.pdf}
+ \caption{Measured motor current under three loading conditions.}
+ \label{fig:motor-currents}
+\end{figure}
+
+The results show a significant current peak during the acceleration phase, reaching the controller limit of approximately \SI{25}{\ampere}. After this transient phase, the current decreases and converges toward a lower steady-state value corresponding mainly to friction and resistive force compensation.
+
+As expected, higher loading conditions resulted in higher steady-state current consumption, indicating an increase in the required motor torque. In addition, the duration during which the current remained close to the maximum controller limit also increased with heavier loads, reflecting the longer acceleration time required to reach steady-state operation.
+These variations are mainly attributed to terrain irregularities, throttle response fluctuations, and limitations associated with the measurement setup and current probe acquisition chain.
+
+However, due to the absence of direct velocity measurements during the experiments, only qualitative observations could be extracted from these tests. Consequently, a precise estimation of dynamic friction parameters and energy efficiency could not be achieved.
+
+\subsection{FOC Controller Validation}
+
+\subsubsection{Current Status Summary}
+
+Table~\ref{tab:foc_status} summarizes the current status of the FOC controller development.
+
+\begin{table}[htbp]
+\caption{FOC controller development status}
+\label{tab:foc_status}
+\centering
+\begin{tabular}{l c}
+\toprule
+\textbf{Task} & \textbf{Status} \\
+\midrule
+VESC firmware compilation & Completed \\
+Pin compatibility (F405 / L476) & Completed \\
+Schematic design (KiCad) & Completed \\
+ERC validation & Completed \\
+PCB routing & In progress \\
+Tile footprint correction & In progress \\
+Board manufacturing & Planned \\
+Hardware testing & Planned \\
+\bottomrule
+\end{tabular}
+\end{table}
+
+