**5. Signal processing methods to locate signal energy centre**

In the previous sections, we described different sensors and scanners that produce output currents related to the "the centre of mass" of the light incident in the surface of the device. In this section we will compare some techniques to find the energy centre of the signal and eventually discuss their advantages.

#### **5.1. Time-series simple statistics algorithms for peak detection**

**Figure 19.** Principle of electrical signal formation during rotational scanning.

406 Optoelectronics - Advanced Materials and Devices

ure 20.

In this case, the signal created, as a similar Gaussian-like shape, goes up(Fig. 19, a) and falls down (Fig. 19, e), and a fluctuating activity takes place around its maximum area in figs. 19 (b-d). As we mentioned before, in a real practice the signal becomes noisy, see [22]. The ex‐ periment recently developed by Rivas M. and Flores W., with the scanner shown in Figure 6, for angular position measuring and using an incoherent light source and a simple photo‐ diode, validated the model shown in Figure 20. During experimentation, it has been ob‐ served that the optoelectronic scanning sensor (photodiode) output is a Gaussian-like shape signal with some noise and deformation. This is due to some internal and external error sources like the motor eccentricity at low speed scanning, noise and deformation that could interfere with the wavelength of the light sources. Other phenomena could also affect, though, such as reflection, diffraction, absorption and refraction, producing a as seen in Fig‐

As we can see, the photodiode signal originates a similar function to a CCD, consequently, it is possible to enhance the accuracy measurements in optical scanners with a rotating mirror, using a method for improving centroid accuracy by taking measurement in the energy cen‐ Peak Signal Algorithms are simple statistic algorithms for non-normally distributed data series [23] to find the peak signal through threshold criteria statically calculated [23]. The al‐ gorithms which identify peaks in a given normally distributed time-series were selected to be applied in a power distribution data, whose peaks indicate high demands, and the high‐ est corresponds to the energy centre. Each different algorithm is based on specific formaliza‐ tion of the notion of a peak according to the characteristics of the optical signal. These algorithms are classified as simple since the signal does not require to be pre-processed to smooth it, neither to be fit to a known function. However, the used algorithm detects all peaks whether strong or not, and to reduce the effects of noise it is required that the signalto-noise ratio (SNR) should be over a certain threshold [23]:

$$\mathbf{M} = \frac{\text{max} + \text{abs\\_avg}}{2} + \mathbf{K}^\* \text{abs\\_dev} \tag{4}$$

centre is located. The signal generated by the optical aperture should be represented by a

In Figure 21 the area under the curve delimited by the function y=v(t) and the lines Aa and

The integral limits are on t (a, b). As the differential dt is a rectangle, the geometric centroid is in the half base and half height. As dt tends to zero and the half of it is a very small value, we could consider that half of dt is dt, therefore the next equations are used to calculate the

Second Integral, to find the T coordinate that corresponds to the energetic signal centre.

*<sup>T</sup>* <sup>=</sup> *<sup>∫</sup>TdA*

ergetic signal centre coordinate, if required for future experimentation.

*<sup>A</sup>* <sup>=</sup> *<sup>∫</sup>tvdt*

Third Integral, to find the V coordinate to know which voltage value was present in the en‐

Bb define the function integral limits of the plane figure. Selecting the differential area

First Integral, to calculate the complete area under the signal curve.

*y f t vt* = = ( ) ( ) (10)

http://dx.doi.org/10.5772/51993

409

A Method and Electronic Device to Detect the Optoelectronic Scanning Signal Energy Centre

*dA v t dt* = ( ) (11)

*T tV v* /2 = = (12)

*A dA v t dt* =ò =ò ( ) (13)

*TA TdA tv t dt* =ò =ò ( ) (14)

<sup>2</sup> *VA VdA v vdt v dt* == = ( / 2) 1 / 2 òò ò (16)

*<sup>A</sup>* (15)

function:

geometric centroid [5]:

Solving for T

Where

