User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
ee:hydrophones:start [2018/01/28 10:45]
Ryan Summers
ee:hydrophones:start [2018/01/28 15:23]
Ryan Summers
Line 4: Line 4:
  
 ===== Introduction ===== ===== Introduction =====
-//Note: The purpose of this page is to describe how the arrival times are acquired on a number of hydrophone channels. ​This documentation does //not// describe ​how that information is turned into bearings or how it is used in localization.//+//Note: The purpose of this page is to describe how the arrival times are acquired on a number of hydrophone channels. ​Documentation describing ​how that information is turned into a pinger bearing ​is found [[cs:​hydrophones:​pinger_bearing:​start|here]].//
    
  
-The arrival time calculations tend to be complicated by noise, which means that it is not possible to trivially detect rising edges. The ping can be thought of as an identical signal arriving slightly ​later on each of the hydrophones. In order to accurately calculate the time differences between each signal, a [[https://​en.wikipedia.org/​wiki/​Cross-correlation|cross correlation]] is used. A cross correlation essentially slides one signal over the top of another, and at the point where the signals maximally overlap, the amount of shifting needed is equal to the time delay of the signal. ​An education GIF of a cross-correlation is available [[https://​media.giphy.com/​media/​VVPKOXc6aY1Lq/​source.gif|here]].+The arrival time calculations tend to be complicated by noise, which means that it is not possible to trivially detect rising edges. The ping can be thought of as an identical signal arriving ​at slightly ​different times on each of the hydrophones. In order to accurately calculate the time differences between each signal, a [[https://​en.wikipedia.org/​wiki/​Cross-correlation|cross correlation]] is used. A cross correlation essentially slides one signal over the top of another, and at the point where the signals maximally overlap, the amount of shifting needed is equal to the time delay of the signal. ​Below is an example ​of a cross correlation ​with a sine wave. In the demo, you can see that at X offset = 0, the correlation result ​is maximumTherefore, the time delay of the two signals is zero (as they are duplicates of eachother).
  
-Further simplifications can be applied to the problem as well. By ensuring that the hydrophones are close enough, it can be guaranteed that the arrival time difference will never exceed one half wavelength. Therefore, the cross correlation only needs to be completed within +/- half a wavelengthThe signals occur at a maximum frequency of approximately 40KHz, which means that the arrival time difference can never exceed approximately 12.5 microseconds. This means that the hydrophones must be spaced within 1.8cm of each other due to the speed of sound in water.+{{https://media.giphy.com/​media/​VVPKOXc6aY1Lq/​source.gif}}
  
-Now that the theoretical aspects ​are out of the way, the foundation of the problem starts to take shape.  +Further simplifications can be applied to the problem as well. By ensuring ​that the hydrophones ​are close enoughit can be guaranteed that the arrival time difference will never exceed one half wavelength (the signals ​are sinusoidal with a maximum frequency of 40KHz). The cross correlation now only needs to be completed within +/- half a wavelength ​(which increases accuracy ​and decreases required processing). This means that the arrival time difference can never exceed approximately 12.5 microseconds. Because the speed of sound in water is 1498 m/s, the hydrophones must be spaced within 1.8cm of each other.
-1) Acquire ​signals ​on all four hydrophones ​(one reference ​and 3 along each X, Y, and Z axis) +
-2) Cross-correlate ​the XY, and Z axis signals against ​the reference to calculate time of flight delay.+
  
-The cross correlation ​step is simple mathematics. Note that cross-correlation boils down to multiplying ​individual points ​of two signals together ​and accumulatingso if the signals are big it can take quite a bit of timeWe will discuss how to handle this later.+To calculate a cross correlation, set time delays of [-12.5, 12.5] microseconds on the signal and calculate the overlapping area for each time delay. Calculating overlap is done by multiplying ​the value of the origin hydrophone at a time step by the value of the shifted hydrophone function at the same time step and summing up all multiplied values. When both are positive or negativea point constructively adds to the correlation. When the signs don't match on the points, the correlation decreases. When both signals are identical, the correlation is maximal. 
 + 
 +==== Summary ==== 
 +Now that the theoretical aspects are out of the way, the foundation of the problem starts ​to take shape
  
-The main difficulty exists in sampling the signals. It is important that samples are taken simultaneously ​on each of the hydrophones ​and that the signals are sampled fast enough ​to ensure that the precision in time of flight ​is accurate enough (for example, at a sampling frequency of 1MHz, the time of arrival can never be more precise than a signal microsecond). Therefore, the system must be capable of simultaneously sampling four channels at a minimum rate of 1MHz.+  - Acquire ​signals on all four hydrophones (one reference and 3 along each X, Y, and Z axis) 
 +  - Cross-correlate ​the X, Y, and Z axis signals against ​the reference ​to calculate ​time of flight ​delay.
  
 +The main difficulty exists in sampling the signals. It is important that samples are taken simultaneously on each of the hydrophones and that the signals are sampled fast enough to ensure that the precision is accurate enough (for example, at a sampling frequency of 1MHz, the time of arrival can never be more precise than a single microsecond). Therefore, the system must be capable of simultaneously sampling four channels at a minimum rate of 1MHz.
  
  
Line 27: Line 30:
  
 ==== Code ==== ==== Code ====
-All software and firmware is available in [[https://​github.com/​PalouseRobosub/​hydro-zynq|the GitHub repository]]. There are two primary directorieshardware and software. The hardware folder contains all the Verilog and TCL files for interracting ​with Vivado. TCL scripts have been generated to rebuild the block design in vivado, and a README.txt file in proj/ describes how to use them. Additionally,​ the IO constraints file is provided for the current hardware.+All software and firmware is available in [[https://​github.com/​PalouseRobosub/​hydro-zynq|the GitHub repository]]. There are two primary directories, ''​%%hardware/​%%'' ​and ''​%%software/​%%''​. The ''​%%hardware%%'' ​folder contains all the Verilog and TCL files for interacting ​with Vivado. TCL scripts have been generated to rebuild the block design in [[https://​www.xilinx.com/​products/​design-tools/​vivado.html|Vivado]], and a ''​%%README.txt%%'' ​file in ''​%%proj/%%'' ​describes how to use them. Additionally,​ the IO constraints file is provided for the current hardware.
  
 The software folder contains all C source code used in programming the HydroZynq. An ELF file can be created by using the `mk` script supplied with the source file name.  The software folder contains all C source code used in programming the HydroZynq. An ELF file can be created by using the `mk` script supplied with the source file name.