Begging... Design of automatic tracking sunlight solar water heater control system based on 51 microcontroller
The development and utilization of green energy is a measure in response to my country's energy conservation, emission reduction and environmental protection policies. Solar energy is sustainable, zero pollution, has high environmental value and economic benefits. Efficient use of solar energy can also be effective. Substitute some fossil energy, thereby reducing pollution caused by the combustion of petrochemical energy and mitigating smog. However, rural areas are rich in solar energy, but it has not been well utilized. Even existing power generation products mostly use fixed brackets for solar panels. This topic proposes a pan-tilt bracket that can track the direction of the sun, which can realize automatic adjustment of solar panels and always face the side with the strongest light, improving the utilization rate of solar power generation. The subject consists of pan/tilt, motor drive, controller, light sensor, liquid crystal display, etc. The results of the subject can not only be used for solar power generation, but also can be used in other light-oriented places, such as astronomical observation, etc., which has high practical value.
With the progress of the times and the rapid development of science and technology, the demand for energy has increased, and the over-reliance on non-renewable energy [1] has led to a sharp reduction in the storage capacity of non-renewable energy. Some Non-renewable energy (petroleum) is regarded as a strategic resource. According to current statistics, coal, oil, and natural gas will become increasingly depleted and consumed over the years. The generation of these non-renewable energy sources obviously cannot keep up with human demand for them. In order to better achieve sustainable development, this topic proposes a feasible solution for solar tracking, which can greatly enhance the utilization of solar energy and reduce the use of non-renewable resources. over-reliance.
In order to solve people's over-reliance on non-renewable resources and high utilization of clean energy. It is proposed to design a zero-pollution and high-efficiency device - a solar tracker. Through the cooperation between motors, controllers, lighting panel light sensors and other components, the direction with the strongest sunlight exposure is achieved, and all-round tracking without blind spots is achieved. It happens that such a safe, environmentally friendly, high-efficiency, and As well as being inexhaustible, it is also very convenient to obtain. For example, wind energy and tidal energy are absolutely pollution-free and clean energy sources, which also illustrates the feasibility of light energy [2]. ——The design and production of sun tracking device are proposed in this regard.
Advantages: The sun serves as an inexhaustible source of energy. It is mentioned in "Solar Energy Utilization Technology" [3] that the energy reaching the earth's surface is equivalent to continuously putting 5 million tons of coal into the earth every second. Wherever the sun goes, there is wealth. While it is free to use, there is no need to consider any transportation costs and zero pollution.
Disadvantages: Even though it seems perfect, there are two fatal shortcomings [4]: First, the energy flow density is very small; second, the intensity of the sun will also change due to (weather, white night) There is a big gap due to different factors, etc., and it is difficult to maintain a constant value for a long time, which also greatly affects the use efficiency to a certain extent [5].
Foreign solar trackers: The use of solar energy from 2004 to 2006 was an astonishing 4961MW [6]. In 1997, the United States Blackace developed a single-axis tracker, which increased the heat absorption rate by 15%... The later stage focused on high efficiency and light weight. It has been used in solar yachts, solar aircraft, solar tiles, etc., and has also witnessed the high efficiency of solar energy utilization [7].
Domestic solar trackers: The application market has been continuously expanding. The use of solar trackers is also a very popular topic. Through many years of experience, it has been used in solar water heaters, solar Street lights, as well as the Western Plan, solar power generation, solar heating, etc. [8].
More often, single-axis tracking is adopted. In contrast, multi-axis is needed to achieve all-round tracking without blind spots.
According to different conditions, two working methods of automatic control and manual adjustment are proposed:
Among them, "automatic mode" is summarized: In the process of automatic pursuit, it will automatically judge The intensity of the light. If the intensity of the light below is greater than the intensity of the light above, the STM32 microcontroller will directly drive the upper motor to flip downwards so that more light can be obtained when the sun sets in the afternoon. If the intensity of the light above is greater than the intensity of the light below Intensity, the STM32 microcontroller will directly drive the upper stepper motor to move upward; if the light intensity in the upper and lower directions is equal, the upper stepper motor will not move. In the case of uniform illumination up and down and movement in the left and right directions, the light intensity in the right direction is greater than that in the left direction. The STM32 microcontroller directly drives the first stepper motor in the lower direction to rotate at a certain angle in the left direction; if the light intensity in the left direction is greater than that in the right direction, According to the light intensity, the STM32 microcontroller directly drives the first stepper motor in the lower direction to move to the left; when the left and right lighting levels are almost even, the first motor in the lower direction will also remain stationary.
The "Manual mode" state uses buttons to manually switch the device state. The four buttons correspond to controlling the motor to complete: up, down, left, and right flipping movements. The actual movement of the stepper motor is controlled by jogging.
After powering on the equipment system, the system is initially in "automatic mode", which can better achieve maximum reception of solar energy without human intervention.
Selection of compiled language
Option 1: C language
Simple, compact, flexible and convenient; richness of operators; richness of data structures; structural language ;Small syntax limitations, large degree of freedom in program writing; direct access to the physical address enables direct control of the hardware; high program execution efficiency.
C language is process-oriented, and the most important thing is algorithms and data structures. Through a process, the input is processed to obtain the output.
Option 2: C++
C++ language is an object-oriented language. Based on C, it adds features of current programming languages such as object-oriented and templates. The content of object-oriented design has been expanded to make it more in line with the needs of modern programming.
It seems that C++ has many more advantages and features than C, but C++ is not suitable for all occasions. Many embedded development systems only provide a C language development environment, but do not provide C++ development. environment. There are many dirty and tiring tasks that C++ language is unwilling to do, but C language is very happy to do them. C++ is slightly inferior in this regard because it is too complex.
Option 3: Java
Java is an interpreted language. Java is extremely popular, but its code needs to be interpreted before running, so its performance is worse. C++ is compiled into a binary form, so it runs immediately and faster. If both programs are large enough and the C++ code is optimized, the speed difference between the two will become significant or even alarming. C++ will be much faster than Java.
Considering the complexity of the system, and the calculation amount of the whole process is relatively large, I chose the floating-point calculation method and option 1 as the compilation method of the entire system.
2.2 Selection of the overall control system plan
Option 1: Solar tracking mode
Such a mode is based on astronomical formulas to determine the position of the sun. The theoretical azimuth and pitch angles at different times are then programmed according to the actual local trajectory of the sun every day. The calculation of the sun's position is realized by using the control algorithm, and finally by driving the solar panel. Two stepper motors to achieve pitch and azimuth rotation. One thing is that it has little dependence on the external environment, but there are also disadvantages, that is, no matter what the weather is like in the external environment, it will move in the same working way, which increases unnecessary energy consumption and life wear of components.
The two position parameters of the sun's pitch angle h and azimuth angle A can be expressed as follows:
δ is the declination angle, Φ is the local latitude, and Ω represents the solar time horn.
Option 2: Photoelectric tracking mode
The core algorithm of this mode is to use a photosensitive sensor to detect the position of the sun. Specific method: Install photosensitive sensors completely symmetrically on both sides of the sun visor. When sunlight shines vertically on the solar photovoltaic panel, the electrical signals generated by the photosensitive sensors installed on both sides are equal, and the two signals are amplified. Then it is sent to the comparator for comparison. At this time, the stepper motor is not driven to rotate. When the position of the sun moves, the sun visor blocks the sunlight. At this time, the electrical signals generated by the photosensitive sensors on both sides are not equal, and a difference signal is generated after amplification and comparison. The motor starts to move, completing the sun tracking process.
Through the comparison between the two, the second option is simple and easy to operate, and is more suitable for widespread use. Under the same conditions of use, the simplest option is the best option.
2.3 Main control system selection
Option 1: 51 microcontroller as the control chip. The main performance is as follows: the main control parameters are realized using setting register variables. In terms of program modification, it is also very convenient and fast, the cost is relatively low, and the performance matches the relatively simple solar tracking device system; the digital control system can Achieve higher accuracy.
Option 2: Use large-scale programmable logic devices such as FPGA, but this question belongs to the control category, namely field programmable gate array [WJ1], which is based on programmable devices such as PAL and EPLD. -The product of one step development.
Option 3: ARM as a high-performance embedded system. Considering the feasibility of the solution, STM32 can solve the data processing and control functions very well, and is very suitable for solar tracking. Although ARM is expensive, it has more room for expansion in the later stage. [WJ2]
Based on the task requirements of this design and the relative comparison of the three options, the third option was finally selected to be more suitable for the design standards of this project, specifically using STM32F103C8T6.
2.4 Motor Selection
Option 1: Choose a stepper motor. However, the biggest advantage of a stepper motor is that it can accurately control the number of steps and angles of the motor. The disadvantage is that it is expensive.
Option 2: Choose a DC motor. Cheap price is one of its highlights. The torque can be increased through reduction gears and it has a larger load. However, the high-precision control of the DC motor cannot meet the design requirements.
Stepper motor is an electromagnetic mechanical device that converts electrical pulses into corresponding angular displacement or linear displacement. By directly controlling the number of input pulses and directly controlling its start and stop, the start-up speed is fast, the step angle and rotational speed only depend on the pulse frequency, and are less affected by external factors. Therefore, for the requirements of this design task, in order to more accurately control the angle value and make better use of solar energy, I chose Scheme 1 as the drive motor designed for this course.
2.5 Stepper motor drive system selection
Option 1: Selection of L298 professional motor drive module. This type of drive module is easy to operate and has a simple interface. At the same time, they can drive stepper motors. , and can also drive DC motors.
Option 2: Use discrete components such as transistors to build an H-bridge. The highlight is its affordable size, simple control method and simple structure. The advantages are also accompanied by disadvantages. The current carrying capacity is relatively small, the same driving ability is limited, the discrete components are larger and the stability is not guaranteed.
Option 3: Use integrated chip, ULN2003. .
Darlington tube ULN2003, this chip can drive up to eight stepper motors at one time. This design acts on two stepper motors. In actual use, it often plays the role of output. Used to drive stepper motors with large loads, etc.
After comprehensive consideration in this design and based on actual design requirements, option three is selected as the drive system of the stepper motor.
2.6 Selection of solid structure frame
Option 1: The two motors are in a vertical state with each other, the first motor rotates left and right and the second motor rotates up and down, without introducing external conditions and auxiliary equipment In this case, there will be a movement dead zone, which is not advisable from the perspective of cost.
Option 2: Change the two motors from the previous vertical installation to an installation greater than 90°. Without introducing external equipment, the dead corners of movement can be well avoided, thus achieving full range of motion. There is no blind spot tracking in the orientation. Based on the above situation, option 2 is selected for this physical structure design.
2.2 System Design
2.2.1 The structure of the microcontroller is as follows:
The logic is not smooth, and it is necessary to point out the shortcomings of FPGA that are not suitable for this question
< p>STM32 is much cheaper overall than FPGA. It is recommended to modify this argument, or make a cost comparison table before drawing a conclusionControl method: The first step is to input the data program into the input device, and the input device will The program is transmitted to the arithmetic unit CPU and memory, and each program is correspondingly transmitted to the controller. The controller completes the mutual instruction transfer, and finally acts on the output device. The result displayed on the output device is what the original program wants. expression effect.
2.2.2 The overall control block diagram of the system is as follows:
Figure 2–2-2 The overall control block diagram of the system
Control method: complete the entire drive control, first The first step is to collect the external light from the photosensitive element and the photoresistor sensor, complete the voltage following, through A/D conversion, and then compare the voltage, use the STM32F103C8T6 microcontroller to control the drive of the motor, and finally complete the different functions of different motors under different light intensities. directional movement, and finally achieve maximum reception of light.
2.2.3 The motor control block diagram is as follows:
Figure 2–2–3 Motor control block diagram
Control method: through the collection of light by a photosensitive sensor. Finally, different selection and control of motor movement modes are achieved.
When the light intensity value received by the first group of photosensitive components is greater than the light intensity in the other three directions, the motor completes the forward rotation of the horizontal direction and returns to the initial state.
When the light intensity value received by the second group of photosensitive components is greater than the light intensity in the other three directions, the motor completes the horizontal motor reversal and returns to the initial state.
When the light intensity value received by the third group of photosensitive components is greater than the light intensity in the other three directions, the motor completes the forward rotation of the vertical direction and returns to the initial state.
When the light intensity value received by the fourth group of photosensitive components is greater than the light intensity in the other three directions, then the motor completes the vertical direction of the motor and returns to the initial state.
When all the photosensitive components are uniformly illuminated by the receiving tube, the light intensity at this time is almost equal, which means that the motor remains motionless.
2.2.4 The overall circuit schematic diagram is as follows:
Figure 2-2-4 Overall circuit schematic diagram
The overall system software design process is as shown in Figure 2-2 -4 is shown. After the system is started, the software first performs initialization and other work. When the program initialization is completed, the current light intensity is obtained through the photosensitive component, and then according to the initialization parameters, the stepper motor is controlled to rotate the solar photovoltaic panel to the theoretical initial state and predetermined orientation. . After the solar photovoltaic panel is rotated to the theoretical position, the program begins to determine whether the stepper motor rotation mode is manual mode or automatic. The initial default state is automatic tracking mode.
When in manual mode, the motor controls the status of the four buttons up, down, left, and right, so that the motor moves in the direction expected, thereby controlling different vertical rotations and horizontal movements in the four directions. Pitch and azimuth. When the program determines that it is in automatic mode, it starts to automatically read the return signal of the detection circuit. When it is detected that there is a large difference in the light intensity values in various directions, then the microcontroller will issue a control instruction to control the stepper motor to rotate, and the stepper motor will rotate. The voltage module exists to provide stable power supply to the entire system.