Design of solar controller based on AVR

Publisher:程序界的行者Latest update time:2011-06-11 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: In order to control the optimal charging and discharging of batteries in solar power generation systems, a low-power and high-performance RISC microcontroller AVR is used as the core of the control circuit to design a solar intelligent controller with high reliability and good performance, and the control principle of the controller is analyzed in detail. The test results show that the controller can correctly monitor and measure the state of the battery, has good charging and discharging effects, reliable performance, can reduce charging losses, and extend the service life of the battery.
Keywords: solar cell; PWM; controller; AVR


With the deepening of energy crisis and environmental pollution, the research and utilization of solar energy has received widespread attention. Solar energy is an inexhaustible renewable energy source for human beings. It is also a clean energy source that does not produce any environmental pollution. In the effective utilization of solar energy, solar charging is the fastest-growing and most dynamic research field in recent years, and is one of the most watched projects. Solar cell power generation is based on the principle of "photovoltaic effect", which converts solar energy into electrical energy and uses the charging effect to directly convert solar radiation into electrical energy. It has the advantages of permanence, cleanliness and flexibility, which are unmatched by other energy sources.

1 Design of solar controller
1.1 Output characteristics of solar cells
From its output characteristic curve (see Figure 1), it can be seen that the volt-ampere characteristics of solar cells are highly nonlinear, that is, when the sunlight intensity changes, its open circuit voltage will not change much, but the maximum current generated will change significantly, so its output power and maximum power point will change accordingly. However, when the light intensity is constant, the current output by the solar panel is constant, which can be considered as a constant current source. Therefore, it is necessary to study and design a solar power controller with excellent performance in order to make more effective use of solar energy.

1.2 System Hardware Structure
The hardware structure of the solar controller is shown in Figure 2. The controller uses AVR mega 32 as the control core, and the peripheral circuit is mainly composed of battery voltage and ambient temperature detection and charge and discharge control circuit, battery panel voltage detection and group switching circuit, load current detection and output control circuit, status display circuit, serial port data upload and keyboard input circuit.

The voltage detection circuit is used to identify the intensity of light and obtain the battery terminal voltage. The temperature detection circuit is used for battery charging temperature compensation. The system uses PWM to drive the charging circuit to control the optimal charging and discharging of the battery. The battery panel group switching control circuit is used to switch the battery panels under different light intensities and charging modes. The system realizes the control of 3 groups of battery panel arrays. The load current detection circuit is used for overcurrent protection and load power detection. The status display circuit is used to display the system status, including the display of voltage, load status and charging and discharging status. The serial port upload data circuit is used to upload the system operation parameters to achieve remote monitoring. The keyboard input circuit is used to set the charging mode and turn on the LCD backlight. The controller connects the battery panel to charge the battery when there is sunlight; when there is insufficient sunlight at night or on cloudy days, the battery is discharged to ensure that the load does not stop power supply.
1.3 AVR microcontroller
AVR microprocessor is an 8-bit embedded RISC processor of Atmel Company, which has the advantages of high performance, high confidentiality and low power consumption. The Harvard structure with independent access to program memory and data memory has high code execution efficiency. The mega 32 processor used in the system includes 32 KB on-chip programmable FLASH program memory; 1 KB E2PROM and 2 KB RAM; watchdog integrated in the chip; 8-way 10-bit ADC; 3-way programmable PWM output; online system programming function, rich on-chip resources, high integration, easy to use. AVR mega 32 can easily realize the setting of external input parameters, management of batteries and loads, indication of working status, etc.
1.4 Battery charging and discharging control
Valve-controlled sealed lead-acid batteries have the advantages of large energy storage, good safety and sealing performance, long life, and maintenance-free, and are widely used in photovoltaic systems. From the charge and discharge characteristic diagram of valve-controlled sealed lead-acid batteries (see Figure 3), it can be seen that the battery charging process has three stages: the initial (OA) voltage rises rapidly; the middle (ABC) voltage rises slowly and lasts for a long time; point C is the end of charging, and the voltage begins to rise; when approaching point D, the water in the battery is electrolyzed, and charging should be stopped immediately to prevent damage to the battery. Therefore, the method usually adopted for charging the battery is to quickly charge it in the initial and middle stages to restore the capacity of the battery; and to use a small current for a long time at the end of charging to replenish the battery's power lost due to self-discharge.

