Skip to content
Snippets Groups Projects
Commit 30e1d1e8 authored by Kamal Alkahwati's avatar Kamal Alkahwati
Browse files

added timer chapter in implementation, minor changes on different

parent eb956b5c
No related branches found
No related tags found
No related merge requests found
...@@ -51,6 +51,11 @@ The final result of the project, in regards to fulfilled goals, is as follows: ...@@ -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 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. 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} \subsection{Collision Avoidance - Final state}
\subsectionauthor{Author: Lars Jonsson} \subsectionauthor{Author: Lars Jonsson}
... ...
......
\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}
\subsection{Stepper motor} \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. 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 \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. 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
\subsection{Stepper motor} \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. 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 \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. 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
\subsection{PPM} \subsection{PPM}
\subsectionauthor{Author: Kamal Alkahwati}
The transmitter sends radio signals to the receiver, which converts these into PPM signals 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 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. automatic control to the quad, we need to modify these PPM signals as we'd like them.
... ...
......
\subsection{Sonar - HC-SR04} \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}. 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. 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. 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 ...@@ -11,10 +12,6 @@ Each input capture pin generates an interrupt if triggered, which in turn calls
\end{figure} \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. 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. \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 ...@@ -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. $\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}$) 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. 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}$.
...@@ -104,6 +104,7 @@ ...@@ -104,6 +104,7 @@
\input{./implementation/imu.tex} \input{./implementation/imu.tex}
\input{./implementation/usartComPro.tex} \input{./implementation/usartComPro.tex}
\input{./implementation/spi-uwb.tex} \input{./implementation/spi-uwb.tex}
\input{./implementation/Timer.tex}
\input{./implementation/sonar.tex} \input{./implementation/sonar.tex}
\input{./implementation/ppm.tex} \input{./implementation/ppm.tex}
\input{./implementation/motor-stepper.tex} \input{./implementation/motor-stepper.tex}
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment