Laser spot measurement using cost-affordable devices

We have designed and tested an automated simple setup for quickly measuring the profile and spot size of a Gaussian laser beam using three cost-affordable light sensors. Two profiling techniques were implemented: imaging for the CMOS 2D array (webcam) and scanning knife-edge-like using a single photodiode and an LDR. The methods and sensors were compared to determine their accuracy using lasers of two different wavelengths and technologies. We verify that it is possible to use a low-cost webcam to determine the profile of a laser with 1% uncertainty on the beam waist, 1.5% error on the waistline position, and less than 3% error in determining the minimum spot radius. The photodiode measurement is the most stable since it is not affected by the change in laser intensity. In addition, we show that it is possible to use an inexpensive LDR sensor to estimate the laser spot size with an 11% error.


Introduction
A precise characterization of the laser profile and the measurement of its spot size is needed for several scientific, industrial, medical, and instrumental applications [1,2]. For example, this kind of characterization is important in Laser Induced Breakdown Spectroscopy (LIBS), an atomic emission spectroscopy where the laser focuses to form a plasma, which atomizes samples [3] or in Laser Tissue Soldering (LTS), where a protein solution is thermally denatured and cross-linked to obtain a strong bond between tissues or tissue and a wound dressing [4]. Another application is related to testing new silicon pixel sensor technology [5], where it is desired to activate individual pixels using a narrow and focused laser beam. The laser profile has to be known in advance to avoid clustering (i.e. illuminating several pixels at the same time). Several methods for measuring a Gaussian laser diameter have been developed, for a summary see [6].
There are studies for this purpose that use a CMOS-based camera [7,8] and others based on a quadrant photodiode [6,9,10], which is generally used for measuring the position of the beam. There are also alternative methods [11,12,13,14] for estimating the diameter of a Gaussian laser beam.
The aim of this work is to offer cost-affordable, automated precise methods to measure, using a simple experimental setup, the spot profile of a Gaussian laser beam. This setup uses a Raspberry Pi (small single-board computer). We are also able to find the smallest spot size in the focal plane, known as beam waist.
Three different light sensors (a CMOS webcam, a single photodiode and a LDR (Light Dependent Resistor) were used and compared to measure the radius of the laser beam. The performance of the methods and sensors were benchmarked against lasers of two different wavelengths and technologies. In addition, we will show that it is possible to use an LDR sensor, which is very cost-affordable, to roughly estimate the spot size.
This paper is divided as follows: we first describe in Sec. 2 the properties and parameters of a Gaussian laser beam. Then, in Sec. 3 we outline the general experimental setup and the specific used light sensors and lasers. In Sec. 4.1 we give the results of the laser radius and waistline measurements, as well as the comparison/cross-check between different light sensors. Finally, in Sec. 5 we discuss our findings and give our conclusions.

Laser beam modelling
There are several types of laser profiles including Gaussian, multi-mode, tilted, flat top and irregular beams [2]. A laser with a Gaussian irradiance profile can be easily modeled with well-known mathematical expressions. Thus we select this type of beam for testing the performance of the different sensors.
An ideal Gaussian laser beam has a symmetrical irradiation profile around its center, decreasing as the distance from the center increases. The waist of a Gaussian beam, w [15], also called radius or spot size, is defined as half the distance across the center of the beam where the irradiance is 1/e 2 (≈ 13.5%) of its maximum. This value is approximately 2σ of the Gaussian fit, see  The waist at a distance z is given by: where w 0 is the radius of the minimum possible cross section (beam minimum waist), z 0 is the position of w 0 and z R is the Rayleigh range, which is defined as the distance from the beam waist to the point where said waist is multiplied by √ 2. A scheme of these parameters is shown in Fig. 2. The Rayleigh range is determined by: where λ is the free-space wavelength and n is the refractive index of the medium where the beam propagates through. At large distances (z z R ), w increases linearly with z, hence the beam divergence [15], θ d , as seen in Fig. 2, given in radians, can be define, due to diffraction, as: For this study, the beam radius equation (Eq. 1) will be used to determine the beam profile. To achieve this, it is necessary to measure the values of the laser spot size as a function of the distance to the sensor, as it moves away from the laser. From these data, it is possible to determine the values of: w 0 , which presents zero divergence, z R and z 0 .

Experimental setup
To measure the laser beam spot we have designed the experimental setup shown in Fig. 3 and tested, applying different methods, three light sensors and two lasers. At the bottom of the setup there is a micrometer that has a resolution of 0.001 inches or 25.4 µm connected to a stepper motor which allows a minimum horizontal displacement along the y-axis of 10.10 ± 5.05 µm according to the mechanical configuration of the assembly. On top of this micrometer, there is another one that moves the sensor along the z-axis, which is controlled manually and has a resolution of 10 ± 5 µm. Over the z-axis micrometer, each different light sensor (CMOS, photodiode and LDR) was placed. The sensor is partially isolated from ambient light using a dark chamber with a hole in the upper part, which lets the laser pass. Fitting this hole, there is an iris diaphragm [16] to reduce beam aberrations. This iris only lets in the light that passes through the opening, which is regulated approximately to the spot size.
An attenuator (i.e. rectangular step variable metallic neutral density filter, NDL-25S-4 [17]) is placed between the laser and the sensor to decrease the intensity of the laser, preventing the saturation of the sensor and keeping the Gaussian profile, especially in the case of the CMOS sensor. The attenuator used has an optical density (OD) that varies from 0.1 to 4 with a tolerance of ±5%, divided into 10 steps or positions. The OD indicates the attenuation factor provided by an optical filter, i.e. how much it reduces the optical power of an incident beam. OD is related to the transmission, T , by T = 10 −OD . Therefore the transmission varies from 0.794 to 0.0001.
In the upper part of the setup the laser is hold still using a retort stand. The distance between laser and sensor is determined for each measurement and explained in the next Section.
The stepper motor and the sensors were connected to a Raspberry Pi 3b (i.e. a small, low-cost, single-board computer) [18,19] to control the movement and capture of the sensor data. Python programs were also developed to process the data directly on the Raspberry and to obtain the average results. The scripts can be found in the supplementary material [20].

Light sensors
Three different light sensors (CMOS (webcam), photodiode and LDR) were used in this configuration. These sensors are cost-affordable. The webcam can cost circa US$ 15, while the photodiode can be 5 times more expensive and the LDR less than US$ 2.
The first sensor was a 5MP webcam [21,22,23] which uses CMOS technology. We removed the webcam lens to be able to measure the spot size directly, according to the size of the pixels illuminated by the laser, every time a shot was taken.
The webcam was configured using the picamera package [24] for the Raspberry Pi camera module for Python. The settings were: 16 µs shutter speed (i.e. exposure time) to reduce movement, 2592x1944 image resolution, analog and digital gain at 1 and ISO = 0 to maximally reduce the noise.
The format used for image capture is YUV (Y: intensity, UV color code), which allows images to be captured without loss of detail and with full resolution (1-byte Y value for each pixel).
The second sensor was a single PIN photodiode [25]. In this case, to determine the beam radius, the photodiode must be moved step-by-step (e.g. similar to the Knife-Edge technique [26]) perpendicular to the beam from a position where the whole beam hits the sensor until the beam is outside the sensitive area. This technique will return a Gaussian CDF curve.
The third sensor was an LDR (light dependent resistor) or photo-resistance [27]. This electronic component decreases the resistance when the light intensity on the sensitive surface increases. Even if it is not a precision device, it is inexpensive. Here we apply the same technique used for the photodiode.
The circuits for the photodiode and the LDR, consist of a variable resistance in series with the sensor. These circuits are connected to an analog-to-digital converter (i.e. ADS1115), which can be read by the Raspberry Pi, as shown in

Lasers
Two different lasers were used for the measurements to benchmark the performance of the methods with different wavelengths and technologies. One was a generic 5 mW green semiconductor laser that gives a Gaussian spot according to the manufacturer. A model similar to this laser is found in [28]. The second one was a red He-Ne gas laser with power < 4 mW [29].
The laser intensity can be controlled in two ways: for both lasers, attenuators are used, however, for the green laser it is also possible to tune the current to lower its intensity, which is not available for the red laser.
In addition, the wavelength and power of each laser were measured in the laboratory. The green semiconductor laser had a 532 nm wavelength and a maximum power of 5.57 mW. Once the intensity was regulated with current and attenuators, the power was 2.83 µW. This laser was attenuated with the density filter reducing its intensity to 0.1% of the incident beam power to avoid saturating the sensor. The red He-Ne gas laser had a 633 nm wavelength and a power of 0.67 mW.
The green semiconductor laser was used to measure the laser profile and to find the beam minimum waist. Thus, a Gaussian profile was obtained. The red He-Ne gas laser was used to compare the beam radius measurement with the three light sensors. This laser has a very stable spot size with distance. Therefore the beam minimum waist was not searched for and only the beam radius was measured. In addition, it was necessary to locate the laser at a larger distance than the green laser to avoid saturating the CMOS sensor.

Laser beam profile measurements
As a benchmark, the radius and waistline of the green semiconductor laser beam were determined using the CMOS sensor. Next, the beam radius mea-surements using the red He-Ne gas laser obtained with the CMOS sensor were compared with those of the two other sensors: photodiode and LDR.

Radius and waistline estimation
The initial distance from the green semiconductor laser to the CMOS sensor was determined as follows. First, the distance between laser and sensor, where the area of the beam over the sensor is the smallest (beam waist), was visually searched by moving the laser on the z-axis. The distance from the CMOS sensor to the beam waist was measured with a vernier to be 161.94 ± 0.01 mm. The beam waist was scanned around this distance in a ± 5 mm range starting with the minimum distance (156.94 ± 0.01 mm). Then, this minimum distance is considered as the initial position (z = 0 mm).
The CMOS sensor was moved away from the laser in 1 mm steps, obtaining 11 measurements. In each position, 10 images or frames were captured and converted to ADC intensity matrices. From these data, the value of the radius in each position was calculated.
To calculate the laser beam radius, the projection of the intensity profile in the x and y axes was made. For each frame, both projections were fitted using the following Gaussian function: obtaining the parameters a (normalization), b (background off-set), µ (mean) and σ (standard deviation). The beam radius for each axis is the 10-frame average of 2σ. The associated total error was estimated as ∆ tot = ( i ∆ i 2 )/N , where N is the number of frames and ∆ i is the error for each frame, which is calculated by adding in quadrature the error from the Gaussian fit and the systematic error of 0.5 pixel.
To give the results in units of distance, the number of pixels was multiplied by 1.4 µm, which is the size of each CMOS sensor pixel. In Fig. 5, the first frame taken with the CMOS sensor at z = 6 mm is shown, as an example. The projections of the x and y axes of the spot profile are given, as well as the results obtained from the Gaussian fit.
The average spot radius w xy is calculated by: where σ x and σ y are the average standard deviation of the Gaussian fit in the x and y axes, respectively. To determine the laser profile parameters, the least-square fitting of the data at different distances along the beam line was made using Eq. 1. The parameters obtained with the fit are w 0 , the radius of the minimum possible cross-section, z 0 , the position of w 0 and z R , the Rayleigh range. Using these parameters, the laser wavelength can be determined from Eq. 2 and the divergence from Eq. 3.
The results obtained at different distances from the CMOS sensor are shown in Fig. 6 and Fig. 7, for the x-axis w x , y-axis w y and average w xy radius, respectively.  Using the average radius (see Eq. 5), the beam waistline was w 0xy = 22.2 ± 0.6 µm, Rayleigh's range z Rxy = 2894.3 ± 136.1 µm, the divergence θ d = w0 z R = 7.7 ± 0.4 mrad and the wavelength λ = πw 2 0 z R = 537.0 ± 38.0 nm. This estimation of wavelength is in good agreement with an independent measurement in the laboratory, which gave 532 nm.

Light sensors measurements comparison
To compare the different sensors we used a red He-Ne gas laser for estimating the beam radius. In this case, the green laser, which has a smaller spot size (between 20 and 45 µm), was not used since the method applied for the photodiode and LDR has lower resolution than the CMOS sensor. In order to use the photodiode and LDR a step-wise procedure is used, which has a minimum horizontal displacement of 10.1 µm along the y-axis, while the pixel size of the CMOS is 1.4 µm. Thus, the red laser, which has a larger spot, size was used. For the comparison it is only necessary to measure the spot on one axis, in this case we chose the y-axis.
The laser was located 467.15±0.05 mm above the sensor for all three sensors to avoid saturation, since this laser's intensity cannot be regulated. In addition, to prevent the saturation of the CMOS, different attenuations were tested. We found that the CMOS did not saturate for transmission of 1% and 0.1% of the initial laser intensity. For lower attenuations, the profile cannot be correctly fitted by a Gaussian. The LDR showed smaller variations in the spot size, also decreasing according to the attenuation. Contrarily, we found for the photodiode that the spot size is almost constant for the transmission range between 100% to 0.1%. All sensors measurements converge at the attenuator with 0.1% transmission. All sensors reach their threshold at the last attenuator position, where only 0.01% of the incident power is transmitted. At this position, the voltage output is compatible with the background.
The laser spot was measured with the photodiode, using the method explained in Sec. 3, regulating the resistance of the circuit (see Fig. 4) to improve the sensitivity. Each set of voltage measurements began with the laser pointing inside the sensor. Then, the sensor was moved stepwise along the y-axis until the laser was outside the sensitive area of the sensor. In each step, 10 measurements were made. The resulting data was the average. The points obtained from these measurements follow a Gaussian CDF, as seen in Fig. 8, since the profile of the laser is Gaussian.
Thus, we fit these data using the corresponding following function: where the parameters to fit are: a the normalization, µ, the Gaussian mean (position where half of the beam spot is inside the sensitive area of the detector), σ, the standard deviation (w y =2σ) and b the off-set from the background. Fig. 8 shows an example of the Gaussian CDF fit and the obtained parameters using the photodiode data with an attenuator that allows a transmission of 1% of the incident power and resistance of 2.2 kΩ. A different value of the resistance would not affect the spot size, it would only change the error since the amplitude is changed. In addition, the step distance was varied from 10 µm to 55 µm using a fixed attenuation. The beam radii obtained along the y-axis is stable, since the spot is large enough, it does not depend, in this distance range, on the precision of the steps.
Then the LDR sensor was used to measure the laser spot with an 11.5 Ω resistance, following the same method that was used for the photodiode. Different measurements were performed varying the series resistance of the circuit. And it was observed that the results obtained with the LDR depend on the resistance of the circuit, varying the sensitivity of the sensor. This does not guarantee a reliable measurement of the spot. Only a rough estimate can be given. This is because the LDR does not have a continuous surface that measures the intensity of the beam, rather it has a zigzag of the light-sensitive semiconductor material with active and non-active areas. Also, the LDR own resistance can vary up to three orders of magnitude due to changes in the intensity of the laser. We estimate that these factors account for an approximately 10% error.
Finally, the laser spot was measured using the CMOS sensor following the same method described in Sec. 4.1. To compare the three sensors results, the CMOS values are taken as the standard for comparison. The errors are calculated using Eqs. 7 and 8, where σ is the combined error of ∆w sensor the error in the beam radius estimation obtained for either photodiode or LDR and ∆w CM OS the error of the CMOS. The difference between measurements of different sensors will be given in terms of the number of standard deviations, n σ .
The errors include the statistical and systematic uncertainties, which are for the CMOS half the pixel size, that is 0.7 µm, and for the photodiode and LDR the horizontal displacement of 5 µm. The systematic error for the LDR also adds the aforementioned factors by which the spot cannot be accurately measured, such as the variation of resistance due to the effects of intensity, resistance tolerance, hysteresis effects, etc.. These is estimated to be approximately 10% of measurement. Table 1 summarizes the results of all three sensors at 0.1% transmission: CMOS, photodiode and LDR. Considering the uncertainties, the values obtained with the photodiode and LDR are compatible with that of the CMOS (webcam), less than 0.5 σ difference. Fig 9 shows  The measurement of the spot with the photodiode can be improved using less attenuation or the average of the measurements with the different attenuators, since it was observed that the spot size is almost constant for the transmission range between 100 % to 0.1 %. For example, if we use the 10% transmission attenuator, the spot value would be 506.4 ± 5.3 µm.

Discussion
We have designed and tested the performance of an automatic setup for measuring the spot radius of laser beams using three different cost-affordable light sensors. Two common profiling techniques were implemented: imaging for the CMOS 2D array and scanning knife-edge-like for the single photodiode and LDR.
The simplest and with the highest precision method for beam profiling was using the CMOS sensor. The error in determining the minimum spot radius is less than 3%, while the error on the waistline position is 1.5%. As a separate cross-check of the method, the wavelength of the laser could be determined with a 1% error. This shows that it is possible to use a low-cost webcam to determine the profile of a laser with good precision.
Our results have smaller uncertainties than those obtained in [7] where the error of the beam waist is 26% with a CMOS sensor compared to 1% in our case. For the method that uses a photodiode our errors are similar around 12% for the highest attenuation. However, for a different attenuation our error can improve to less than 2%.
Nevertheless, this method has also some limitations. Due to the CMOS greater sensitivity, the sensor can be saturated and it can produce blooming with a high intensity laser, distorting its real profile. This problem can be overcome by using attenuators.
The photodiode using the knife-edge-like technique is the most stable method. It is not affected by the change in laser intensity until the attenuation is very high. Its precision for the spot radius measurement is better than 2% under standard conditions. However, a setup with a stepper that moves the sensor along one axis is needed and the price of the photodiode is 5 times more expensive than the CMOS webcam.
The LDR measurement has a strong dependence on the series resistance of the circuit. In addition, the LDR own resistance varies about three orders of magnitude depending on the light intensity. It has also a slow response and does not provide linearity with lighting. This limits its precision to accurately measuring the spot of a laser, having an estimated error of 11%. However, it has a high sensitivity and given its considerable low cost, it can be used to have a rough estimate of the spot value.
A limitation for the smallest spot that can be measured with the knifeedge-like technique of the photodiode and LDR measurements is related to the mechanical system for horizontal displacement. Currently, the smallest step is 10.1 µm, while the CMOS grid has a pixel size of 1.4 µm. If the mechanical system is improved, smaller spots could be measured with the photodiode and LDR.
Furthermore, the data collection system for spot determination can be improved by automating the movement in the z-axis. This would increase the speed and precision of the measurement.