diff --git a/chapters/result.tex b/chapters/result.tex index 5671f082fd2d990b7952516197f581a0699a1120..566ccd72aa048ac453140057ce3f9d8119f73a72 100644 --- a/chapters/result.tex +++ b/chapters/result.tex @@ -51,6 +51,11 @@ The final result of the project, in regards to fulfilled goals, is as follows: The sensors were ordered and should accompany this project. The dev board shield has connectors dedicated to IR sensor connections, although these contacts have since been repurposed as general status LEDs. +\subsection{Sonars - Final state} + \subsectionauthor{Author: Kamal Alkahwati} + The Sonars are implemented according to specification requirements but + upon testing it was discovered that they do malfunction sometimes. If HC-SR04 needs to measure a distance of more than ~600cm it will often malfuncion and give random measurement data. The problem is that the timeout of HC-SR04 doesn't work as it should, and instead of giving a timeout-pulse it just sends random data. It is suspected that this is a result of a too cheap assembly. This is solved using software filters, but they should be replace all in all in the future. + \subsection{Collision Avoidance - Final state} \subsectionauthor{Author: Lars Jonsson} diff --git a/implementation/Timer.tex b/implementation/Timer.tex new file mode 100644 index 0000000000000000000000000000000000000000..fa075d84d2b7ec8eff75b9f71d540f89ddb00b46 --- /dev/null +++ b/implementation/Timer.tex @@ -0,0 +1,34 @@ +\subsection{Timer} +\subsectionauthor{Author: Kamal Alkahwati} + Six separate timers are implemented for a different range of functionalities. + + \begin{itemize} + \item TIM1 - PWM generator for triggering sonars + \item TIM2 - Dedicated Input Capture for manipulating PPM signals. + \item TIM3 - Input capture channels 1 \& 2 are used for distance measuring on sonars. + \item TIM4 - Input capture channels 1,2,3,4 are used for distance measuring on sonars. + \item TIM5 - Used to regurlarly fetch data from LiDAR + \item TIM9 - PWM generator used to drive the stepper motor that the LiDAR is mounted on. + \end{itemize} + +Below follows pin description for timers. + \begin{table}[H] + \begin{center} + \begin{tabular}{ l l } + \textbf{Pin} & \textbf{Usage} \\ + \hline + PE9 & TIM1 CH1 \\ + PA15 & TIM2 CH1 \\ + PC6 & TIM3 CH1 \\ + PC7 & TIM3 CH2 \\ + PD12 & TIM4 CH1 \\ + PD13 & TIM4 CH2 \\ + PD14 & TIM4 CH3 \\ + PD15 & TIM4 CH4 \\ + PE5 & TIM9 CH1 + + \end{tabular} + \end{center} + \caption{Timer Pin Description} \label{tab:TimerPinDescription} + \end{table} + diff --git a/implementation/motor-stepper b/implementation/motor-stepper index 393b0d8ee65d3b89597bfa64a13ae796bf82d791..57e4c53002b9c13becb5df34413c096ab5fad87c 100644 --- a/implementation/motor-stepper +++ b/implementation/motor-stepper @@ -1,4 +1,6 @@ \subsection{Stepper motor} +\subsectionauthor{Author: Kamal Alkahwati} + A stepper motor is used to rotate the lidar to perpendicular to its own movement, thus creating a three dimensional view for the lidar to record. \newline The stepper motor is controlled via PWM on Timer 9, and the processor receives an interrupt for every step taken to keep track of number of steps (0 - 400). At every lap, a hall effect sensor gets triggered, which induces an extended interrupt on GPIOG Pin 3 to reset the step counter. \ No newline at end of file diff --git a/implementation/motor-stepper.tex b/implementation/motor-stepper.tex index 393b0d8ee65d3b89597bfa64a13ae796bf82d791..f768f0f0f28fac84908101a25db42fc1ff3ebc95 100644 --- a/implementation/motor-stepper.tex +++ b/implementation/motor-stepper.tex @@ -1,4 +1,5 @@ \subsection{Stepper motor} +\subsectionauthor{Author: Kamal Alkahwati} A stepper motor is used to rotate the lidar to perpendicular to its own movement, thus creating a three dimensional view for the lidar to record. \newline The stepper motor is controlled via PWM on Timer 9, and the processor receives an interrupt for every step taken to keep track of number of steps (0 - 400). At every lap, a hall effect sensor gets triggered, which induces an extended interrupt on GPIOG Pin 3 to reset the step counter. \ No newline at end of file diff --git a/implementation/ppm.tex b/implementation/ppm.tex index 8cf7f5aab20192d42395c41863c88b3a2849c973..2118a70a1d912cafbdf522843954589bdae50e1c 100644 --- a/implementation/ppm.tex +++ b/implementation/ppm.tex @@ -1,4 +1,5 @@ \subsection{PPM} +\subsectionauthor{Author: Kamal Alkahwati} The transmitter sends radio signals to the receiver, which converts these into PPM signals that the run on 8 different channels for controlling the copter. To be able to apply automatic control to the quad, we need to modify these PPM signals as we'd like them. diff --git a/implementation/sonar.tex b/implementation/sonar.tex index e8b9d7efd61def24cc9f9a58bcc6124837d3be8c..c0ff0a143d41969f455ae86735a7a7207627e5bc 100644 --- a/implementation/sonar.tex +++ b/implementation/sonar.tex @@ -1,4 +1,5 @@ \subsection{Sonar - HC-SR04} +\subsectionauthor{Author: Kamal Alkahwati} The sonars are triggered by a PWM generator on TIM1, with pulses of $\SI{10}{\micro\second}$ every 65ms. This will result in each sonar measuring in approximately \SI{15}{\hertz}. Pulse width measurement is done by using the input capture function on TIM3 CH1-CH2 and TIM4 CH1-CH4 respectively. Each input capture pin generates an interrupt if triggered, which in turn calls \emph{computeWidth} function that returns the width in microsecs. The width is then divided by 58, to get distance in cm and then transferred to MSP\_newSonardata. @@ -11,10 +12,6 @@ Each input capture pin generates an interrupt if triggered, which in turn calls \end{figure} -To start a measurement, Trig of SR04 must receive high (5V) for at least 10$\mu$s. -This will initiate the sensor to transmit 8 cycles of ultrasonic bursts at 40KHz and wait for the reflection. -When the receiver has detected the reflection, it will set the echo pin high (5V) and delay and delay for a period (width) which is proportionate to the distance. -\\* To get distance in cm: Time/58. The sensors come complete with an ultrasonic transmitter and receiver module. \emph{Note:} If HC-SR04 needs to measure a distance of more than ~600cm it will malfuncion and give random measurement data. It is suspected that this is a result of a too cheap assembly. @@ -25,5 +22,5 @@ This will initiate the sensor to transmit $\SI{8}{}$ cycles of ultrasonic bursts $\SI{40}{\kilo\hertz}$ and wait for the reflection. When the receiver has detected the reflection, it will set the echo pin high ($\SI{5}{\volt}$) and delay and delay for a period (width) which is proportionate to the distance, before pulling the pin back down. -\\* To get distance in cm: $Width/58$. +\\* To get distance in cm: $\frac{Width}{58}$. diff --git a/main.tex b/main.tex index 6ee00f65536d2dd3f7c2b425fa451145f52ae196..072b95e798123fa7967f33cda8bb7f600689bc8f 100644 --- a/main.tex +++ b/main.tex @@ -104,6 +104,7 @@ \input{./implementation/imu.tex} \input{./implementation/usartComPro.tex} \input{./implementation/spi-uwb.tex} + \input{./implementation/Timer.tex} \input{./implementation/sonar.tex} \input{./implementation/ppm.tex} \input{./implementation/motor-stepper.tex}