There are three main stages in the battery discharge process: the voltage drops quickly at the beginning (OE) stage; the voltage drops slowly in the middle (EFG) stage and lasts for a long time; after the G point in the final stage, the discharge voltage drops sharply, and the discharge should be stopped immediately, otherwise the battery will be irreversibly damaged. Therefore, if the control method for the charge and discharge of the valve-controlled sealed lead-acid battery is unreasonable, not only will the charging efficiency be reduced, but the life of the battery will also be greatly shortened, resulting in an increase in the system operating cost. In the process of charging and discharging the battery, in addition to setting the appropriate charge and discharge threshold, it is also necessary to perform appropriate temperature compensation on the charge and discharge threshold, and perform necessary overcharge and over-discharge protection.
According to the characteristics of the valve-controlled sealed lead-acid battery, the controller uses the PWM function of the MCU to manage the battery charge. If the battery is open-circuited when the solar cell is charging normally, the controller will turn off the load to ensure that the load is not damaged; if the battery is open-circuited at night or when the solar cell is not charging, the controller will not take any action because it cannot get power. When the charging voltage is higher than the protection voltage (15 V), the battery charging is automatically shut down; thereafter, when the voltage drops to the maintenance voltage (13.2 V), the battery enters the floating charge state. When it is lower than the maintenance voltage (13.2 V), the floating charge is shut down and the battery enters the equalization charge state. When the battery voltage is lower than the protection voltage (10.8 V), the controller automatically shuts down the load to protect the battery from damage. If over-discharge occurs, boost charging should be performed first to restore the battery voltage to the boost voltage and then maintain it for a certain period of time to prevent the battery from sulfidation. By controlling the charging circuit with PWM (intelligent three-stage charging), the solar panel can be maximized and the system charging efficiency can be improved.


1.5 Temperature compensation
The digital temperature sensor DS18820 is used to detect the ambient temperature of the battery. The temperature compensation coefficient for the battery charging threshold voltage is -4mV/(℃·cell). The compensated voltage threshold can be expressed by the following formula: Ve=V+(t-25)αn. Among them, Ve is the compensated voltage threshold; V is the voltage threshold at 25℃; t is the ambient temperature of the battery discharge; α is the temperature compensation coefficient; n is the number of cells in series. The controller does not compensate for the over-discharge voltage threshold.
1.6 MOSFET drive circuit
The designed controller is of series type, that is, the switch that controls the charging is connected in series between the solar panel and the battery. Compared with the parallel controller, the series controller can more effectively utilize solar energy and reduce the heat generated by the system. MOSFET is used to realize the switch in the design. MOSFET is a voltage-controlled unipolar metal oxide semiconductor field effect transistor, which requires less driving power. Moreover, only the majority carriers of MOSFET participate in the conduction, and there is no recombination time for minority carriers, so the switching frequency can be very high, which is particularly suitable as a PWM control charging switch. For this reason, P-channel MOSFET is used in the design. The on-state voltage Vth of the P-channel MOSFET is less than 0, and the MOSFET can be driven by Figure 4. When Q2 is turned on, since the Vce of Q2 is very small, it can be considered that the G pole of Q1 is grounded, Vgs<0, and when Vin reaches a certain value, Q1 is turned on.

1.7 Keyboard circuit
Single-button input is used to turn on the LCD backlight and set the charging mode. PC7 is output high level during initialization. During program execution, a timer interrupt is used to detect whether a key is pressed. When a key is pressed for less than 10 s, the LCD backlight is turned on, and the backlight is turned off after 10 s. When a key is pressed for more than 10 s, the mode setting is entered. In the setting mode, the mode is incremented by 1 each time the key is pressed. After 10 s of pressing the key or if there is no action on the key for 10 s, the mode is saved in the E2PROM and the setting mode is exited.
1.8 Status display and alarm circuit
The controller uses LCD1602 to display the status information of the system, including battery voltage, load power, etc. LCD1602 adopts a 7-wire drive method, and Vo is connected to a 1 kΩ resistor to ground to adjust the contrast of the LCD display. Display data and instructions are written through DB4~DB7 of LCD1602, and it also has an audible and visual alarm function. When overvoltage or overdischarge occurs, the corresponding LED flashes and the buzzer sounds an alarm, and the corresponding alarm relay is turned on.
1.9 Data upload
The controller uses the RS 232 serial port to upload system voltage, temperature, charge and discharge status, and load status data to achieve remote monitoring.

2 Software flow chart of the controller
The main program mainly completes the initialization of I/O, timer and PWM, and calls the corresponding charging and discharging electronic program according to the status of the battery board and battery. The measurement of controller parameters is mainly completed by the interrupt service program.

3 Conclusion
The solar controller designed here has stable performance, overcharge and overdischarge protection and temperature compensation. After testing, the system shows good control effect, which not only improves the working efficiency of solar cells, but also protects the batteries used. In terms of the use of green energy, it has certain social benefits and wide promotion value.

Reference address:Design of solar controller based on AVR

Previous article:A control system design based on DSP+FPGA
Next article:Design of Injection Molding Machine Controller Based on LPC2138

Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号