$$S\_1 \begin{Bmatrix} \mathbf{k}\_{\prime} & \mathbf{i}\_{\prime} & \mathbf{x}\_{i^{\prime}} & T \end{Bmatrix} = \frac{\max\left\{ \mathbf{x}\_{i} \cdot \mathbf{x}\_{i:1\prime} \cdot \mathbf{x}\_{i} \cdot \mathbf{x}\_{i:2\prime} \cdot \mathbf{x}\_{i} \cdot \mathbf{x}\_{i:4\prime} \right\} + \max\left\{ \mathbf{x}\_{i} \cdot \mathbf{x}\_{i+1\prime} \cdot \mathbf{x}\_{i} \cdot \mathbf{x}\_{i} \cdot \mathbf{x}\_{i} \cdot \mathbf{x}\_{i+1\prime} \right\}}{2} \tag{5}$$

$$\mathbf{S\_2}\{\mathbf{k}, \quad \mathbf{i}\_{\prime\prime} \cdot \mathbf{x}\_{i\prime} \cdot T\} = \frac{\mathbf{x\_{i\_{\prime}\cdot x\_{i\_{\prime}1}+\*} \cdot x\_{i\_{\prime}} \cdot x\_{i\_{\prime}2} + \dots \cdot x\_{i\_{\prime}\cdot x\_{i\_{\prime}}} \cdot x\_{i\_{\prime}k}}}{k} + \frac{\mathbf{x\_{i\_{\prime}} \cdot x\_{i\_{\prime 1}1} \cdot x\_{i\_{\prime}2} \cdot x\_{i\_{\prime 2}2} + \dots \cdot x\_{i\_{\prime}\cdot x\_{i\_{\prime}k}}}{k}}{2} \tag{6}$$

$$\mathbf{S}\_{3}\{\mathbf{k}\_{\prime}\quad\dot{\mathbf{x}}\_{\prime}\quad\mathbf{x}\_{i\prime}\;T\;=\frac{\begin{pmatrix}\mathbf{x}\_{i\cdot}\cdot\frac{\mathbf{x}\_{i\cdot-1}\cdot\mathbf{x}\_{i\cdot-1}\cdot\mathbf{x}\_{i\cdot-2}\cdot\mathbf{x}\_{i\cdot-1}\cdot\mathbf{x}\_{i\cdot-1}\cdot\mathbf{x}\_{i\cdot-1}}{k}\end{pmatrix}\star\begin{pmatrix}\mathbf{x}\_{i\cdot}\cdot\frac{\mathbf{x}\_{i\cdot-1}\cdot\mathbf{x}\_{i\cdot-1}\cdot\mathbf{x}\_{i\cdot-1}\cdot\mathbf{x}\_{i\cdot-2}\cdot\mathbf{x}\_{i\cdot-1}\cdot\mathbf{x}\_{i\cdot-1}}{k}\end{pmatrix}\tag{7}$$

$$\mathbf{S\_4} \begin{Bmatrix} \mathbf{k} & \mathbf{i} & \mathbf{x\_{i'}} & T \end{Bmatrix} = H\_w \begin{Bmatrix} \mathbf{N(k\_{z\_i} i\_{z\_i} T)} \end{Bmatrix} - H\_w \begin{Bmatrix} \mathbf{N^{'}(k\_{z\_i} i\_{z\_i} T)} \end{Bmatrix} \tag{8}$$

This method consists in define the variables: T = x1, x2, …,x Nbe a given univariate uniform‐ ly sampled time-series containing N values (1,2, …,N). xi be a given it h point in T. k> 0 is a given integer. N+(k,i,T) = <xi+1, xi+2,…,xi+k> the sequence of k right temporal neighbours of xi. N-(k,i,T) = <xi-1, xi-2,…,xi-k> the sequence of k left temporal neighbours of xi.N(k,i,T) = N +(k,i,T) • N-(k,i,T) denote the sequence of 2k points around the it h point (without the ith point itself) in T (• denotes concatenation). N'(k,i,T) = N+(k,i,T) • {xi} • N-(k,i,T). And S be a given peak function, (which is a non-negative real number).S(i, xi, T) with it h element xi of the given time-series T.

A given point xi in T is a peak if S(i, xi, T) >θ, where θ is a user-specified (or suitably calcu‐ lated) threshold value.

#### **5.2. Calculation of the centroid of the light distribution**

This method has been widely used in digital imaging for the location of different image fea‐ tures with subpixel accuracy. By definition, the centroid of a continuous 1-D light intensity distribution is given by:

$$\chi = \frac{\underline{\lim} \, f \, \, \text{(\(\chi\)} \, \text{dx}}{\underline{\lim} \, f \, \, \text{(\(\chi\)} \, \text{dx}}} \tag{9}$$

where f (x) is the irradiance distribution at the position x on the image, see [24].

In our case the signal geometric centroid is a function of the voltage signal shape generated by the scanner (a plane figure of two dimensional shape X) and is the intersection of all straight lines that divide X into two parts of equal moment about the line [25].

For the geometric centroid computation the "integral plane figures method" will be used to provide two coordinates: Ẋ which we will assign to the time axis, thus Ẋ=T and Ẏ that we will assign to the voltage axis, thus Ẏ=V, where we will only take the t coordinate to corre‐ late the geometric centroid with the position on time (sample number) where the energy centre is located. The signal generated by the optical aperture should be represented by a function:

$$y = f\left(t\right) = \upsilon\left(t\right) \tag{10}$$

In Figure 21 the area under the curve delimited by the function y=v(t) and the lines Aa and Bb define the function integral limits of the plane figure. Selecting the differential area

$$dA = v\left(t\right)dt\tag{11}$$

The integral limits are on t (a, b). As the differential dt is a rectangle, the geometric centroid is in the half base and half height. As dt tends to zero and the half of it is a very small value, we could consider that half of dt is dt, therefore the next equations are used to calculate the geometric centroid [5]:

$$t \, T \, = \, tV = v \,/\,\/2\tag{12}$$

First Integral, to calculate the complete area under the signal curve.

$$A = \begin{bmatrix} dA \ \end{bmatrix} = \begin{bmatrix} v(t)dt \end{bmatrix} \tag{13}$$

Second Integral, to find the T coordinate that corresponds to the energetic signal centre.

$$TA = \int TdA = \int tv\left(t\right)dt\tag{14}$$

Solving for T

*<sup>h</sup>* <sup>=</sup> *max* <sup>+</sup> *abs* \_ *avg*)

*xi* - *xi*-1 + *x <sup>i</sup>* - *xi*-2 + … + *xi* - *xi*-*<sup>k</sup>*

*xi* - *xi*-1 + *x <sup>i</sup>* - *xi*-2 + … + *xi* - *xi*-*<sup>k</sup>*

, *<sup>T</sup>* ) <sup>=</sup> *max*{*xi* - *xi*-1, *xi* - *xi*-2, *xi* - *xi*-*<sup>k</sup>* } <sup>+</sup> *max*{*xi* - *xi*+1, *xi* - *xi*+2, *xi* - *xi*+*<sup>k</sup>* }

2

2

*<sup>k</sup>* +

*<sup>k</sup>* ) <sup>+</sup> (*xi* -

This method consists in define the variables: T = x1, x2, …,x Nbe a given univariate uniform‐ ly sampled time-series containing N values (1,2, …,N). xi be a given it h point in T. k> 0 is a given integer. N+(k,i,T) = <xi+1, xi+2,…,xi+k> the sequence of k right temporal neighbours of xi. N-(k,i,T) = <xi-1, xi-2,…,xi-k> the sequence of k left temporal neighbours of xi.N(k,i,T) = N +(k,i,T) • N-(k,i,T) denote the sequence of 2k points around the it h point (without the ith point itself) in T (• denotes concatenation). N'(k,i,T) = N+(k,i,T) • {xi} • N-(k,i,T). And S be a given peak function, (which is a non-negative real number).S(i, xi, T) with it h element xi of

A given point xi in T is a peak if S(i, xi, T) >θ, where θ is a user-specified (or suitably calcu‐

This method has been widely used in digital imaging for the location of different image fea‐ tures with subpixel accuracy. By definition, the centroid of a continuous 1-D light intensity

In our case the signal geometric centroid is a function of the voltage signal shape generated by the scanner (a plane figure of two dimensional shape X) and is the intersection of all

For the geometric centroid computation the "integral plane figures method" will be used to provide two coordinates: Ẋ which we will assign to the time axis, thus Ẋ=T and Ẏ that we will assign to the voltage axis, thus Ẏ=V, where we will only take the t coordinate to corre‐ late the geometric centroid with the position on time (sample number) where the energy

*<sup>x</sup>* <sup>=</sup> *<sup>∫</sup>* -*∞ <sup>∞</sup> xf* (*x*)*dx ∫* -*∞*

where f (x) is the irradiance distribution at the position x on the image, see [24].

straight lines that divide X into two parts of equal moment about the line [25].

, *T* ) =*Hw*(*N* (*k*, *i*, *T* )) - *Hw*(*N '*

*S*1(*k*, *i*, *xi*

*S*3(*k*, *i*, *xi*

the given time-series T.

lated) threshold value.

distribution is given by:

*S*2(*k*, *i*, *xi*

408 Optoelectronics - Advanced Materials and Devices

, *T* ) =

(*xi* -

**5.2. Calculation of the centroid of the light distribution**

, *T* ) =

*S*4(*k*, *i*, *xi*

<sup>2</sup> + *K\*abs* \_*dev* (4)

*xi* - *xi* +1 + *x <sup>i</sup>* - *xi* +2 + … + *xi* - *xi* <sup>+</sup>*<sup>k</sup> k*

*xi* - *xi* +1 + *x <sup>i</sup>* - *xi* +2 + … + *xi* - *xi* <sup>+</sup>*<sup>k</sup>*

*<sup>∞</sup> <sup>f</sup>* (*x*)*dx* (9)

<sup>2</sup> (5)

*<sup>k</sup>* )

(*k*, *i*, *T* )) (8)

(6)

(7)

$$T = \frac{fTdA}{A} = \frac{fvtdt}{A} \tag{15}$$

Third Integral, to find the V coordinate to know which voltage value was present in the en‐ ergetic signal centre coordinate, if required for future experimentation.

$$VA = \int VdA = \int (v \, / \, 2) vdt = 1 / \, 2 \int v^2 dt \tag{16}$$

Where

$$V = \frac{fVda}{A} = \frac{f(v \ / 2)vdt}{A} = \frac{1}{2A}fv^2dt\tag{17}$$

The second step is to compute the power spectrum, that is to compute the square of the ab‐ solute value of the FFT, which result is considered as the power of the signal at each fre‐

*<sup>f</sup> <sup>n</sup>e*-*iω<sup>n</sup>*

<sup>|</sup><sup>2</sup> <sup>=</sup> *<sup>F</sup>* (*ω*)*F\**(*ω*)

A Method and Electronic Device to Detect the Optoelectronic Scanning Signal Energy Centre

<sup>2</sup>*<sup>π</sup>* (18)

http://dx.doi.org/10.5772/51993

(19)

411

*<sup>ᶲ</sup>*() =| <sup>1</sup>

The third step consists of applying the Power Spectrum Centroid:

Where F(ω) is the discrete-time Fourier Transform of fn.

<sup>2</sup>*<sup>π</sup>* <sup>∑</sup> *n*=-*∞ ∞*

*SC Hz* =

**6. Method and electronic device to locate signal energy centre**

A signal V(t) is obtained from the optical scanning aperture, as shown in Figure 22.

**Figure 22.** a) Chanel 1 Original signal from apertureb) Original signal representation.

