Abstract
This article discusses the design and implementation of a 100 G tunable laser optical module, and briefly introduces the functions of each module in the MCU. The main technologies involve TEC control, wavelength locking, wavelength tuning, and power compensation. By analyzing the traditional positional proportional integral and differential algorithm, improving the proportional integral and differential algorithm, and using the algorithm to achieve wavelength locking, this can prevent the wavelength drift or even the lock due to the overload of the adjustment during the system adjustment process.
Introduction
With the development of modern science and technology, the increase of the transmission capacity of the expanded rate communication network has become the main transmission channel of the modern information network [1, 2]. In modern optical communication networks, the development of WAN (Wide Area Network), LAN (Local Area Network), and MAN (Metropolitan Area Network) are accompanied by more and more types of optoelectronic equipment with optical transceiver modules as the core, and higher and higher requirements With the complexity and increasing diversity of optical modules, the development trends of modern optical modules mainly include high speed, miniaturization, low cost, low power consumption, long-distance, hot-swap, etc [3, 4]. The optical module is composed of optoelectronic devices, functional circuits, and optical interfaces. The optoelectronic device includes two parts: transmitting and receiving. Simply put, the function of the optical module is to convert the electrical signal into an optical signal at the sending end, and after transmitting through the optical fiber, the receiving end converts the optical signal into an electrical signal. Optical modules are optoelectronic devices that perform the photoelectric and electro-optical conversion. The transmitting end of the optical module converts the electrical signal into an optical signal, and the receiving end converts the optical signal into an electrical signal. The optical modules are classified according to the packaging form. Common ones include SFP, SFP+, SFF, and Gigabit Ethernet interface converter (GBIC). The transmitting part is: after inputting an electrical signal of a certain code rate and processing it by an internal driving chip, it drives a semiconductor laser (LD) or a light-emitting diode (LED) to emit a modulated light signal of a corresponding rate. The output optical signal power remains stable. The receiving part is: after the optical signal of a certain code rate is input into the module, it is converted into an electrical signal by a photodetector diode, and the electrical signal of the corresponding code rate is output after the preamplifier [5–8].
With the development of the information age, communication technology and computer technology are closely combined. Intelligent network communication technology will be the key content of future communication technology development. It will make communication technology have greater capacity, faster transmission speed, higher transmission quality, and realize the characteristics of long-distance, multi-user, and flexibility. (1) Broadband. Broadband means that the wider the frequency range the communication system can transmit, the better, that is, the more information transmitted per unit time, the better [9, 10]. How to use limited wireless frequency resources to achieve broadband and ultra-wideband wireless communication is very important. Optical fiber has many advantages, such as transmission frequency bandwidth, large capacity, small loss, anti-interference, and so on, which is an important guarantee for the realization of broadband digitization. Digital communication uses computers to process digital signals to realize complex long-distance large-scale automatic control systems and automatic data processing systems and realizes the communication network with the computer as the center. The digitalization of integrated services is the development direction of the whole world network in the future [11]. It integrates all kinds of services and various networks and then digitalizes them. In this way, the communication equipment is easy to be integrated and mass-produced, and technically it is easy to process with microprocessors and control and manage with software. (3) Personalization. Nowadays, people’s communication, contact, and information exchange are mostly through telephone, mobile phone, computer, and other media or platforms, which are the communication between media and platforms [12–15]. For example, if someone calls another person, it calls another phone or mobile phone through a phone or mobile phone number, rather than no target person. When and where will the personalization of communication be realized, As an individual terminal, an individual has its identification code, which enables a person to directly connect to someone, leaving aside the medium in the middle. (4) Intelligent. With the continuous progress of science and technology, intelligence has been integrated into all aspects of people’s life. The development of intelligence in the mobile phone industry has greatly improved the speed and quality of calls, providing greater convenience for people’s lives, and intelligent mobile communication has become an inevitable trend [16, 17].
This article details the software framework and main control algorithms of the 100 G tunable optical module.
System structure
System hardware structure
As shown in Fig. 1, this module uses a tunable laser as the light source, which controls the system wavelength through current and temperature.

