diff --git a/Article_Scientifique/main.tex b/Article_Scientifique/main.tex index 6fc209d..4f183f4 100644 --- a/Article_Scientifique/main.tex +++ b/Article_Scientifique/main.tex @@ -206,19 +206,157 @@ Third, the security of the wireless communication interface is investigated, wit 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. +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 +PID-based (Proportional-Integral-Derivative) control strategy combined with distance sensing, allowing adaptive assistance based on system dynamics. -% ***************************** Hardware-Based Six-Step Commutation Controller **************************************** +% ************************************** LOW TECH SIX STEP CONTROL ***************************************************** \section{Hardware-Based Six-Step Commutation Controller} -% ***************************** STM32-Based Field-Oriented Control Motor Drive ***************************************** +% ************************************** FIELD ORIENTED CONTROL ***************************************************** \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:related}. + +\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 modifying the PCB, a thorough pin compatibility check was +performed between the STM32L476 and the STM32F405 +(original Cheap FOCer-2 design). The following aspects were examined: +\begin{itemize} + \item Physical pinout in LQFP64 package. + \item Alternate functions for PWM timers. + \item USB DP/DM pins (PA11/PA12). + \item Analog inputs for current sensing. + \item UART for BLE communication. +\end{itemize} + +Three pin conflicts were identified and resolved as follows. + +First, the SPI\_MISO function on PA6 for the STM32F405 conflicts with a +DAC output on the same pin for the STM32L476 tile. Since this pin is +used for current sensing via SPI in the original Cheap FOCer-2 design, +the SPI communication was remapped to PA5 on the L476, which provides a +compatible alternate function. + +Second, the gate driver enable signal (EN\_GATE) was originally assigned +to PB5 on the F405. This pin is not accessible on the L476 +tile. The signal was therefore moved to PC5, which is available and +can be configured as a standard GPIO output. + +Third, Hall sensor C was originally connected to PC8 (TIM8) on the F405. +This pin is not available on the L476 tile. The Hall sensor input was +therefore reassigned to PB3, configured as TIM2\_CH2, which provides +the necessary input capture functionality for Hall signal decoding. + +All other critical functions (PWM timers, complementary PWM, enable +signals, encoder inputs, UART, USB, and CAN) remain fully compatible +between the two microcontrollers. The ADC channel differences between +the F405 (ADC123/ADC12) and the L476 (ADC3) must still be handled in +firmware, as noted previously. + +\subsection{Schematic Design and KiCad Implementation} + +The original Cheap FOCer-2 schematic was modified in KiCad to replace the +integrated F405 with connectors for the L476 tile. The main modifications +included: +\begin{itemize} + \item Removal of the F405 and its associated passive components. + \item Addition of two 20-pin headers to receive the Rocacher tile. + \item Re-routing of PWM, ADC, and USB signals to the headers. +\end{itemize} + +The schematic passed Electrical Rule Check (ERC) with no errors. + +\subsection{Routing Challenges and Current Status} + +The PCB layout was then started. The original Cheap FOCer-2 routing is +very dense. Inserting connectors for the removable tile while maintaining signal integrity proved +difficult. + +The main issues encountered were: +\begin{itemize} + \item Some footprints for the tile connectors did not appear correctly + in the layout after schematic import. + \item Routing of high-current paths (battery, motor phases) around the + connectors required additional vias, increasing resistance. + \item Decoupling capacitors had to be repositioned, raising concerns + about switching noise. +\end{itemize} + +Currently, the schematic is validated, and the layout is under +development. Once routing is completed, the board will be manufactured +and tested with the VESC firmware adapted to the L476 tile. % ************************************** SOFTWARE AND CONNECTIVITY ***************************************************** @@ -304,7 +442,7 @@ for the the MAD associates. % ************************************ DYNAMIC MODELLING *************************************************************** -\section{Dynamic Modelling and Control of the Bicycle–Cargo System} +\section{Dynamic Modelling and Control of the Bicycle-Cargo System} \subsection{Dynamic System Modelling} @@ -376,7 +514,7 @@ where $e_{\text{ref}} = \SI{-0.5}{\meter}$ represents the desired equilibrium of \centering \includegraphics[width=\linewidth]{./Figures/sys_dyn_matlab.png} - \caption{Closed-loop model of the bicycle–cargo system with PI control.} + \caption{Closed-loop model of the bicycle-cargo system with PI control.} \label{fig:simulink-closedloop} \end{figure} @@ -443,6 +581,33 @@ However, due to the absence of direct velocity measurements during the experimen 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} + % ******************************** DISCUSSION ************************************************************************** @@ -476,6 +641,19 @@ What should be a clear conclusion from our test with the jammer is that a contro 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. +% ******************************** Perspectives and Future Work ************************************************************ + +\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). + +% ******************************** CONCLUSION ************************************************************************** \section{Conclusion/Summary} @@ -495,8 +673,29 @@ impose a tripping hazard. There, an encapsulation of an encrypted control frame %quantities and units. For example, write ``Temperature (K)'', not %``Temperature/K''. +% ******************************** REMERCIEMENTS ************************************************************************** + \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. + +% ******************************** IA ************************************************************************** +\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.