Development of a low-cost laser range-finder (LIDAR) Master’s Thesis in Systems, Control and Mechatronics Peter Kaldén Erik Sternå Department of Microtechnology & Nanoscience Chalmers University of Technology Gothenburg, Sweden 2015 Master’s Thesis 2015 Abstract This is a development report that covers the work attempting to design and construct a laser based LIDAR. The goal of the project was to design a cheap laser range-finder capable of performing scanning measurements. This was intended to be an open-source sensor primarily aimed at engineers lacking a cost-viable sensor for positioning. The target specifications of the system were to have a measurement range from 0.5 m to 5 m with a measurement accuracy of 0.05 m. Scanning was initially specified but was removed form the scope due to time constraints. The requirements to be able to handle scanning measurements were however retained to enable scanning to be realized at a later time. Scanning with a 360 degrees field of view with a 1 degree angular resolution was specified, making a measurement rate of at least 3.6 kHz a requirement. The total cost limit set was e120. The major part of this thesis discusses the selection of suitable components and the reasoning be- hind their choice. During the component selection process, the focus was primarily to minimize component costs and to adhere to international safety-regulations while still fulfilling the specifica- tions. Since the goal was to make this project open source the reasoning and process of development is vital for anyone wishing to continue the development. The selected components were assembled and tested. The approximated total cost of the components for the system ended at e125, slightly higher than the cost limit without any manufacturing cost included. It is however close to the limit and it might be possible to reduce the cost with alternative components. The control system, the time measurement, the transmitter and the optics were all verified working and fulfilling their part of the specifications. However the detector and amplifier were unable to receive and amplify the very weak return signal preventing the system from being verified in its entirety. 1 Contents 1 Review and Overview 6 1.1 Review of distance measurement techniques . . . . . . . . . . . . . . . . . . . . . . . 6 1.1.1 Time-of-Flight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.1.2 Triangulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.1.3 Time-of-Sight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.1.4 Phase shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.2 Choice of method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.3 Overview of Time of flight (ToF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2 Development procedures 12 2.1 Transmitter design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.1.1 Laser type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.1.2 Laser wavelength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.1.3 Laser safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.1.4 Laser driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.1.5 Laser optics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.2 Receiver design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.2.1 Diffuse reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.2.2 Receiver optics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.2.3 Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.2.4 Signal amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 2.3 Time measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.4 Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.5 Hardware design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.6 Scanning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3 Testing equipment 35 3.1 Oscilloscope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.2 IR camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.3 Light power meter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4 Results 36 4.1 Electrical design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.1.1 Main PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.1.2 Detector PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 4.2 Software design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 4.3 Hardware design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 4.3.1 First design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 4.3.2 Second design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 4.4 Subsystem verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.4.1 Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.4.2 Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 4.4.3 Time measurement circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.5 Cost summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 5 Discussion 51 2 5.1 So what could have been done to make it work? . . . . . . . . . . . . . . . . . . . . . 52 5.2 What can be improved? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 6 Conclusion 52 7 Acknowledgements 53 8 Appendix 56 8.1 Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 8.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 8.2.1 MATLAB - Programmable resistor mapping . . . . . . . . . . . . . . . . . . . 63 8.2.2 MATLAB - Laser safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 8.3 Measurement data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 8.3.1 Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 8.4 List of components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 3 Abbreviations Glossary laser Light amplification by stimulation of radiation. 5, 13, 14 LIDAR Light detection and ranging. 1, 5, 6, 22, 34–36, 46, 50, 51 microcontroller Small processor with embedded memory and peripheral I/O systems. 7, 10, 12, 33, 34, 36, 38, 45, 48–51, 55, 61 Acronyms ADC Analog-to-Digital Converter. 9, 34, 38 APD Avalanche Photo-diode. 26, 33, 51 ASIC Application-specific integrated circuit. 7, 33 CTMU Charge Time Measurement Unit. 7, 33 DAC Digital-to-Analog Converter. 34, 38 GaAs Gallium Arsenide. 13, 14 IEC International Electrotechnical Commission. 14 LED Light Emitting Diode. 6 MEMS Microelectromechanical systems. 9 MOSFET Metal-oxide-semiconductor field-effect transistor. 16, 17, 45, 64 MPE Maximum permissible exposure. 14, 15 NEP Noise-equivalent power. 26, 27 OP-amp Operational Amplifier. 29–32, 37, 38, 46, 48, 59, 63 PCB Printed Circuit Board. 28, 34, 36–38, 40, 46, 48, 51, 55–58 PWM Pulse width modulation. 16 RMS Root mean square. 31 SNR Signal-to-noise ratio. 26, 27, 29–33 4 SPI Serial Peripheral Interface. 34 TDC Time-to-Digital Converter. 7, 12, 33, 34, 36, 38, 48–50 TMU Time Measurement Unit. 7, 33 ToF Time of flight. 2, 7, 11, 12 ToS Time of sight. 9 UART Universal Asynchronous Receiving and Transmitting. 6, 34 VCSEL Vertical-cavity surface-emitting laser. 13 Introduction In the world of robotics and autonomous vehicles, the ability to sense the environment is very important. Technologies based on cameras, such as the Microsoft Kinect[1], can be used to gather lots of information about the environment. However, this information may be hard to process due to the fact that it requires a large amount of computing power to analyse. Also, dependent on the technology used, the range might be very limited or the frame-rate low. Instead, LIDARs can be used. A LIDAR uses light to measure the distance to an object. Certain LIDARs can also measure distance at several angles by rotating parts of the measurement device for example, thus achieving a plane of sensor information. The measurement area can therefore be wide angled (up to 360° field of view is available). On the market, LIDARs are available from several companies such as SICK and Hokuyo[2, 3], but at a price which most hobbyists and schools cannot afford. Also, they are often closed source and generally do not offer the customer much possibility for tweaking parameters such as sample rate, angular resolution, output power and so on. The high cost of LIDARs today limits the potential for technological development in the field of robotics and autonomous vehicles. This is what this master thesis project hopes to change. What this project aims to do is to build a functional, low-cost and easy-to-use LIDAR using a laser with a performance usable for a wide range of applications. Initially the goal also specified that the LIDAR should be scanning, i.e. rotating to do measurements in a plane. This goal was deemed too time consuming and was removed, however the specifications remain so that scanning might be realized without major changes. The goal of the project is to develop a system that fulfils the goals stated in table 1. Parameter Abbreviation Value Max detection range Lmax 5 m Min detection range Lmin 0.5 m Measurement accuracy 1 Lres ±0.05 m Angular detection span φA 360◦ Angular resolution φr 1◦ Scanning frequency fscan 10 Hz Measurement Frequency fmeas 3600 Hz Table 1: Target performance parameters of the system 5 • The LIDAR should also fulfil the following criteria: 1 Not cost more than 1000 SEK (approx e120) to manufacture. 2 Easy to use for hobbyists (support of standard interfaces such as Universal Asynchronous Receiving and Transmitting (UART) and USB). 3 Open-source hardware and software, thus allowing other hobbyists and researchers to further develop the sensor. 4 Well-written and extensive documentation, to allow for easy integration and further develop- ment. 5 Give the user high control and customizability when communicating with the sensor, such as setting the updating frequency, angular resolution, measuring area and so on, thus letting the user optimize the sample rate/resolution dilemma to fit their application. 6 Contain some higher level functions, such as object detection. 7 Safe according to international laser safety regulations. • A long-term goal is that the LIDAR developed should be commercially available for people all over the world 1 Review and Overview 1.1 Review of distance measurement techniques The main reason for using a laser is that a laser-beam does not diverge significantly making it possible to use a narrow beam to make a point measurement regardless of the distance to the object detected. A laser also has the advantage of having a very narrow bandwidth with regards to its wavelength, making it possible to have a narrow bandwidth receiver making it less sensitive to ambient noise. Lasers are also generally able to operate on a higher frequency than Light Emitting Diodes (LEDs), which makes them more well suited for high-speed measurements. Some different approaches to measure distance using a laser were investigated and evaluated after which one method was chosen. 1.1.1 Time-of-Flight This method is one of the most used and straight-forward solutions. The concept is simple: A pulse of light is sent out and the time until the reflected pulse is detected is measured. By using pulses the power of the emitted signal can be greater than if it was continuous, making the return signal stronger. A conceptual image can be found in figure 1. 1When calculating the requirements on the measurement methods evaluated, this figure is used as resolution requirement, since a resolution of at least 0.05 m is needed to get an accuracy of 0.05 m 6 Figure 1: Conceptual image of ToF Since light travels very fast, the requirement on resolution of the sampling is very high. The minimum required time sampling resolution can be calculated as seen in equation 1 TR,T oF = 2 ∗ Lres c ≈ 2 ∗ 0.05 m 3 ∗ 108 m/s ≈ 333 ps (1) where c is the speed of light, Lres is the required distance resolution (as defined as one of the target parameters in table 1) and TR,T oF is the required time resolution. The factor 2 in the formula represents the fact that light has to travel to the target and back. There are several ways to measure time precisely. Many companies manufacturing laser range finders that use this technology design their own Application-specific integrated circuits (ASICs) which is way over the budget and out of scope for this project. There are however some integrated circuits capable of this, so called Time-to-Digital Converters (TDCs) or Time Measurement Units (TMUs) but they are generally rare and expensive [4, 5]. Another solution could be to design a circuit for this using a capacitor and a constant current source. The charge in the capacitor will then correspond to a time. Some microcontrollers (such as Microchips PIC microcontrollers) have such a module (called Charge Time Measurement Unit (CTMU)) built-in, which is rather easy to use [6]. However an inquiry at a TDC-manufacturing company revealed that there were TDC-circuits with a time resolution of 45 ps available at approximately e10. 1.1.2 Triangulation This is a common method when it comes to range-finding, both with lasers and light in general[7]. It is conceptually simple but may require more advanced optics than the other solutions. The laser light is sent out and is reflected back to a sensor array that is positioned in the same plane, at a distance from the emitter (distance a in figure 2). The point on the sensor array where the signal is received determines the distance to the object. The relation between the distance, sensor position 7 and the signal position on the sensor array can be found in equation 2: L = a ∗ f x (2) where L is the distance to the object, a is the distance between the focal point of the lens and the laser output, f is the focal length and x is the position on the sensor array. A conceptual image is shown in figure 2. Figure 2: Conceptual image of triangulation The measurement time is decided by the integration time of the sensor, i.e. the time it takes to determine the value of each sensor in the array. An example sensor was found [8] that has an integration time over the whole array of 33.75 µs. Comparing this time to the time available for each measurement: 1/fmeas = 277.8 µs > 33.75 µs, (fmeas being the measurement frequency defined in the target specification found in table 1), we found that this is more than enough time and would allow for several measurements on each point to increase the accuracy. Using this sensor would be entirely feasible from a measurement time point of view. The laser beam needs to be continuous for the time it takes for the sensor time to take in the return signal, limiting the output power, in turn limiting the return signal. The resolution depends on the number of sensors on the array, the sensor spacing of the array, the distance between the sensor and the laser emission point (shown as a in figure 2) as well as the optics solution. The distance calculation formula can be rewritten to calculate the required resolution of the sensor array. This can be done by calculating the difference in position of the returned light at the sensor for two values at the maximum measurement distance, as shown in equation 3. ∆xLmax = a ∗ f Lmax − a ∗ f Lmax − Lres (3) where a is the distance between emitter and the focusing lens and assumed to be 0.05 m, f is the distance from the lens to the sensor and assumed to be 0.05 m. Lmax and Lres is the max measurement distance and the required resolution respectively as can be seen in table 1. This requirement presents a problem: 5 µm is close to the wavelength of the laser and it is therefore possible that the properties of the laser beam will prevent this resolution being possible at all. The example sensor array has 63.5 µm center to center spacing. This means that it is has a 8 lower resolution than needed. However the sensor array reports the analog values of each sensor and therefore interpolation can be used to increase this resolution. The theoretical maximum interpolation is determined by the resolution of the Analog-to-Digital Converter (ADC) used to sample, the power distribution of the laser beam and the assumption that the laser spot is equal to or larger than the size of a pixel. Given an ADC with 12-bits each pixel can have 4096 different values. This means that the center of the laser point can in theory be determined at a 4096-part of a pixel, which is equal to 0.015 µm in this case and therefore enough in theory. A more realistic assumption is that the value can be interpolated by a factor 10-100 instead of 4096, meaning that the example sensor would not work in that aspect. However, given another sensor array with tighter pixels or a shorter maximum distance it could be made to work. The biggest unique cost for this solution would be the sensor, since one such sensor costs about e15 [8]. There are several types of such sensor arrays, but this is a cheap example which might be to fulfil the requirements. 1.1.3 Time-of-Sight Time of sight (ToS) is a method that works by sweeping a laser beam over the measurement span away from the sensor. By sweeping with a constant angular velocity and measuring the timing of where in the sweep the laser is reflected into a narrow sensor slot the distance to the object can be calculated. It was inspired by a hobby project[9] and presents an interesting approach. A conceptual image is shown in figure 3 Figure 3: Conceptual image of ToS The method requires that the laser beam is swept across the entire measurement span to perform a measurement. Sweeping the laser beam can be accomplished in multiple ways, the simplest being to use a rotating mirror or prism. The laser is reflected off the prism and the rotation is used to angle the reflection so that it sweeps. This can also be done via a so called Microelectromechanical systems (MEMS) mirror which is a small electrically controlled mirror. However they are expensive, rare and have a limited angular range which limits the sweep angle. If a prism is used to sweep the laser, the prism must complete a rotation for each measurement. If 9 the prism is multi-sided, multiple smaller sweeps can be performed per rotation, reducing the re- quirement on the rotational speed of the prism. The required rotational speed frot can be calculated using equation 4. frot = fmeas/n (4) where fmeas is the measurement rate defined in the target specification and n is the number of sides of the prism used. For a prism with n = 1 sides the rotational speed requirement becomes 3600 Hz or 216 000 rpm, which is unreasonably fast. For a 6-sided prism this becomes 600 Hz or 36 000 rpm, which is still faster than most motors run comfortably at. Most likely a sophisticated prism with many sides would be required for this method to work at the required sampling rate. This rotational speed can be converted into an angular velocity as shown in equation 5 ω = (360 ∗ fmeas)/n (5) The angular velocity (ω) of the beam together with the angle difference at the maximum mea- surement distance sets the minimum sampling time. This because the desired resolution must be obtained at the maximum measurement distance. The angular difference at the maximum mea- surement distance is obtained as shown in equation 6, where H is the height from the sensor slot to the reflection point of the prism, shown in figure 3 and Lmax and Lres are target specification parameters from table 1. ∆φLmax = arctan( H Lmax − Lres ) − arctan( H Lmax ) (6) The required sampling time can then be obtained using equation 7 Ts = ∆φLmax ω (7) With a H = 5 cm, n = 6 and Lmax, Lres and fmeas as defined in table 1 the minimum sampling time becomes 26 ns. This is in the time realm where a microcontroller could reasonably be used to sample the time directly, which would reduce costs since a microcontroller would be used in any case for the interface and various calculations. The sensor slot dimensions also has some requirements. There is an issue where a ground reflection may produce a false reading if the sensor slot have insufficient height/length ratio, as can be seen by the green ray in figure 3. To eliminate this issue the condition in equation 8 needs to be satisfied. d Lmax ≤ h D (8) If d = 0.05 m and D = 0.05 m, then the aperture, h must satisfy the condition in equation 9 h ≤ D ∗ d Lmax h ≤ 0.0005 m (9) This aperture is to small to be reasonable because the total amount of photons would be too low to be able to trigger any reasonably priced sensor. A larger aperture can be compensated for by tilting the slot slightly upward from the ground. This worsens the resolution, and the height of the objects possible to detect at long ranges, but solves the problem of ground reflections and the larger aperture will let through more photons. This method would also require a very near continuous laser beam, making the possible output power of the laser low due to safety reasons. 10 1.1.4 Phase shift This method was only briefly investigated at the end of the project to look for alternative solutions to include in the report. Therefore, phase shift was not considered at the choice of method. Phase shift measurement uses a continuous laser beam that has an added sinusoidal power modu- lation. By calculating the phase difference between the laser pulse sent out and the one received from a reflecting target it is possible to partly calculate the distance to the target. Because the phase difference is periodic with the frequency of the power modulation, the distance can be de- duced by multiple measurements using different modulation frequencies. Since several sequential measurements are required for each sample it might be difficult to achieve a high sampling rate. The upside of this method is that the modulation is easy to measure since it is a continuous and predictable signal, it is also quite noise resistant and does not require a very fast photo-diode. Furthermore, very high resolution can be obtained, since if the modulation can be done at a high resolution. As with several of the other methods, there is the issue of using a continuous signal with respect to safety. 1.2 Choice of method The method chosen was time of flight. The main argument against time of flight was initially the price of the specialized sampling circuits, but given that a time measurement module costs as little as e10 it might even be the cheapest solution. The sample frequency may be much higher than the other two methods which allows for a more accurate measurement result, by performing several measurements at each point. Using a pulsed laser allows for a higher output power, which gives a stronger return signal, while still keeping the system eye-safe. The optics are also easier than the other two solutions. What is harder is that the laser source must work at both high power and high frequency. The detection circuit also has to work at higher frequency, which requires more from the amplifiers and also on the PCB design itself. 1.3 Overview of ToF As stated previously in section 1.1.1 the concept of time of flight is rather simple: send out a pulse of laser light and measure the time until the light pulse returns. The concept might be easy, but the details are tricky. The conceptual system design overview is shown in figure 4. 11 Figure 4: Overview of the ToF system A microcontroller decides when to start measuring. It sends two carefully timed pulses: a control pulse to the laser driver and a start pulse to the TDC. The laser driver controls a laser source, which starts emitting light. The light may not be a perfect beam, depending on the laser type, so some laser optics are probably needed to shape the laser light into a nice beam and send it to an object. The target object reflects the light diffusively. The reflected light hits a lens which focuses the light into a detector. This signal is very weak, so a signal amplifying and conditioning circuit is needed. This circuit converts the weak signal from the photo-detector into a logic signal sent into the TDC, which stops the time measurement. The microcontroller reads the data from the TDC and performs some post-processing (such as filtering). This completes a full measurement cycle. 2 Development procedures During the development, the main considerations when it came to choosing components were avail- ability and price. The components had to be available to more or less anyone and the total bud- get must not be exceeded. This limited the choice of components, but also simplified the design procedure. Instead of calculating a theoretically ideal component, a search on major electronics distributors (such as Mouser, Farnell, Digi-key and RS-components) was made and some candidate component was selected. The components were then tested theoretically against the criteria on the component (based on information from the manufacturer) to check which would perform the best. These sources were also used to check the availability of components: If it couldn’t be found at any of these suppliers, it probably didn’t exist in the allowed price range. Also, more specialized suppliers and manufacturers (such as Edmund Optics, Thor Labs and Laser Components) were inquired to check the availability and price of some components. Since these companies are more specialized, components are often much more expensive, but a larger selection of special components is available. 12 2.1 Transmitter design 2.1.1 Laser type To keep prices low, a common type of laser should be used. It is also important that the laser can supply high power in short pulses, since this gives the receiver a stronger return signal to work with. There are many types of laser sources available that can fulfil the requirements for this application. There are however only two types of laser sources which can reasonably be used, based mostly on how common they are and their usual size: solid state lasers and diode lasers (also called semiconductor lasers). Solid state lasers use a crystal as a lasing medium and two reflecting mirrors. They are powered optically from a diode laser or a flash-lamp. This structure makes them hard to control since it requires an understanding of the specific laser crystal’s characteristics, but if properly controlled could most likely work. However they are likely to be very expensive unless one could find a pre-assembled module, especially if a specific wavelength is required (for example if a good sensor sensitive to a specific wavelength is found). Diode lasers use a Gallium Arsenide (GaAs) structure as a gain medium and is powered directly with electrical current making them easy to control and supply power to. They are quite cheap, which is a major motivation to choose them as well as the small size, which is also preferable in this application. They do however deliver a beam quality that is inferior to the solid state lasers and require a lens to function as a laser beam. It was was decided that a laser diode would be used based on their price and ease of use. However there are several subtypes of laser diodes, the most significant ones being edge emitting laser diodes and Vertical-cavity surface-emitting laser (VCSEL) diodes. Edge emitting laser diodes are cheap and easy to manufacture but they produce an elliptical beam rather than a round beam. They are also easily scalable in terms of output power by simply stacking parallel diodes in the same package. VCSEL diodes are surface emitting diodes that use a quantum well design to produce a round laser beam. They can be tested before mounting, making them theoretically cheap. However, at the time of writing they are still being researched and are therefore not very widely available making them expensive. Edge emitting laser diodes were chosen since minimizing cost was one of the main foci of this project. Using this kind of laser diode also gives a larger freedom while choosing the laser parameters, due to the commonness of this laser type. 2.1.2 Laser wavelength The wavelength of the laser is an important property. Mainly, three different wavelength regions was considered: around 650 nm (visible red), 850-950 nm (near IR), 1550 nm (IR). All these wavelengths are rather standard wavelengths with different properties. 13 650 nm Light of this wavelength is visible without using any extra equipment. There will be dot (or line for a rotating system) on the target visible to the naked eye, which gives a great advantage during development, but the end user might not view this as an advantage. One problem is that narrow-band detectors are not very common for this wavelength. Furthermore, the laser diodes usually don’t come in pulsed power specification, but rather only with constant power (and this means low power perhaps up to 100 mW). 850-950 nm The advantage of this region is that it is very commonly used, which means that there are lots of lasers and detectors to choose from in this region. Pulsed lasers are very common in this region, since many communication systems operate here. The fact that this wavelength region is common may also be a disadvantage since it means that many other applications also use these wavelengths which means that there probably is lots of noise in this part of the spectrum. Another disadvantage is that this wavelength region is especially dangerous for the eyes. These wavelengths are focused by the human eye and are invisible to the eye, which means that a person or animal hit by this, will not blink away. One good thing with this region is that detectors for this region can be made from silicon, which are generally cheaper than for example GaAs-based photo-detectors[10, 11]. 1550 nm This is also a rather common wavelength in communication. The biggest advantage with this wavelength is that it is not focused by the human eye, making it very eye safe. Due to this, almost any amount of output power can be emitted, as long as the laser diode can handle it. Since this wavelength region is not as common as the other two regions, the cost is much greater. One reason for this might be that this wavelength cannot be easily achieved using laser diodes made using standard semiconductor techniques. Another downside is that detectors at this wavelength are rather uncommon and expensive, since they cannot be made from silicon[10]. The most reasonable wavelength to use is around 850-950 nm. The commonness of both lasers and detectors allows for a choice of better performance at the same price and allows for a wide variety of choices, despite the fact that it’s the most "crowded" window and the possible eye hazard. Due to the eye-hazard, the output power has to be limited more compared to the other two considered regions. Taking all these parameters into account a laser diode can now be selected. The one that was chosen was SPL PL90_0 from OSRAM, as it has the correct wavelength, a high output power, is designed for pulsed operation and is available at a rather low price.[12] 2.1.3 Laser safety Since lasers can be harmful to the human body, particularly the eyes, it is necessary to calculate which laser pulses are harmful and which are not. A stronger laser pulse will give a stronger reflected pulse which is desirable since at longer distances this returned pulse will be very weak. The maximum safe laser power should be calculated to allow a pulse as powerful as possible while still having it remain eye-safe. Allowed laser radiation is determined by the guidelines set by the IEC 60825 standard developed by International Electrotechnical Commission (IEC)[13]. The allowed output power is always calculated in a worst-case scenario, which means that for this application, it is assumed that a user is standing and looking straight into the laser for an extended period of time, without turning away or blinking. Even if the system rotates, the worst case is still the same since the rotation might somehow stop. When calculating the Maximum permissible exposure (MPE) for laser light, three cases are considered: single pulse, average energy and pulse train. The key factors 14 here are the wavelength (λ), the pulse length (tp), the pulse repetition frequency (frep = 1 Trep ) and the total exposure time (Texp). The wavelength is set to 900 nm, the total exposure time is set to a long time (about 30 s) as a worst case scenario2. A pulse repetition frequency of about 10 kHz is needed, as this will enable roughly 3 measurements per degree if spinning, and have more than enough to do a very stable single-point measurement. The chosen laser diode is limited in both pulse length and duty cycle to prevent it from taking damage due to overheating. The maximum allowed pulse duty cycle is 0.1 %, due to limitations of the laser diode. This means that if the whole period is 1 frep = 100 µs, then the allowed pulse is 100 ns with respect to laser diode. Given these values, a maximum allowed output power can be calculated using the IEC 60825. A laser can be harmful in several ways to the human body and the dangers varies from wavelength to wavelength. At λ ≈ 900 nm the main danger is to the eyes. This is because the laser light can be focused by the eyes’ own lens onto small spots on the retina where it can cause damage. Another reason this wavelength is very dangerous to the eyes is that it is not visible to the naked eye and will therefore not prompt any blink reflex. Given a laser strong enough, the skin may also be burnt. For a skin burn, a very high output power is needed, so only the eye-damage case will be considered. To be safe, three criteria must be met: • MPEsingle - The exposure from a single pulse must not exceed MPE. • MPEavg - The exposure for a pulse train of a certain exposure duration, Texp, should not exceed MPE. • MPEtrain - The average exposure from a pulse train should not exceed MPE for a single pulse (MPEsingle) corrected with the factor N−1/4, where N is the number of pulses in the pulse train during the exposure time, Texp. All MPE used are calculated using "Table 4 - MPE for eye regarding thermal and micro-mechanical retinal damage risk" in IEC 60825. The exposure time is set to between T2 and 3 ∗ 104 s, where T2 = 10 s since the angular subtense, α is less than 1.5 mrad. α is assumed to be ≈ 0, since in a worst case, the victim is looking straight into the beam. Furthermore, the pupil size is estimated to a standard 7 mm diameter in a worst case scenario. First, the irradiance at the eye for a single pulse is calculated as shown in equation 10: Ee,single = Pout π ∗ (D/2)2 (10) where Ee,single is the irradiance for a single pulse at the cornea, Pout is the output power and D is the aperture diameter (the pupil). This is multiplied by the pulse time (tp) and compared to MPEsingle. MPEsingle is calculated using equation 11 valid when 10−9 < tp < 1.8 ∗ 10−5. MPEsingle = 5 ∗ 10−3 ∗ C4 ∗ C6 (11) where C4 and C6 are parameters determined by wavelength and α. C4 = 100.002∗(λ−700) where λ is in nm and C6 = 1 for α < 1.5 mrad. Given λ = 905 nm, C4 = 2.57. Finally, if Ee,single ∗ tp < MPEsingle, it is considered safe with respect to single pulses. 2The correct way to do this is to assume an exposure time of a whole work day, which is defined as 8 hours. This seems very unreasonable, so a shorter, more reasonable time is used instead 15 The average exposure is determined in the same way, but using another formula for MPEavg and another way of calculating the power. All these are calculated using equations 12-14. MPEavg = 10 ∗ C4 (12) Pavg = Pout ∗ tp ∗ frep (13) Ee,avg = Pavg π ∗ (D/2)2 (14) where C4 is the same as for the single pulse calculation, Pavg is the average output power and Ee,avg is the average irradiance at the eye. Note that MPEavg has the unit W/m2, due to the long exposure time. It should therefore be compared to Ee,avg directly, without multiplying it by tp. Finally, MPEtrain is calculated from MPEsingle using equation 15. MPEtrain = MPEsingle ∗ N−1/4 (15) where N is the number pulses in the pulse train. MPEtrain is compared to Ee,single ∗ tp in the same way as for MPEsingle. Using equations 10-15 and iterating the output power until all three criteria are met, it was de- termined that using the parameters tp = 100 ns, frep = 10 kHz and Texp = 30 s the maximum allowable output power Pmax = 210 mW . If the detector is fast enough, a shorter pulse can be used, which means that a higher output power can be used. Therefore, to optimize output power, the pulse should be just long enough for the detector to be able to detect it, while taking into account the rise time of the laser diode and the limitations of the control hardware. After some testing, it was found that such very short rise times and pulse times could not be achieved reli- ably. The shortest pulse that could be achieved with good result was 60 ns. This would give a Pmax = 350 mW . Using some further tweaking, such as lowering the pulse length further and decreasing the repetition frequency, the output power can be increased even further. The final limit is the limitation of the laser diode. Since the chosen laser diode can output a maximum of 4 W at tp = 100 ns, frep = 10 kHz, this laser diode should be more than enough. 2.1.4 Laser driver A laser diode is current controlled. This means that the output power is controlled by current, rather than voltage. Once the current exceeds the threshold current the diode starts to emit light more or less linearly (output power varies linearly in relation to the current). Since laser diodes often operates at a high frequency, standard control techniques such as Pulse width modulation (PWM) cannot be used to control the output power. Furthermore, feedback from the light is often needed since the output efficiency (the amount of optical watts out per ampere in) decreases as the laser diode increases in temperature [14]. This is more important for a laser diodes operating in continuous mode than a laser diode operating in pulsed mode. Since the pulse is so short, the output power does not change much over time, since the laser has time to cool off between pulses. Therefore, it is for this project assumed that a certain current will always correspond to a certain output power. Even if it does not, it really does not matter, since it is not important that the output power is precise. The current is controlled through a programmable resistor and a pulse transistor. Since commercially available programmable resistors are both slow and has high resistance (the smallest in the range of 1 kΩ), a custom solution was designed using 8 Metal-oxide-semiconductor field-effect transistors (MOSFETs) and resistors coupled in parallel as seen in figure 5. 16 Figure 5: The schematics of the laser driver circuit. At the top is a capacitor bank to provide the laser with lots of instant energy to allow for very fast and strong pulses. Below is a single MOSFET to control the pulse and 8 MOSFETs with resistors to control the output power. Finally, a threshold resistor is coupled in parallel with the rest of the programmable resistor to always achieve the smallest amount of current which makes the diode laser. The resistor values shown are calculated using the MATLAB script found in appendix 8.2.1. These 8 MOSFETs are set prior to the firing of a pulse, to ensure that these rise times do not affect the rise times of the laser. In parallel with the programmable resistor there is a set resistance to get ensure that the current passing through the diode is always just below the threshold current of the laser. The threshold resistance consists of several resistors, beacuse the power dissipation is too great to handle in a single resistor. These 8 resistors + the parallel threshold resistor gives a total of 28 = 256 different power settings. The pulse itself is controlled by a single MOSFET of a faster type. A first design had these threshold resistors (controlled by a separate MOSFET) in parallel with the pulse MOSFET and the programmable resistor to keep the laser constantly just below threshold level to decrease rise times. This did not work very well, since this constant current drained the capacitor bank. It did not decrease the rise time noticeably. The resistance value corresponding to an output current can be calculated with the knowledge of the driving voltage, the voltage drop over the laser diode and Ohm’s law as follows: I = (Udrive − Uf ) R (16) where I is the current in A, Udrive is the driving voltage (which in this case is 5 V), Uf is the forward voltage drop of the laser diode and R is the resistance. The trouble here is that Uf changes with increasing current. This makes the calculation a little more tricky. The laser datasheet[12] specifies how Uf and output power (Pout) varies with I. The graph can be approximated by straight lines in two ranges: one are where I<1 A and one where I>1 A. However, in the case of I<1 A, it not reliable to look below I=0.3 A, since this is the threshold current of the laser. Therefore, the lower range will be valid only when 0.3 A1A in the range where I>1 A can be determined by using the points [4, 6.5] and [3, 3]. This gives kIU>1A = 0.29. The offset can also be determined in the same way as before, which gives mIU,>1A = 2.13. Pout can be related to I using a straight line valid in the whole range where I>0.3 A. kP I = P2 − P1 I2 − I1 [W/A] (19) Using the same method as before, the following points on the form [P,I] are selected: [0.8, 1] and [5, 6]. This gives kP I = 0.84. Next, the offset is determined in the same way as before, which gives mP I ≈ 0. A more correct approximation of mP I would be −Ith ∗kpi = −0.25 since this is the output power if I = 0. Finally, combining equations 16-19 gives equation 20 which relates Pout to R: R = Udrive − ((Pout − mP I)/kP I) ∗ kIU + mIU ) (Pout − mP I)/kP I (20) where kIU and mIU should be used with the range specific values. Also, to get which R to set given a specific Pout, equation 20 needs to be solved for Pout, which gives equation 21: Pout = kP I ∗ (Udrive − mIU ) R + kIU + mP I (21) Since the resistance is set using 8 paralleled resistances, one more conversion is necessary before the power can be easily set using software. No closed-form equation was formed for this purpose. Instead, a look-up table was generated using a MATLAB-script (found in appendix 8.2.1). It maps a power output between in the range [0-255] to the eight resistors, whose configuration is represented by an 8-bit binary number. The resistances used were obtained using this script and are shown in figure 5. Due to the nature of paralleled resistors, this mapping is non-linear, which means that for high resistance, the resolution is low and vice versa for low resistance. However, due to the nature of the model, this is not true for the output power. As shown in figure 6, the transfer from programmed value to output power is more or less linear (but with a small discontinuity at the place where the model switches from low current to high current). 18 0 50 100 150 200 250 300 −0.5 0 0.5 1 1.5 2 2.5 3 Power setting P ow er (W ) Theoretical output power Figure 6: Theoretical output power of the laser corresponding to the programmed value. As can be seen, its more or less linear, and not as non-linear as only the combined resistance. 2.1.5 Laser optics Laser diodes do not directly emit a laser beam, rather they emit light in an elliptical cone. This cone must be collimated into a beam to be useful as a laser beam. This can be done by using a collimation lens, which can be any lens placed at its focal distance in front of the diode. This collimation can be described mathematically by the equation 23[15] where y1 and y2 is the beam width before and after collimation respectively, θ1 and θ2 is the divergence angle of the beam and finally f is the focal length of the lens. It is also illustrated in figure 7. y2 = θ1f (22) θ2 = y1/f (23) Figure 7: Illustrates collimation of a laser beam. It shows how the divergence angle of the laser beam is decreased, while increasing the beam width. As can be seen in figure 7 any reduction in divergence angle will also have the added effect of increasing the beam width with the same factor. So a laser diode with a collimation lens with a focal length of 4 mm and a diode size in the 40 µm will increase the beam width by a factor of 100 19 and reduce the divergence angle by 100. As edge-emitting laser diodes emit light in an elliptical cone they have two different divergence angles. The chosen laser diode has divergence half-angles of θ∥ = 25 degrees and θ⊥ = 9 degrees in perpendicular axes[12]. This has been roughly verified as can be seen in the figure 8. The figure primarily illustrates the 25 degree divergence half-angle. Figure 8: A photo of the light emitted from the laser diode without any collimation lens. The light is projected onto a cm grid reference from a distance of 20 cm This ellipticity can be remedied by using two cylindrical lenses (lenses which only affect the light in one axis), one for each axis, each with a focal distance dependent on the divergence angle of that axis in sequence. It is also possible to use a lens with two cylindrical surfaces, one on each side, in perpendicular axis to perform the same task. A single basic lens costs around e15-25, making using even a single lens expensive considering the budget of the project. Cylindrical lenses even more expensive, in the order of e35-45 each and two of those are needed to fully compensate for the elliptical beam. A custom-made combined lens would likely be several times the total budget of the entire project. The cost aspect makes it hard to include any compensation for the elliptical beam in the design. The idea was raised to use an existing lens scavenged from somewhere, as most cheap laser-pointers also uses the same type of laser diode. A laser pointer[16] was found that had a similar lens to what was needed. However, it is not a perfect fit. The lens from the laser pointer is adapted for the divergence angle of the laser diode from the laser pointer and it differs from the chosen laser diode. There is also a difference in wavelength. The lens’s focal length and parameters in general are unknown. It should however be possible find a supplier of a more suitable lens at a reasonable price, since these are very common in laser pointers, and they are quite cheap. Since there was no time to find a lens with a perfect fit, the lens from the laser pointer was used and manually adjusted to allow the transmitter to produce a reasonably focused beam with reasonable beam width and divergence angle as can be seen in figure 9. 20 (a) 5 m (b) 3 m (c) 1 m (d) 0.5 m Figure 9: Images of the reflected laser after the collimation lens at different distances. A metric ruler is used as size reference The divergence half-angle can easily be calculated based on the images in figure 9 using a right- angled triangle as shown in equation 24. θ = arctan((y/2)/L) (24) where θ is the divergence half-angle, y is the total observable width of the laser dot and L is the distance from the source. Using equation 24 and the images in figure 9, θ was found to be about 0.5°. 2.2 Receiver design The receiver consists of four parts: an optical amplification assembly, a light detector, a signal amplifier and a sampling circuit (which measures time). The optical assembly gathers the light and focuses it into the detector. The detector receives the light and converts it into an electrical current that is amplified by the signal amplifier up to a level that the sampling circuit can detect. The design of these parts is discussed in sections 2.2.2 to 2.2.4. To be able to design the receiver, it is 21 necessary to first determine the amount of light the receiver is expected to receive. This is discussed in section 2.2.1. 2.2.1 Diffuse reflection When the laser hits a non-reflective surface a portion of the beam will be absorbed into the material. However the remaining portion will be diffusely reflected, meaning the beam will be scattered and reflected in all directions. This scattering can be roughly modelled as the Lambertian model for diffuse reflections [17]. By approximating the light on the reflecting surface as a point, the light intensity emitting out from the surface can be modelled as a sphere where the diameter is the distance from the reflection at the surface to the receiver. The surface area of the sphere corresponds to the total light power reflected. From the surface with a certain area, a certain power is reflected. This power is then viewed at a solid angle based on the size of the viewing aperture and the distance from the reflecting surface and the receiver. The light intensity at the observer is changed based on the viewing angle, which is the main basis for the Lambertian model. This means that the power intensity of the light is given by equation 25 Pin = Le ∗ dΩobs ∗ Asource ∗ cos(θ) (25) where Pin is the light power intensity at the receiver, Le is the radiance, dΩobs is the solid angle of the observer, Asource is the area of the reflection and θ is the angle of the observer (with respect to the neutral angle from the reflecting surface). The radiance can be calculated as show in equations 26 and 27 Le = Me/π (26) Me = ρ ∗ Pout/Asource (27) where, Me is the radiant emittance from the reflection, ρ is the reflectance of the surface and Pout is the output power of the laser. Furthermore, the solid angle is defined as shown in equation 28 dΩ = Adet L2 (28) where L is the distance from the reflection to the receiver and Adet = r2 det ∗ π is the area of the receiver. Finally, equations 25-28 can be used to form equation 29 which relates Pin to Pout. Pin = Pout ∗ ρ ∗ r2 det ∗ π2 ∗ cos(θ) L2 (29) As shown in equation 29, the size of the laser spot does not matter. The only thing that the size of the laser spot affects is how hard it is to make the reflection hit the receiver and the uncertainty of the exact measurement point. Inserting values into equation 29 a factor between Pout and Pin can be calculated. ρ is very hard to predict, since different materials and colourings may have any reflectivity between 0 and 1. Good data on this was surprisingly hard to find, so a reflectance of something in between the extremes, say 0.5, is assumed. Since the distance is going to be much larger than the offset between the laser source and the center of the receiver, the angle θ is going to be very small, which means that cos(θ) ≈ 1 and can mostly be omitted. However, θ will be significant if the surface is angled from the LIDAR. This case will not be considered, to simplify the development process. Therefore, for the purpose of determining the input power, cos(θ) will be omitted. Using these values and L as the maximum measure distance (L = Lmax = 5 m, as stated in table 1) the power intensity that hits the receiver can be reduced to as Pin = Pout ∗ r2 det ∗ 0.20. 22 Since the size of the detector will be small (a fast photo-detector has an area of about 1 mm2) the input power to the electrical system will be very small. Therefore, an optical amplification is necessary before the photo-detector. 2.2.2 Receiver optics Optics are needed to focus the returning light onto the detector. All the light gathered does not have to be focused on the detector all the time, just a sufficient amount to trigger a response from the detector. This means that at a short measurement distance the beams can energetic enough to satisfy that condition with only a smaller portion of the reflected light. The general set-up is illustrated in figure 10 Figure 10: An overview of the optical part of the receiver. The scenario is similar to the triangulation case discussed in section 1.1.2. In this case however, the goal is for the focused light to hit the same spot no matter the angle of the incoming light. This is so that the light can be maintained on the detector regardless of the angle of the incoming light. This is easier the smaller the angle of the incoming light is. If the angle is too great, the light will likely miss the detector altogether. This is what primarily defines the minimum measurement distance. The angle of the light is determined by the relative size between L and the distance between the laser and the center of the lens (m+R/2). Thus, the further away an object is the smaller the angle of the incoming light is. The angle can however be compensated for in several ways. For example tilting the lens towards the reflective surface is one method which would also reduce the maximum distance that can be measured. Another option for adjusting the minimum measurement distance would be to reduce the distance between the lens and the transmitter m or the lens diameter R. More advanced set-ups include for example firing the laser through a hole in the detector lens, effectively removing most of the offset. When using this method one has to be careful not to cause a direct reflection inside of the lens. This however would be hard in terms of manufacturing, as it could also be very hard to isolate the outgoing beam from the lens, since only a small amount of stray light might trigger the sensor since the detector has to be very sensitive. Another method is to use a beam splitter, making it possible to eliminate the offset altogether by splitting the beam and using the same path both for transmitting and receiving light. One of them does however cost more than the entire budget[18], making them unreasonable for this application. Other than that, there would also be the downside of the splitting factor of the beam splitter reducing both output power and the amount of returned light. The reduction in output power could however be dealt with by simply increasing the output power until the intended power is reached on the other side of the beam splitter. The only realistic option considering the budget of this project is to use a single lens to focus the beam. As illustrated in figure 10, the size of the lens will change the offset between the laser source and the center of the lens. 23 When choosing a lens many of the parameters of the system must be taken into account. In this case, the most important are the size of the detector, the minimum measurement distance and the offset between the laser source and the lens center. As shown in figure 9 the laser beam has a width. This means that each point in the surface area the laser hits will emit light in all directions, making it harder to model using ray tracing techniques since there will be an infinite number of points emitting light in an infinite number of directions. One way to model this system is in the same way as imaging of a camera is modelled, as can be seen in figure 11. y1 in the figure should be considered as the offset of the laser source. Figure 11: How an object is imaged on the detector side through the lens. Equation 30 shows an approximation of the relationships between the important parameters using the imaging model. [15]. y2 = y1 ∗ θ1 θ2 = y1 ∗ R s1 ∗ f R (30) This equation is derived from a property of lens systems called the optical invariant [19]. This means that in any optical system consisting of only lenses, the product of the image size and ray angle is always a constant, which is called the optical invariant as shown in equation 32. Combined with an approximation of θ2 as θ2 = R/f , based on the the Gaussian lens formula [20] shown in equation 31 and the fact that if s1 is very large, s2 will be close to f . 1 f = 1 s1 + 1 s2 (31) y2 ∗ θ2 = y1 ∗ θ1 (32) Looking at equation 30 one can see that to focus on a small spot one would want to minimize y2. This can be done by increasing s1, which would mean moving away from the source. This is not possible since we want to measure the distance to the source, and therefore cannot control the s1. It can also be done by reducing the lens size, reducing the received power quadratically due to the reduction of the receiving surface. However another thing to consider is that if the lens size is reduced, the offset between the laser and the lens center is reduced, decreasing the minimum measurement distance. A large lens will also force a longer focal length, due to the fact that it is difficult to create a lens with a shorter focus distance than radius. This will in turn limit how tightly the returning light can be focused. 24 Based on this, a lens candidate was chosen for further investigation and simulation. The lens chosen was the largest lens with the shortest focal distance possible satisfying the minimum measurement distance criteria defined in table 1. Using a lens this small may have limited the optical amplification, but it was necessary due to the size of the detector discussed in section 2.2.3 and the results shown in figure 12. The lens had 25 mm diameter, 25 mm focal length and cost e30 [21]. The thin lens equation [22] can give a rough estimation of where the focused light will hit and can be used to track the beam when it passes through key points. To be able to estimate the reflected power and its distribution at the focus requires a more exact method. Using the thick lens formula via the so called refraction matrix it is possible to track all beam paths through the system. This was done using a workbench in MATLAB [23] with the parameters of the real system as inputs, such as lens properties, placement and so on. By tracing a very large number of rays emitted from a random location from target surface with a random vector that intersects the lens a good simulation of the reflected light was obtained. The results for various distances can be seen in figure 12. The chosen placement of the detector (which is further discussed in section 2.2.33) is shown by the red rectangle, which is 1x1 mm, and the white lines indicate the lens’s optical axis and the entire image spans 5 mm. (a) 5 m (b) 3 m (c) 1 m (d) 0.5 m Figure 12: MATLAB simulations of the reflected laser light after the focusing lens. These simulation were performed using an optical workbench for MATLAB [23]. Each of these images are generated using 100 000 rays where each ray has the following properties: a random point of origin (on the radiant surface), a random direction and that hits the lens. Using this simulation, a factor between the light that hits the lens and the light that is focused into 3Due to the development procedures not being linear, the detector was already more or less chosen during this stage of development. At least the detector size was assumed, based on the detector chosen and since it is a usual size for photo-detectors. 25 the detector can be estimated. With this information, an optimal placement of the detector can be determined to maximize the return signal over the whole measurement range. Using the decrease factor calculated from equation 29 the optical power that hits the lens can be calculated. Based on this and the results obtained form the simulations shown in figure 12 the worst case for light power that reach the photo-diode can be calculated. It was found that the worst case is at 5 m distance, which means that almost all light that hits the lens also hits the detector (given optimal placement). This means that the detector receives, given laser output power of 300 mW, Pin,det = 9.25 µW . 2.2.3 Detector The signal detector circuit consists of two main parts: a light detector and a signal amplifier. The detector has to be fast and be able to detect very weak signals. These two criteria contradict each other, as further discussed in this section. It is not possible to increase the speed and the signal amplitude at the same time (there is no free lunch). The approach will therefore be to find the fastest photo-detector available (at a reasonable price) and amplify the signal using the fastest amplifiers available. Once again, components used for optical communication are considered. Photo-detectors are gen- erally divided into two main areas: photo-diodes and photo-transistors. Photo-transistors are gen- erally slower (rise times in the range of a couple of µs [24]) but do have some internal gain (as an inherent feature of being a transistor). However, with a signal shorter than 100 ns, these are not considered at all. This leaves photo-diodes. The main types of photo-diodes considered are p-n photo-diodes, PIN photo-diodes and Avalanche Photo-diode (APD)s. APDs are in theory well- suited for this application since they are extremely fast and have high internal signal gain. In practice they are not well suited mainly for two reasons: the price (they cost at least e50 a piece [25]) and the fact that they need high voltages to operate (in the range of 100-200 V [26]). PIN photo-diodes is just a special case of normal p-n photo-diodes, but faster, so the only type that will be further considered is PIN photo-diodes. First of all, the diode needs to be sensitive to the wavelength emitted by the laser. Since the laser light is of a standard wavelength (around 900 nm), a photo-diode to match that wavelength should be chosen. Furthermore, some photo-diodes have a shield to block out other wavelengths than the wanted one. This is of course desirable, since it will increase immunity towards random disturbances from surrounding light sources. Photo-diode noise Next, the question "Will the photo-diode be able to detect the signal?" has to be answered. Noise in a circuit will come from many sources, such as the photo-diode itself, resistors, amplifiers etc. All these sources need to be weighed together to form a total noise. This is generally done as shown in equation 33[27]. Etot,rms = sqrtE2 1r,ms + E2 2,rms + ...E2 n,rms (33) However, as a rule-of-thumb, if a noise source is much smaller than the largest, it is generally neglected. A photo-diode can be used mainly in two modes in a detection circuit: Photovoltaic mode and Photoconductive mode. Since the photoconductive mode (also called reverse bias mode) offers much faster response times [28], this is the only mode considered. Further considerations include the noise level. Manufacturers often use a figure of merit called Detection Limit or Specific Detection (abbreviated as D∗). It is used to compare photo-diodes, but its usefulness is rather limited. Instead, what should be used is the Noise-equivalent power (NEP), which is the amount of light input power 26 needed to get an Signal-to-noise ratio (SNR) of 1. When a manufacturer specifies NEP, it is almost always normalized to 1 Hz. To get the SNR, the input power is compared to the NEP. The NEP should not only consist of the NEP for the photo-diode, but also the amplifier circuit (since the whole circuit will generate noise, and NEP of a photo-diode is the noise it generates). To choose the photo-diode, only the noise of the photo-diode and noise from any load resistor will need to be considered. To compare the input signal (at a certain power and with a certain pulse width) it needs to be normalized as well. First, the bandwidth of signal needs to be determined. The bandwidth of the signal is very hard to define in theory, since an ideal signal would be a strict square pulse, which would have infinite bandwidth. There are several ways to define the bandwidth. One way is to use the rise time using a rule-of-thumb as shown in equation 34 to define a bandwidth.[29, 30]. fc,3dB ≈ 0.35 tr (34) where tr is the rise time of the system and fc,3dB is the 3dB cut off frequency usually used to define the bandwidth of a system [31]. Of course, the rise time has to be as small as possible to get a response as clear as possible, which means that an ideal signal would have an infinite bandwidth. The other way is to approximate the pulse as a sine wave with a period of 2tp and calculate a frequency from that, as shown in equation 35. This will give a lower limit of the bandwidth (the "fundamental frequency" so to speak). fc,3dB = 1 2 ∗ tp (35) None of these methods are optimal to determine the bandwidth. The best way is to perform a Fourier Transform on the real signal to examine the frequency content. This however, is not feasible in the design phase of the project, so only theoretical calculations based on assumptions were performed as design aid. The bandwidth is calculated by the difference between the highest frequency content and the lowest as shown in equation 36. ∆f = fhigh − flow (36) where ∆f is the bandwidth and fhigh and flow are the highest on lowest frequencies respectively. The bandwidth is used to normalize the input power to form (PinNorm) which is calculated in equation 37. Because the signal increases by the decreasing bandwidth and the noise by the root of the bandwidth, the square root of the bandwidth is used. PinNorm = Pin√ ∆f (37) Finally, the SNR is calculated by comparing the PinNorm to NEP, as in equation 38. SNR = PinNorm NEP (38) SNR has to be at least one for the system to be able to detect the signal at all, but should of course be as high as possible. 27 Rise time The chosen operation of the photo-diode is, as mentioned before, reverse biased (pho- toconductive) mode. A photo-diode generates a current proportional to the incident light power. This current is then transformed into a voltage using a load resistor connected to ground, and the signal is read as the voltage drop over the resistor, which is, according to Ohm’s law: U=R*I. This, together with the amplifier discussed in section 2.2.4, makes a so called transimpedance amplifier, which converts the current to a voltage to amplify it further. This is the usual approach for high- speed photo-diodes[32]. As seen clearly from Ohm’s law, the amplitude of the output signal will increase with a larger load resistor. However, the rise time of the signal increases as the resistance increases. This is because the rise time of a photo-diode is determined by a time constant defined by three factors[28, 29, 33]: tRC : RC-constant, which is determined by the terminal capacitance and the series resistance (ex- ternal resistance + internal resistance). It is determined by equation 39. tRC = 2.2 ∗ Ct ∗ Rl. (39) where Ct is the terminal capacitance and Rl is the load resistance. Included in Ct are also stray capacitances from the other components in the circuit, such as resistors, the amplifier and the Printed Circuit Board (PCB). tDrift : Carrier transit time in the depletion layer. It is proportional to the width of the distance of the depletion layer, which can be influenced by applying more reverse voltage. tDiff : Diffusion time, the time it takes for carriers generated outside of the depletion layer to diffuse. These together form tr as stated in equation 40 tr = sqrt(t2 RC + t2 Drift + t2 Diff ) (40) It is once again shown that there is no free lunch (specifically from tRC). It is impossible to get a strong and fast signal at the same time from the photo-diode and load resistor alone. The method chosen here is to optimize the rise time and to fix the small signal with an amplification circuit, where more energy can be put into the signal. Mainly, tRC is going to be minimized since the other parameters are hard to influence. tDrift can be influenced somewhat by increasing the reverse bias voltage, but is together with tDiff mostly influenced by the design of the photo-diode itself. The main effort will be to use a small load resistor and to layout the board in such a way as to minimize stray capacitances. The load resistor could be chosen as 50 Ω, since this is a standard value for impedance in high speed communications. Usually, most detectors, amplifiers and other equipment are optimized for 50 Ω impedance, and it is important to make sure that the impedance is matched across the whole signal path to avoid reflections when the impedance changes. Furthermore, a higher reverse voltage will also decrease the capacitance, so a voltage as high as possible should be used here. This might be problematic, since this voltage would have to be supplied, which could be challenging. Photo-diode selection The photo-diode chosen was the sfh203p from OSRAM[34]. This is a fast and cheap photo-diode used for optical communications. The detector size is 1x1 mm, which is a small detector. The top sensitivity is at λ = 900 nm and also features an optical shield with a rather narrow window (attenuates about half the amplitude at ±∆λ100 nm and more or less total attenuation at ±∆λ150 nm). At this wavelength, the spectral sensitivity (which specifies the current generated by the photo-diode in relation to the incident light power) is Sλ=900 nm ≈ 0.65, 28 which is rather standard for silicon photo-diodes. The manufacturer specifies a rise time of 5 ns, which only applies under certain conditions which will never happen. Given some more information (such as information about tDrift and tDiff ), the rise time could be calculated, but this information is not available, so the manufacturer specified value will be used as a lower bound. This rise time will correspond to the highest frequency of the signal from the photo-diode according to equation 34. This gives thigh = 0.35/(5 ∗ 10−9) = 70 MHz. The lowest frequency from the photo-diode can be approximated using equation 35. This gives tlow = 1/(2 ∗ 100 ∗ 10−9) = 5 MHz. These two give, according to equation 36, ∆f = 70 − 5 = 65 MHz. This bandwidth is what the manufacturer specifies as the rise time of the photo-diode. However, the amplifier design (as discussed in section 2.2.4) is aimed at amplifying the signal quicker than the rise time of the photo-diode, thus creating a shorter rise time, which will effectively create a higher bandwidth. Furthermore, when it comes to noise, it is the bandwidth of the amplifiers that matters, since the noise is amplified at their bandwidth, disregarding the bandwidth of the signal. As discussed in section 2.2.1, the optical power hitting the detector is Pin,det = 9.25 µW in the worst case (at the maximum distance). This means that current generated by the photo-diode will be Idiode = Pin,det ∗ Sλ=900 nm = 6 µA. This current will generate a voltage over the load resistor according to Ohm’s law: Url = Idiode ∗ Rl = 300 µV . Using the bandwidth and the input power, the SNR of the photo-diode itself can be calculated using equations 37 and 38 as shown in equation 42. Pin,norm = 9.25 ∗ 10−6 √ 6.5 ∗ 107 ≈ 1.15 ∗ 10−9 (41) SNR = 1.15 ∗ 10−9 2.9 ∗ 10−14 ≈ 4.0 ∗ 104 (42) Equation 42 gives an SNR of 40 000, which is way more than sufficient. The noise from the photo- diode will not be considered any further. The load resistor also generates noise dependant on the bandwidth. However, as mentioned before, it is the bandwidth of the amplifier that matters. This noise will therefore be calculated in section 2.2.4. External light noise may present a problem to the detector. The amplitude of the source is unknown, but can be measured in the system (both during testing but also during operation). This noise source is countered by several measures: The photo-diode has a light-blocking shield (as mentioned before) which blocks most ambient light sources of incorrect wavelengths. Furthermore, since the system mainly works in high frequencies, it means that constant external light sources will not be trigger a signal, since the amplifier and conditional circuits only allows signals of the correct bandwidth. Finally, using a comparator (as discussed in section 2.2.4) will allow for dynamic setting of the trigger level to make sure that the system is robust against external light noise. 2.2.4 Signal amplifier To amplify the returned signal is a difficult task. The very weak return signal has to be amplified greatly during a short time at a high frequency. This puts many difficult, if not maybe impossible, requirements on the amplifier. Two main methods were investigated to solve this problem: using Operational Amplifiers (OP-amps) and using RF-amplifiers. 29 OP-amps configured as a transimpedance amplifiers were the first type of amplifier method in- vestigated. This amplifier converts the current through the receiver photo-diode into a voltage (as mentioned in section 2.2.3). The bandwidth of the signal is, as shown in section 2.2.3, very wide. It ranges from at least 10 MHz up to 1 GHz. Many operational amplifiers designed for frequencies in this region usually have only unity gain (a gain of 1 dB), which means they cannot actually amplify the signal. Because of this the selection of operational amplifiers is very limited. The selection criteria for the OP-amp was defined as "the fastest operational amplifier with gain at these high frequencies". Also a rise time of at most a couple of ns is necessary for a good measurement. The most important point is to get the same rise time for different input signal strengths. The signal has to be amplified from virtually 0 V up to 3.3 V before it can be used as an input to the timer circuit. Hence, the slew rate of the amplifier has to be sufficiently high. By using a comparator instead of an OP-amp, the slew rate can be increased substantially, since a comparator does not have a slew rate in the same sense as an operational amplifier.4 Using a comparator at the end, it is not necessary to use operational amplifiers to amplify the signal all the way up to 3.3 V. It is really only sufficient to amplify the signal to a level where a comparator can distinguish it from noise. Another advantage using a comparator is the fact that a threshold level can be set. This means that the sensitivity of the detector circuit can be set dynamically. Comparators typically have an input offset voltage of 10 mV and an input bias current of 1 µA[36] (which will generate an input voltage based on the resistance in the circuit, according to Ohm’s law). These constant offsets can be calibrated away by setting the reference threshold. This means that the signal in theory only needs to be amplified to get above the hysteresis (which is also usually around 10 mV) of the comparator. In practice, a signal much higher is preferred, due to both noise immunity and also since the comparator works better (faster and more predictable) the higher above the threshold the signal is. Therefore, the signal should be amplified as much as possible, even if about 100 mV would be sufficient. The input signal generated by the photo-diode would have to be amplified to about 100 mV. As mentioned in section 2.2.3, the input signal is about 300 µV at its weakest. This means that amplification of a factor more than 300 (which is equal to about 50 dB gain) is needed before the comparator. The number of OP-amp stages needed for this is determined by the chosen OP-amp. If the gain of one OP-amp is not enough, several sequential OP-amps is required. The OP-amp should be connected as a non-inverting amplifier (since negative supply voltage should be avoided because of the extra work and components needed for this) and gain as much as it can. The gain loop should also have a capacitor in series to make sure that there is no DC-gain. The OP-amp chosen is an OP-amp with 12 dB gain. This means that 4 OP-amps are needed before the comparator. For full schematic, please refer to figure 31 in the appendix. The exact values of the resistors and capacitors was determined through testing. OP-amp noise is something that was also considered. The SNR is never improved by simply amplifying the signal, since the noise is amplified equally. In fact, amplifiers worsen the SNR since all amplifiers introduce more noise. However, by constructing filters that match the wanted signal frequency, a large portion of noise can be filtered out. Only noise at the input of the first OP-amp will be considered, since the SNR won’t be affected much by subsequent amplifiers, due to the gain of the OP-amp, which will make the input noise from the first amplifier dominant. An OP-amp has several input noise sources. First of all, there are constant current and voltage input offsets. These 4An OP-amp needs to be stable, since it needs to recreate the signal at a specific amplification. To achieve this OP-amps have limited slew rates for stability. A comparator on the other hand only needs to output a high or a low signal, which means that stability is not a requirement here. This means that a comparator can have more or less infinite slew rate in theory.[35] 30 can be dealt with by using high-pass filters (to block away any DC as mentioned before) and by adjusting the threshold at the end comparator. But there are also another types of noise sources to consider, such as random frequency dependent input noise. There is both a random input current and a random input voltage. These need to be weighed into the total noise level and compared to the signal level. From the data sheet of the OP-amp[37], it is obtained that the input voltage noise is Uni = 2.6 nV/ √ Hz. Since the OP-amp has a bandwidth of about 200 MHz, this frequency is used to determine the input voltage noise, according to equation 43. The noise caused by the resistors in the OP-amp feedback loop will be omitted to keep complexity of noise calculations down, since those calculations are not within the scope of this project. vn,opv = Uni ∗ √ ∆fopamp = 2.6 ∗ 10−9 ∗ √ 200 ∗ 106 ≈ 36.8µV (43) Next, the noise from the load resistor is on the photo-diode is calculated. Two kinds of noise will be considered: Johnson noise and shot noise. Both of these noises are generated mainly from the resistor. Johnson noise is also called Thermal noise, or Nyquist-Johnson noise[38, 39]. It is generated by the electron movements in a resistor, creating heat which causes the resistance value to fluctuate. Since the mean amplitude of this noise is 0, the Root mean square (RMS) value of the noise is used. The RMS voltage is calculated as shown in equation 44. vn,res = √ 4 ∗ kB ∗ T ∗ R ∗ ∆f (44) where vn,res is the RMS voltage noise over the resistor, kB = 1.38 ∗ 10−23 J/K is Boltzmanns constant, T is the temperature, R is the resistance and ∆f is the bandwidth. T = 300 (room temperature 25 °C ≈ 300 K is assumed), R = 50 Ω and ∆f = 200 MHz gives vn,res ≈ 12.9 µV . This, compared to the signal voltage gives an SNR of about 23. Shot noise is a random noise generated by current fluctuations. Current is electrons per time unit and electrons do not arrive in a steady stream, but rather randomly distributed (often modelled as a Poisson distribution[40]). The current noise is calculated as shown in equation 45: In = √ 2 ∗ qe ∗ I0 ∗ ∆f (45) where In is the noise RMS amplitude, qe = 1.6∗10−19 C is the elementary charge, I0 is the current in the circuit (the current generated by the photo-diode in this case) and ∆f is once again the frequency bandwidth. Using the current calculated before as I0 = Idiode = 6 µA and ∆f = 200 MHz gives In ≈ 19.6 nA, which is about 300 times smaller than Idiode. Therefore, shot noise will be neglected since the Johnson noise is much larger compared to the signal. Both the noise generated by the OP-amp and the Johnson noise from the resistor are in the same region, so both need to be taken into account. Shot noise and noise from the photo-diode are not taken into account, since they are so much smaller. Furthermore, the other OP-amp input noise needs to be taken into account, namely the input noise current, which generates a voltage noise over the 50 ohm load resistor. Since this is a non-inverting amplifier, only the current generated at the non-inverting input will be considered. The current noise is in,opni = 20 pA/ √ Hz which converted to a voltage by knowledge of the resistor load can determine the input voltage noise using equation 46 vn,opi = in,opni ∗ √ ∆fopamp ∗ Rl = 20 ∗ 10−12 ∗ √ 200 ∗ 106 ∗ 50 ≈ 14.1µV (46) 31 vn,opi is in the same order of magnitude as the other noises, so this needs to be weighed in as well. Finally, the input noise to the first OP-amp is calculated using 33. The total RMS noise was found to be vn,tot = √ 36.82 + 12.92 + 14.12 µV ≈ 41.5 µV . Comparing to the signal voltage calculated in 2.2.3, the SNR was found to be ≈ 7.2. The SNR is degraded even further due to subsequent amplifiers, but this is hard to model without a complete circuit. RF amplifiers were tested instead of the OP-amps at a late stage in the project. These amplifiers are different from OP-amps in the sense that they do not utilize a feedback loop in the same way. An OP-amp has to have a feedback loop from the output to the input, which is defined by the user, while a RF-amplifier is mainly a transistor with some bias circuits. Since OP-amps are designed to be stable, they have to be limited in speed (as mentioned before). An external feedback loop is also used to select the amount of gain. RF amplifiers on the other hand are a type of transistor amplifiers with very high bandwidth (up in the regions of several GHz) and gain of 20-30 dB at these bandwidths. They are often used in wireless applications where the signals are very weak and at a high frequency[41, 42]. Since a specific gain and stability is not needed, something that amplifies at a set gain and at a high wide bandwidth would be ideal. Since these have much higher bandwidth, rise times could be improved from the OP-amp solution, leading to less error in the measured time. These components are also typically very cheap and small, making them an even more attractive choice. There are many different kinds of RF amplifiers, and most of them require an RCL-filter, to optimize the amplifier for a specific frequency. There are however amplifiers which do not need this, since this circuit is included in the package. These are more easy to use, since less components are needed and should have a more optimal performance over a wider frequency range. Two candidates of RF-amplifiers were chosen: BGA2851[42] and BGA2818[43]. One of these operate at 5 V and the other at 3.3 V. For a schematic, please refer to figure 32 in the appendix. RF amplifier noise should also be analysed. These generate noise in another way compared to OP-amps. If they generate any input noise similarly to OP-amps or resistors is unclear (the manufacturers don’t specify it in the datasheet), but they specify something called a noise figure. A noise figure is a figure of merit describing the relationship between the SNR into an integrated circuit and the SNR out of it. noise figure is measured in dB and is related to the non-dB figure of merit noise factor as shown by equation 47. NF = 10 ∗ log F (47) where NF is noise figure and F is noise factor. Using the noise figures of the chosen RF-amplifiers (3.5 dB[43] for the BGA2818 and 4 dB[42] for the BGA2851) and converting into F yields an SNR degrading of 2.2 and 2.5 respectively. This means when the signal passes through the amplifier, more than half of the SNR is lost. However, for cascaded amplifiers, the noise factor in each subsequent amplifier needs to be scaled down with the gain of the previous amplifiers. This is done using Friis formula for noise factor[44], as shown in equation 48. Ftot = F1 + F2 − 1 G1 + F3 − 1 G1 ∗ G2 + ... + Fn − 1 G1G2...Gn−1 (48) where Fn and Gn are the noise factors and power gain factors for amplifier stage n. Note that these figures are not in dB, but rather ratios. Using for example 2 amplifier stages, each with a F = 2.2, and a G = 1000 (30dB), Ftot ≈ 2.2 can be calculated. Since the gain is large, the noise from all amplifiers stages are neglected. This calculation does not include an additional noise sources in the subsequent stages, but since the gain is rather large, these can, like the noise factor 32 from these stages, be omitted. As these operate on a higher frequency, the noise from the resistor needs to be recalculated. These amplifiers have a bandwidth of 2.1 GHz, which means that noise should be calculated at this bandwidth. However, by using filters, the bandwidth can be lowered, decreasing the noise. Assuming a bandwidth of 1 GHz (corresponding to a rise time of 330 ps, which is about the needed timing resolution, as discussed in section 1.1.1), the Johnson and shot noises can be calculated using equations 44 and 45. Using these equations gives vn,johnson ≈ 28.8 µV and vn,shot = R∗In,shot ≈ 50∗34.6∗10−9 = 1.73 µV . Using equation 33 to calculate the total noise yields vn,tot = √ (28.8 ∗ 10−6)2 + (1.73 ∗ 10−6)2 ≈ 28.9 µV . As seen, the shot noise has almost no effect. The SNR before the first amplifier can be calculated to SNR = 300/28.9 ≈ 10. Finally, the SNR at the comparator can be calculated as SNRcomp = SNR/F = 10/2.2 ≈ 4.5. This is probably doable, but more SNR is of course desirable. This can be achieved by using another amplifier with lower noise factor or using more filtering. Avalanche transistors present an alternative approach. They work in the same way as APDs to achieve very short rise times, however at the same cost of high voltage (again in the range of 100-200 V), availability and high cost. Therefore, these will not be further investigated. 2.3 Time measurement As mentioned before, time of flight measurements are not possible without something that can measure time very precisely. There are several ways to solve this problem, but the easiest way is to use a dedicated integrated circuit. These circuits are uncommon to get off-the-shelf, since it’s easier for a large company to use an ASIC for this purpose, which may also contain a signal amplifier. The simplest solution is to use a fast microcontroller timer to measure time. However, to achieve a resolution of 334 ps, the clock frequency Fclk would have to be according to equation 49 Fclk = 1 334 ∗ 10−12 ≈ 3 ∗ 1012[Hz] = 3GHz (49) 3 GHz is a very high frequency and no microcontrollers (seldom even real processors) use this high a clock frequency. So, this solution is not feasible at all. The fastest microcontrollers today have timers that go up to 256 MHz[45], which is more than 10 times below the frequency needed to fulfil the requirement. Another method for measuring times could be a constant current source charging a capacitor during the time the light is travelling. When the light is received, the charging stops and the charge in the capacitor correspond to the time. The good thing with this is that it is probably cheaper than an integrated circuit and the resolution is given by how exact the charge in the capacitor can be measured (which often is at rather high resolution). The downside is that it would need to be designed and tested, which is generally very hard, since it involves high speed and precision electronics. PIC microcontrollers from Microchip has such a module built-in (called a CTMU). It was hard to find the exact resolution for this, but most sources claim below nanosecond resolution [6], which probably means hundreds of ps, and this solution could therefore be feasible. The price of these microcontrollers is generally low, so it would definitely fit within the budget. The best solution is to use an integrated circuit specifically designed for measuring short times. These are very uncommon on the consumer market. Texas Instruments manufactures a TMU circuit with a precision of about 13 ps. Unfortunately, it is rather expensive (a price at about e120), which is over our budget[5]. Acam manufactures TDC-circuits [46] in several variants. The one best suited for this application was the TDC-GP21. It can measure time with a 45 ps resolution (22 ps if 33 using only one of the two channels). By using oversampling techniques, a higher resolution can be obtained, as long as the process has a randomly distributed error. Even without oversampling, the resolution is several times the needed resolution (of 334 ps). At a price of about e10 it is a given component in the system. This specific TDC measures time by letting a signal pass through a series of inverters with a very known propagation delay. When a stop signal is generated, the position of the signal is saved and a time can be calculated from this [47]. 2.4 Microcontroller The microcontroller is the controlling and supervising part of the system and it also serves as an interface to the system from external units using the LIDAR. To ease with development a micro- controller available on a cheap development board was selected, an STM32F407VG [48] mounted on an STM32F4Discovery[49]. It is one of the fastest and most powerful microcontrollers available at the time of writing. It operates at a frequency of up to 168 MHz, incorporates all the necessary peripherals such as ADC, Digital-to-Analog Converter (DAC), many hardware timers and various communication interfaces such as USB, UART, SPI and I2C. To be able to flexibly set the things such as the laser pulse length, the timing between start and laser pulses and so on it is best if this could be done in software internally in the microcontroller. Since the laser pulse is very fast, it is necessary that the microcontroller clock speed is enough to allow for enough resolution. Also, using the microcontroller clock to generate the pulse means that the pulse length can only be in multiples of the clock frequency. However, software cannot be used directly to generate pulses, since the core is unpredictable for these time frames, probably due to advanced functions such as instruction pipelines and so on. Therefore, the internal hardware times should instead be used. These are easily programmable and synchronizable to generate very precise pulses (at a resolution of about 6 ns, based on the microcontroller clock frequency of 168 MHz). The DAC is used to set a voltage level for the comparator part of the amplification circuit that defines the threshold for which values are regarded as noise and which are real values. The ADC is considered as a way to directly measure the voltage level of the input signal, but it is uncertain if it can be used since it might interfere with the signal itself. The circuit board is therefore designed to allow for easy disconnection of the ADC. The interface with the TDC is via Serial Peripheral Interface (SPI)[47], which can be used at high speed since it is a synchronous protocol[50]. The rest of the interfaces are to be used mostly to interface a user, however primarily UART will be used during development since it is a protocol widely used to interface with subsystems on many robots and it is one of the easiest to work with. One could also think to use SPI, to handle the possibly high data rate from the LIDAR. 2.5 Hardware design To hold everything in place, some hardware assembly is needed. The hardware design was based on the criteria of the other parts, in particular the optical requirements. The hardware should incorporate all parts of the system: the laser diode and transmitter lens assembly, the receiver diode and receiver lens assembly and some place to mount the PCBs. Furthermore, all optical assemblies should be adjustable to calibrate for any manufacturing errors. The transmitter lens needs to be adjustable in relation to the laser diode in the the beam direction and it should be possible to aim the whole transmitter assembly in the other directions, which means that the laser beam should be adjustable to fire a beam in any direction (within a certain limit of course). More 34 or less the same thing goes for the receiver assembly. The receiver lens should be adjustable in relation to the receiver diode, both the beam direction (z direction) and in the other two directions (x- and y directions). The design freedom for both these cases is to choose whether to move the lens or the transmitter/detector diode. 2.6 Scanning Scanning has only been briefly investigated since it was removed from the specification at an early stage. An early concept image is shown in figure 13. The main reason why it was removed was that it would take too much time. Another reason was to remove any complications stemming from integrating scanning into the system. As it is now the system has the measurement frequency to support scanning measurements but scanning is not integrated into the system. If the system specifications are met then scanning can be realized rather easily by rotating the entire system and using inductive or slip connectors to interface with the system. Figure 13: Conceptual image of a scanning LIDAR 3 Testing equipment To perform tests to verify the functionality of the device, certain testing equipment was needed. At high frequencies are used in this project, it is important that the testing equipment is suitable for these frequencies and is used correctly. 3.1 Oscilloscope An oscilloscope is an invaluable tool for testing electronics. Using this it is possible to observe the behaviour of the high-speed signal and properties such as amplitude, rise- and fall times and durations. For this project, two different kinds of oscilloscopes were used: Rigol DS1052E 50 MHz, 1 GSa/s and Tektronix TDS3032B 300 MHz, 2.5 GSa/s. These oscilloscopes are really a little too slow for measuring these signals (especially the Rigol), but those were readily available and enough 35 for coarse measurements. Generally, x10-mode was used on the oscilloscope probes, to make sure that the circuit measured was affected as little as possible from the measuring equipment. Both of these oscilloscopes can save the data on an external medium. The Tektronix oscilloscope was old, so it could only save on diskettes, making it harder to sample data from it. 3.2 IR camera One of the hardest things when researching IR equipment is to observe the IR. One way to do this is to use a cell phone camera, since they usually don’t have an IR filter. However, cell phone cameras are not of the best quality (they don’t usually have any optics at all for instance) so a better camera is preferred. One can easily modify a normal webcam to be IR sensitive by removing the IR-blocking filter on the image sensor. Then it can be connected to any PC and IR can be seen. This type of modified webcam was used throughout the project. 3.3 Light power meter A light power meter was used to measure the optical output power of the laser. It consists of a well calibrated photo-diode, PIN-10D[51], and a battery. By connecting it to an oscilloscope, the optical power can be measured. There are however two major drawbacks with this specific sensor: First, the sensor area is very large, which makes it very slow. Secondly, the lasers optical output power is rather high, which means that to match this output power, the photo-diode would have to match this and output a high of current. The photo-diode has a spectral sensitivity (Sλ=905nm) of 0.65 A/W, which means that for each watt in optical input power, it outputs 0.65 A. Given an input power of more than 1 W, it needs to output more than 0.65 A, which is too much for this (and most) photo-diodes. This can be solved by using an optical filter to limit the input power by a known factor. 4 Results This section consists of two main parts: first a description of the subsystems in the LIDAR (found in sections 4.1-4.3.2) and second a verification of each subsystem (found in section 4.4). 4.1 Electrical design The electrical system consists of two PCBs: a main PCB and a detector PCB. Both of them are designed using KiCad and incorporates all electrical components according to their specifications. All schematics can be found in appendix 8.1. 4.1.1 Main PCB The main PCB contains the microcontroller (STM32f407VG), the TDC (TDC-GP21) and the laser driver. Furthermore, it contains all components needed around these main components, which are mostly capacitors, resistors, LEDs and pin headers. The PCB also has expansions for future development, such as a USB-port and a socket for an SD-card. The large amount of capacitors is necessary to keep the voltage on a very stable level because the TDC needs a very stable voltage to 36 perform the high-speed measurements accurately. There are 4 voltage systems on this board: first two 3.3 V systems, where one supplies the TDC core and the other supplies the rest of the logic (including the microcontroller). Second, two 5 V systems, where one is the voltage used to drive the laser and one is used to drive the detector electronics. It could be potentially bad if these 5 V systems used the same source, since the laser consumes current at very high pulses, which might interfere with the very sensitive detector and amplifier electronics. Photographs of the the main PCB with most components mounted can be seen in figure 14. (a) Front (b) Back Figure 14: A photo of the main PCB 4.1.2 Detector PCB As discussed in section 2.2.4, there were two different approaches to the detector PCB: one with OP-amps and one with RF-amplifiers. OP-amp solution To ensure minimum interference from other radio-sources (since these am- plifiers operate on high frequencies) and keep noise levels down, all high speed electronics were encapsulated in a grounded copper shield as can be seen in figure 15(b). For testing purposes, measurement points are located on the board and has small "antennas" sticking out to the top side. These may act as antennas on frequencies the amplifiers work on, but no large weight was put on minimizing this potential noise source, since the antennas are rather short and will be removed when the system has been verified. The PCB in figure 15 is the latest OP-amp-based amplifier design. As for the circuit design it is available in appendix, figure 31. 37 (a) Unshielded (b) With shield Figure 15: Photos of the latest OP-amplifier-based PCB design with and without shielding RF-amplifier solution The amplifier boards have been developed iteratively and the PCBs used at the end of the project does, as mentioned before, not use OP-amps at all, but rather RF-amplifiers. These are according to the specifications better suited