Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 9, No. 2, 2024 40 Design of Photovoltaic Solar Panel Intelligent Tracking System based on 51 Single Chip Microcomputer Kaicheng Liang, Luotao Yan *, Weixin Wei, Liangjie Qiao, Hao Wang MEIGA POLYTECHNIC INSTITUTE HUBEI, Xiaogan Hubei, 432017, China * Corresponding author: Luotao Yan (Email: 1198779263@qq.com) Abstract: With the continuous development of renewable energy, photovoltaic power generation as an important clean energy, has been widely concerned. At present, due to the fixed position of the photovoltaic generation version after installation, it cannot follow the sun to move, making the utilization efficiency of solar energy is low. In this paper, an intelligent tracking system for photovoltaic solar panels based on 51 microcontroller is designed. The system compares the light intensity in real time by installing photoresistors on the left and right sides of the solar panels to determine the best position and control the stepper motor to rotate in this direction, so as to effectively improve the utilization efficiency of solar energy. Keywords: Photovoltaic Solar Panels; 51 Single-chip Microcomputer; Photoresistor; Stepper Motor; Light Intensity Tracking. 1. Introduction This system aims to realize the automatic light tracing function of photovoltaic power generation panel by comparing the light intensity of four photoresistors, so as to improve the efficiency of photovoltaic power generation. The photovoltaic light tracking system is shown in Figure 1. Figure 1. Photovoltaic light tracking system physical picture 2. Principle of Photovoltaic Tracking System 2.1. System Composition 2.1.1. Photovaristor Photoresistor, referred to as photoresistor or photosensitive element, is a resistance element that is sensitive to changes in light, and its resistance value changes with changes in light intensity. Generally, the resistance value of the photoresistor is higher when there is no light or the light is weak. However, when the light intensity is increased, the resistance value will decrease significantly. This characteristic makes photoresistor widely used in photoelectric sensor, lighting control, photovoltaic power generation, security system and other fields. This system is mainly installed in the photovoltaic power generation panel on the upper and lower left and right four directions of the photoresistor is used to compare the light intensity of the four directions, respectively called: the photoresistor (L1); Lower photoresistor (L2); Left photoresistor (L3); Right photoresistor (L4). The real thing is shown in Figure 2: Figure 2. Photoresistor layout diagram 2.1.2. Analog to Digital Module The system uses PCF8591 chip [1] to convert the analog voltage signal of photoresistor output into digital signal for single-chip microcomputer processing. PCF8591 is an application in the circuit as shown in Figure 3: Figure 3. PCF8591 chip circuit diagram 41 The PCF8591 is an integrated 8-bit analog-to-digital converter (A/D converter) and digital-to-analog converter (D/A converter) chip that is widely used in a variety of embedded systems and measurement devices. It communicates with the microcontroller through I2C bus, which has a relatively simple interface and high flexibility. The following is an overview of the main features and functions of the PCF8591: (1) 8-bit resolution: The PCF8591 can convert analog signals to 8-bit digital signals, which is suitable for many low- to-medium precision applications. (2) Multi-channel input: Provide 4 analog input channels, support 4 independent channels for A/D conversion, can monitor a variety of analog signals at the same time. (3) D/A conversion: built-in an 8-bit digital-to-analog converter, which can convert the digital signal to the corresponding analog voltage, suitable for signal generation. (4) I2C interface: The I2C (Inter-Integrated Circuit) communication protocol can be used to exchange data with the microcontroller through two pins (SDA and SCL), which is easy to implement and expand. (5) User programmable address: Through pin configuration, different I2C addresses can be set to connect multiple PCF8591 devices on the same bus. (6) Simple control instructions: with a simple and easy-to- use command control mode, allowing data reading and writing through I2C instructions. 2.1.3. Single Chip Microcomputer STC89C51 MCU [2] is a powerful and flexible microcontroller widely used in embedded systems. The STC89C51 has 32 programmable I/O ports (P0, P1, P2, P3) that can be used to connect to external devices. Each I/O port can be configured independently in input or output mode. The circuit diagram is shown in Figure 4: Figure 4. MCU circuit diagram This system mainly uses STC89C51 microcontroller to obtain digital signals of four photoresistors, compare the light intensity, and control the motor rotation. 2.1.4. Motor Drive Module The motor drive module used in this system is ULN2803 motor drive chip, which is used to drive the forward and reverse of the motor and is connected to the output of the single chip microcomputer. Figure 5. Motor drive circuit diagram The design of the ULN2803 enables it to drive relatively high current devices through low-level control signals and is therefore a common motor drive solution in microcontrollers or single-chip systems [3]. The working principle is relatively simple, usually when the input receives a high-level signal, the built-in NPN transistor is switched on, and the output is switched from a high impedance state to a low impedance state, so that external loads (such as motors, relays) are energized. Main features: (1) Multi-channel drive: The ULN2803 has 8 independent drive channels, which can control multiple loads at the same time, making it very convenient when driving multiple actuators. (2) High current output: the maximum output current of each output channel can reach 500 mA and can withstand voltages up to 50 V, which makes it possible to drive most small motors and relays. (3) Built-in protection function: ULN2803 built-in free wheel diode can effectively protect the circuit to prevent damage to the integrated circuit due to the reverse electromotive force of the motor or relay. (4) Low input current: Each channel at the input requires only a few milliamps of current to drive the output, which makes it more convenient to directly connect with the microcontroller. (5) A variety of packaging forms: The common packaging forms of ULN2803 include DIP (dual in-line package) and SMD (surface mount), which is convenient for different PCB design needs. 2.1.5. Electric Machine Figure 6. Stepper motor physical picture This system uses stepper motor to control rotation. Stepper motor is an actuator that converts electrical pulse into angular displacement. Generally speaking: when the stepper driver receives a pulse signal, it drives the stepper motor to rotate a 42 fixed Angle (stepping Angle) in the set direction. The angular displacement can be controlled by controlling the pulse, so as to achieve the purpose of accurate positioning. At the same time, the speed and acceleration of the motor can be controlled by controlling the pulse frequency, so as to achieve the purpose of speed regulation. The physical picture of the stepper motor is shown in Figure 6. Motor 1 in the system: used to control the up and down direction of the photovoltaic power generation panel; Motor 2: used to control the left and right direction of the photovoltaic power generation panel. 2.2. System Working Principle 2.2.1. Light Intensity (1) Four photoresistors constantly detect the surrounding light intensity and output the corresponding analog signal. (2) The analog signal is converted to digital through ADC (analog-to-digital converter) and input to the MCU. 2.2.2. Comparison of Light Intensity The microcontroller receives the digital output of four photoresistors and compares them: (1) Upper and lower comparison: if the value of the upper photoresistor (L1) is greater than the value of the lower photoresistor (L2), it indicates that the upper light is stronger, and the single-chip microcomputer drives the motor 1 reverse; If the value of the lower photoresistor (L2) is greater than the value of the upper photoresistor (L1), the motor 1 is in positive rotation. (2) left-right comparison: if the value of the left photoresistor (L3) is greater than the value of the right photoresistor (L4), it indicates that the left side of the light is stronger, and the single-chip microcomputer drives the motor 2 forward rotation; If the value of the right photoresistor (L4) is greater than the value of the left photoresistor (L3), the motor 2 is reversed. (3) Motor control: According to the results of comparison, the single chip microcomputer changes the direction of rotation of the motor by controlling the motor drive module. Motor 1 Adjust the pitch Angle of the photovoltaic panel according to the comparison of the upper and lower light intensity; Motor 2 Adjust the orientation of the photovoltaic panel according to the comparison of the left and right light intensity. 3. Software Design 3.1. Software Design Idea (1) System initialization: Configure the ADC (analog to digital conversion) module to read the photoresistor signal and initialize the control port. (2) Light intensity reading: Periodically read the status of the four photoresistors and convert them into digital signals. (3) Compare the light intensity: Compare the strength of the upper and lower photoresistors to control the rotation direction of motor 1. Compare the intensity of the left and right photoresistors to control the rotation direction of motor 2. (4) Motor control: According to the comparison of light intensity, the motor is controlled by the single chip microcomputer to reverse or turn forward. (5) Repeat the above steps. 3.2. Programming Flow Chart According to the above process, 51 MCU control program diagram is written, and the corresponding program is written, and the photoresistor data acquisition and stepper motor control logic is realized. Figure 7. Main program flow chart 4. Experiment and Result Field experiments are carried out by setting up a photovoltaic solar panel tracking system. According to the change of light intensity in different time periods and different weather conditions, it can be observed that the stepper motor constantly rotates in the direction of the strongest light intensity, indicating that the system can effectively respond to changes in external light. The intelligent tracking system of photovoltaic solar panel based on 51 single chip microcomputer designed in this paper can effectively improve the utilization efficiency of solar energy through real-time monitoring of photoresistor and intelligent control of stepper motor. In the future, the system can be further optimized to add more flexible multi-axis tracking capabilities and energy management strategies. References [1] WANG Yongbin. Design of Data collector and waveform generator based on PCF8591 Single chip [J]. Modern industrial economy and information technology, 2023, 13 (5): 105-107. The DOI: 10.16525 / j. carol carroll nki. 14-1362 / n. 2023. 05. 036. [2] He Xiaoying. Sun light protection system based on single chip design [J]. Journal of electronics, 2023, 31 (3): 37 + 35-69 DOI: 10.16589 / j. carol carroll nki cn11-3571 / tn. 2023.03.014. [3] Guo Hao, ZHAO Shuzhong. Stepper Motor Control Based on MCU [J]. Mechanical Engineering & Automation, 2018, (01): 169-170+173.