∑ *k* =1 *N* -1 *k* . *X <sup>d</sup> k*

> ∑ *k* =1 *N* -1 *X <sup>d</sup> k*

The principal focus of this chapter is a method to find the energy centre of the signal gener‐ ated by optical scanners and to reduce errors in position measurements. The method is based on the assumption that the signal generated by optical scanners for position measure‐ ment is a Gaussian-like shape signal, and this signal is processed by means of an electronic

The signal V(t) is amplified through an operational amplifier until saturation to obtain a

( ) *V t V max s s* = (20)

quency.

circuit.

**6.1. Electronic method operating theory**

square signal, this signal can be expressed as:

**Figure 21.** Optical Signal represented as a plane figure.

#### **5.3. Power (energy) spectrum centroid**

The Power Spectrum Centroid is a parameter from the spectrum characterization mainly used until now for musical computing due to the spectral centroid corresponding to a tim‐ bral feature that describes the brightness of a sound. In this application we will correlate the Power Spectrum Centroid with the Energy Centre of the Signal due to the fact that the Pow‐ er Spectrum Centroid can be thought as the centre of gravity for the frequency components in a spectrum. The power spectrum is a positive real function of a frequency variable associ‐ ated with the function of time, which has dimensions of power per hertz (Hz) or energy per hertz, that means the power carried by the wave (signal) per unit frequency.