Block diagram of the module system.
Provide power supply circuit through Finger, realize module hot-swap function, provide the connection for module high and low-speed signals [1, 13], through MCU control chip to communicate with TX CDR, RX CDR, and a control chip to control the voltage and current of the optical module, Power, system wavelength, etc., so that the module can carry out multi-wavelength, long-distance, high-speed signal transmission at C temperature (– 5°C∼70°C) [18].
Since there is no operating system, this article uses an infinite loop software architecture.
Peripheral driver and function inside MCU
The micro control unit (MCU), also known as a single-chip microcomputer or single-chip microcomputer, is to appropriately reduce the frequency and specifications of the central processing unit (CPU) and reduce the memory (memory), counter (timer), A / D conversion, I2 C, DMA, and other peripheral interfaces are integrated on a single chip to form a chip-level computer [2]. The functions of the MCU of the optical module are shown in Table l:
Optical module software architecture
Optical module software architecture
In this section, the main algorithms in the monitoring module and the TEC control module in the MCU are mainly described.
Monitor function
This function realizes the sampling and averaging of the original DDM value of each monitoring quantity in the optical module to ensure that the MCU monitors and controls each module, as shown in Fig. 2. In the monitoring module, we introduce some algorithms to make the obtained values more accurate [19–21].

Monitoring value sampling process.
Calculation of module temperature
Assuming that T is the average of two consecutive ADC samples from the module, the formula for calculating the module temperature is
At high temperature,
The values of the parameters TH, TL, Offset are all measured in advance and have been written into the corresponding registers.
Transmitter and receiver power compensation
Under different temperatures and modes, the optical power of the transceiver will also be affected, but this effect will not be directly reflected in the sampled value, so some compensation is needed. Under high and low-temperature conditions, the power compensation formula is:
Among them, RxPW / TxPW is the average value of the sampled value, M1 / M2 is the slope value, O1 / O2 is the calibration intercept value, T is the current module temperature value, and TEC is the high and low-temperature compensation coefficient (ie TH, TL).
TEC control function
This module is based on the design and implementation of DBR lasers. DBR lasers use two mechanisms, temperature control, and current injection, to achieve the purpose of wavelength tuning. The PID algorithm is selected to realize the automatic correction of the system. Through the correction of the difference between the module temperature value, the input current value, and the difference between the set value and the sampled value at different times of the system, the automatic error correction function is realized to ensure the TOSA temperature stability and the wavelength is stable [22–24].
Principle of proportional integral differential algorithm
The controller is composed of a proportional unit, integral unit, and the differential unit, and the relationship between its input e (t) and output u (t) is:
It can be simplified to
The controller is a feedback control loop commonly used in industrial control. The function of the control system mainly depends on the setting of the three parameters K p , K i , K d .
The proportional unit of the controller is K p * e (K), which controls the current value. Once an error occurs between the control amount and the target value, the proportional unit will immediately correct the error. The strength of the control unit is proportional to the proportional coefficient K p . However, if K p is set too large, the system is more prone to oscillation. Therefore, it is necessary to select an appropriate K p , which not only makes the transition time short, and the error is small, but also does not affect the system stability [4, 23].
The integral unit of the controller is
The differential unit of the controller is K d [e (k) - e (k - 1)], which controls the future value. The function of the differential unit is to control the trend of deviation changes and to slow down the trend of deviation changes as much as possible. The introduction of the differential unit helps to reduce the amount of overshoot, overcome the oscillation, and stabilize the system. Differential time constant T d . It is proportional to the intensity of suppressing deviation [4, 25].
Selection of algorithm parameters
The parameter selection of the PID controller is the key to the design of the PID system. The designed controller requires the minimum vibration of the system.
The selection of PID algorithm parameters follows the general selection rules: Set the integral and derivative time constants to 0, and set the input value to 60% to 70% of the maximum value of the system. Gradually increase Kp1 from zero until the system oscillates, then from this time Kp1 gradually decreases until the oscillation disappears. Record Kp1, the gain factor of the system is set to 60% ∼70% of Kp1; Set a larger integration time constant Kp1 based on step 1, and find the time constant T1through a method similar to step 1 (adjust first and then increase). The integration time constant of the system is 150% ∼180% of T1; The differential constant T
d
is generally set to 0. If there are special circumstances, refer to step 1 for the debugging method; Perform no-load and on-load joint adjustment of the PID system at one time, and then fine-tune until the project needs are met.
Algorithm implementation
In this paper, the positional proportional integral differential algorithm is used, and the current control quantity is determined according to the current error, cumulative error, and forward error. The ADC samples the temperature of the TOSA at regular intervals (generally 10 ms), and the TEC cycle control function is executed every 60 ms (generally 60 ms, set the value according to the specific situation), and the sampled temperature (voltage) and the target temperature (Voltage) Compare the difference, adjust the value of TEC_SET, change the size of TEC current, and finally achieve the purpose of TEC cooling and heating. (The temperature control function of TEC only works when the TEC cycle control program is executed, that is, it is executed every 60 ms).
The location algorithm flow is shown in Fig. 3.