#### Power Spectrum Method:

The first step to go from time-series domain to frequency-series domain is to apply the Four‐ ier series, which provides an alternate way of representing data. Instead of representing the signal amplitude as a function of time, Fourier Series represent the signal by how much in‐ formation (power) is contained at different frequencies and also allow to isolate certain fre‐ quency ranges that could be from noise sources, if necessary. Whenever we have a vector of data (finite series)with Matlab we can apply the FFT (Fast Fourier Transform) to convert from time to frequency domain, computing the Discrete Fourier transform (DFT), which is the Fourier application for discrete data and whose non-zero values are finite series.

The second step is to compute the power spectrum, that is to compute the square of the ab‐ solute value of the FFT, which result is considered as the power of the signal at each fre‐ quency.

$$\left| \begin{array}{c} \cline{1-4} \cr \cr \left( \begin{array}{c} \cline{1-4} \end{array} \right) = \left| \begin{array}{c} \cline{1-4} \cr \cr \end{array} \right| \end{array} \begin{array}{c} \text{e} \begin{array}{c} \text{e} \\ \text{e} \end{array} \end{array} \right| \left| \begin{array}{c} \cline{1-4} \cr \left( \begin{array}{c} \cr \end{array} \right) \end{array} \right| \left| \begin{array}{c} \cline{1-4} \cr \end{array} \right\rangle \end{array} \tag{18}$$

Where F(ω) is the discrete-time Fourier Transform of fn.

*<sup>V</sup>* <sup>=</sup> *<sup>∫</sup>Vda*

**Figure 21.** Optical Signal represented as a plane figure.

**5.3. Power (energy) spectrum centroid**

410 Optoelectronics - Advanced Materials and Devices

Power Spectrum Method:

*<sup>A</sup>* <sup>=</sup> *<sup>∫</sup>*(*<sup>v</sup>* / 2)*vdt*

*<sup>A</sup>* <sup>=</sup> <sup>1</sup>

The Power Spectrum Centroid is a parameter from the spectrum characterization mainly used until now for musical computing due to the spectral centroid corresponding to a tim‐ bral feature that describes the brightness of a sound. In this application we will correlate the Power Spectrum Centroid with the Energy Centre of the Signal due to the fact that the Pow‐ er Spectrum Centroid can be thought as the centre of gravity for the frequency components in a spectrum. The power spectrum is a positive real function of a frequency variable associ‐ ated with the function of time, which has dimensions of power per hertz (Hz) or energy per

The first step to go from time-series domain to frequency-series domain is to apply the Four‐ ier series, which provides an alternate way of representing data. Instead of representing the signal amplitude as a function of time, Fourier Series represent the signal by how much in‐ formation (power) is contained at different frequencies and also allow to isolate certain fre‐ quency ranges that could be from noise sources, if necessary. Whenever we have a vector of data (finite series)with Matlab we can apply the FFT (Fast Fourier Transform) to convert from time to frequency domain, computing the Discrete Fourier transform (DFT), which is

the Fourier application for discrete data and whose non-zero values are finite series.

hertz, that means the power carried by the wave (signal) per unit frequency.

<sup>2</sup>*<sup>A</sup> <sup>∫</sup><sup>v</sup>* <sup>2</sup>

*dt* (17)

The third step consists of applying the Power Spectrum Centroid:

$$\text{SSC}\_{Hz} = \frac{\sum\_{k=1 \atop k=1}^{N-1} k \cdot X \cdot \text{L} \text{L}}{\sum\_{k=1}^{N-1} X \cdot \text{L} \text{L}} \tag{19}$$