Positional algorithm process.
The specific C language implementation code is as follows:
F32PIDCal(stPID*pPID,U32NextPoint)
{ F32 dFrror, Error;
Error = (F32) (Ppid ->setPoint) – (F32)
(NextPoint);
pPID – >SumError + = Error;
dError = pPID ->lastError - pPID ->PreError;
pPID ->PrevError = pPID ->LastError;
Ppid ->LastError = Error;
return(pPID ->P * Error + pPID ->I*pPID ->SumError + pPID ->D * dError;}
The basic PID algorithm also includes the incremental PID algorithm. The algorithm refers to the calculation of the increment ΔU
k
of the output of the controller each time. When the increment of the control quantity is needed instead of the control quantity of the position, the incremental PID algorithm can be selected. The recursive formula can be obtained:
It can be seen from the above formula that, once it is determined that the control system uses a constant sampling period T, the values of parameters A, B, and C can be calculated, and then the deviation value of the three times before and after can be taken to obtain the incremental value of the control amount at that position. According to the formula U [k] = U [k - 1] + ΔU, the current control quantity can be obtained [25–28].
The flow of the incremental algorithm is shown in Fig. 4.

Incremental PID algorithm process.
The specific C language implementation code is as follows:
F32 PIDCal(stPID * pPID, U32 NextPoint)
{F32 dError, Error;
pPID ->PrevError = pPID ->LastError;
pPID ->LastError = Ppid ->Error;
pPID ->Error = (F32) (pPID ->setPoint)-(F32)(NextPoint);
return(pPID ->A *pPID ->Error – pPID – >B* pPID->lastError + pPID ->C*PrevError;
}
In practical applications, the traditional positional algorithm is often used to correct the sampled values, but each output of this algorithm is related to the past state. The deviation e(k) must be accumulated during the calculation, which not only has a large calculation amount but also easily saturates the integral. In the actual application process, there will always be some problems, such as the adjustment amount, and the controlled amount will be monotonically increasing in a certain range, but beyond this range, the relationship between the adjustment amount and the controlled amount may be decreasing relationship [8].
As shown in Fig. 5, if the target value of the control variable is B, and the current control value is A, if the system may have a large oscillation, the next time the control variable jumps to C, the system error will increase The bigger the value, the even the loss of lock.

Correspondence between adjustment and control.
To avoid the above situation, according to the traditional positional PID algorithm, an improved PID algorithm is proposed. The specific ideas are as follows: Assuming that the system algorithm parameter settings are appropriate, the drift problem is most likely to occur during the first system adjustment, then the first system adjustment must be within a safe range, that is, the first adjustment amount Set a threshold value U k , that is to prevent the first adjustment amount is set too large and cause drift. In the subsequent system adjustment process, a threshold ɛ is set for the deviation value. Only when the difference between the adjustment amount and the target value is less than the threshold value, the integration unit will accumulate, so that after entering the integration saturation, the system can be faster due to the small integration accumulation drop out. In this way, on the one hand, it can be guaranteed that there will not be too large a controlled amount at the beginning, on the other hand, it can avoid that the accumulated error is too large and the system oscillation time is prolonged, that is, the overshoot is reduced, the system oscillation period is shortened, and the system stability is improved. The specific mathematical formula is as follows:
The specific program flow chart is shown in Fig. 6.

The improved algorithm flow chart.
The selection of the three parameters K p ,K i ,K s follows. The above general rules; the adjustment threshold U_k is set near the target value; the deviation threshold ɛ is set to the first deviation value, and then slowly reduce the value of ɛ, select the system The point with the smallest overshoot and the best stability is the value of ɛ.
Specific C language implementation code:
{If(TRUE = = TECFrist)
{InitV = (F32)PointV- temp;
TECFrist = false;
If(Error< = ThresV)
temp = PIDCal(stPID * pPID, U32 NextPoint);
else temp = PDCal(stPID * pPID,U32 NextPoint); temp = temp + InitV;
}
When the adjustment amount is within a certain range, the relationship between the control amount and the adjustment amount increases monotonically. When the adjustment amount exceeds a certain critical value, the control amount may change to other values, that is, the deviation of the control amount may suddenly become larger, and then establish a monotonic relationship with the adjustment amount again, and the critical value of different channels is different. In this case, the system will have a relatively large oscillation during the modulation process, that is, the accuracy of the system will decrease, which will eventually cause wavelength drift and loss of lock. The improved system can prevent the problem of overshoot of the control quantity during the adjustment process, avoiding the possible non-linear problems of the adjustment quantity and the control quantity, and thus avoiding the possible loss of lock due to the overshoot of the current.
In this paper, the algorithm is improved based on proportional integral differentiation, and the improved algorithm is applied to the optical module. It can be seen through experimental simulation that the improved algorithm performs better than the original algorithm in transmission efficiency and distance.
