Design of intelligent light-chasing lithium battery charging system

Publisher:EtherealGlowLatest update time:2014-07-28 Source: 互联网 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Preface

The development of solar cells began in the 1950s, and was initially used in the fields of space development, aerospace, etc. After nearly 50 years of development, solar cells are the best among new energy sources in terms of development speed, technical maturity, and application fields. Solar cells have many advantages, such as: safe and reliable, no noise, no pollution, energy is available everywhere, not limited by geographical location, no need to consume fuel, can be unattended, short station construction cycle, arbitrary scale, and can be easily combined with buildings, etc. These advantages are beyond the reach of other power generation methods. However, solar cells are not an ideal power source. Their output characteristics are affected by light intensity and light spectrum, and the output current is very unstable. Therefore, solar cells cannot directly drive electrical devices, but need to be stored in batteries first, and then the batteries are used to power electrical devices.

 

At present, people often use batteries as power storage devices for solar cells. However, the maintenance of batteries is complicated and requires a special battery room with corrosive gas discharge. They must be initially charged on site for 50-90 hours and require special maintenance. Moreover, failure to perform restorative charging in time will damage the battery. Batteries are also very sensitive to temperature and have a short lifespan.

 

As one of the secondary batteries, lithium battery has the advantages of high energy density, high operating voltage, low self-discharge, fast charge and discharge, long life, wide allowable temperature range, small size, high output power, no memory effect and no environmental pollution. Its comprehensive performance is better than lead-acid, nickel-cadmium, nickel-metal hydride and metal lithium batteries, and it is known as the best performance battery. Although lithium batteries also have disadvantages, compared with their advantages, those disadvantages should not become the main problem, especially when used in some high-tech, high value-added products. At present, lithium batteries are growing rapidly in the market, with high profits, and have become a research project that many advanced countries are competing to develop. Its future demand and development prospects are quite good.

 

In view of the above reasons, lithium batteries can be used to replace storage batteries as the power storage device of solar cells. The subsequent lithium battery charging problem has become an important issue in the application of lithium batteries. The existing lithium battery chargers on the market are either not versatile enough or do not meet the requirements for accuracy. Moreover, with the rapid development of the solar energy industry and the gradual reduction of non-renewable resources, the existing AC power supply chargers are bound to be replaced.

 

In order to achieve high-precision control of lithium battery charging and discharging under solar power supply, improve the working performance of lithium batteries, and extend the life of lithium batteries, this paper designs a light-chasing intelligent lithium battery charging system based on AVR microcontroller, which realizes intelligent light chasing and ensures that lithium batteries will not be damaged by overcharging or overheating, greatly improving safety performance and extending the service life of lithium batteries. The system also displays the status of lithium batteries in real time on the host computer interface by communicating with the host computer, which facilitates the intelligent management of lithium batteries. The system also has the characteristics of strong circuit stability, high reliability, high control accuracy, simple operation, and easy software upgrade.

 

Light chasing and basic principles of lithium battery charging

Light chasing principle

Single-axis tracking

The advantage of single-axis tracking light is its simple structure, but because the incident light cannot always be parallel to the main optical axis, the effect of collecting solar energy is not ideal.

 

Figure 1 is an example of single-axis tracking and tracing.

 

Figure 1 Single-axis tracking

 

Dual-axis tracking

Dual-axis tracking can obtain the most solar energy by tracking the changes in the sun's altitude and declination, but its structure is complex and the cost is relatively high.

 

The schematic diagram of dual-axis tracking and light chasing is shown in Figure 2.

 

Figure 2 Dual-axis tracking

 

Photoelectric tracking

Photoelectric detection is to detect the changes in the solar altitude and azimuth angles. Three photoresistors can be used to convert light signals into electrical signals to form a bridge circuit. The A/D channels of the microcontroller are connected through the circuit shown in Figure 3. The microprocessor controls the motor action based on the voltage data obtained.

 

Figure 3 Photoelectric tracking

 

Sun motion tracking

Since the sun's altitude and azimuth determine its position, we can determine the sun's position based on the local longitude and latitude, and then adjust the angle between the solar panels and the ground to achieve light chasing.

 

The geometric mathematical model for calculating the sun's position is shown in Figure 4.

 

Figure 4. Tracking of apparent solar motion trajectory

 

Photoelectric tracking and solar motion trajectory tracking combined with light chasing

The design method that combines photoelectric tracking with apparent solar motion trajectory tracking can enhance the stability of the system, improve the tracking accuracy of the system, and enable tracking of the sun in all weather conditions.

Lithium battery charging principle

(1) Lithium battery charging requirements

The charging requirements for lithium batteries are:

 

① The tolerance of the termination charging voltage is ±1% of the rated value. Overvoltage charging will cause permanent damage to the lithium-ion battery.

 

② The charging rate is usually 0.5C-1C. When using a 0.5C charging rate, there will be a certain amount of energy loss because the electrochemical reaction during the charging process will generate heat.

 

③ The temperature range for charging lithium-ion batteries is 0℃-60℃. If the current is too large, the temperature will be too high, which will not only damage the battery, but may also cause an explosion.

 

④ The termination discharge voltage of lithium-ion batteries is 2.5V. Severe over-discharge may cause lithium-ion batteries to fail. Over-discharged batteries can be remedied through pre-treatment. When the lithium-ion battery voltage is greater than 2.5V, charge it in the normal way; if the lithium-ion battery is lower than 2.5V, charge it with a small current, and charge it in the normal way after it reaches 2.5V.

 

During the use of lithium batteries, in order to ensure safety and extend the life of lithium batteries, a lithium battery protection board must be added. For detailed information on the lithium battery protection board, please refer to Appendix 1.

 

(2) Constant current charging

The constant current charging method can make the battery have a higher charging efficiency. This method uses a constant current to charge the battery during the entire charging process, as shown in Figure 5. This method is simple to operate and easy to do, and is particularly suitable for charging a battery pack consisting of multiple batteries connected in series. However, since the acceptable current capacity of lithium batteries gradually decreases as the charging process proceeds, in the later stage of charging, if the charging current remains unchanged, the charging current is mostly used for electrolytes, generating a large number of bubbles, which not only consumes electrical energy, but also easily causes the active material on the plate to fall off, affecting the life of the lithium battery.

 

Figure 5 Constant current charging

 

(3) Constant voltage charging

In the constant voltage charging method, the voltage across the battery determines the charging current. The voltage of the charging power supply maintains a constant value throughout the charging time. As the voltage at the lithium battery terminal gradually increases, the current gradually decreases. The charging current changes with voltage fluctuations, so the maximum value of the charging current should be set when the charging voltage is the highest to avoid overcharging the battery. In fact, the constant voltage charging curve is shown in Figure 6. It can be seen from the figure that the charging current is too large at the beginning of charging, which will have a great impact on the life of the lithium battery. In addition, in this charging method, the battery temperature will rise at the end of charging, which is likely to cause thermal runaway of the battery and damage the battery performance. Therefore, the constant voltage charging method is not recommended.

 

Figure 6 Constant voltage charging

 

(4) Constant current and constant voltage charging

Based on the above two charging methods, charging starts with constant current. During the constant current charging cycle, the battery terminal voltage is constantly monitored to prevent overcharging. When the voltage reaches the set terminal voltage, the circuit switches to constant voltage charging until the battery is fully charged. During constant current charging, the battery can be charged at a higher current intensity. During this period, the battery is charged to about 85% of its capacity, and the voltage increases at a higher slope, and the slope gradually decreases during the charging process. In the constant voltage cycle, the battery voltage is constant and the charging current gradually decreases. When the current drops to less than 1/10 of the battery capacity, the charging cycle is completed, which is also called the two-stage charging method. The constant current and constant voltage charging curve is shown in Figure 7.

 

Figure 7 Constant current and constant voltage charging

 

3. System design and solution demonstration

1. Overall design

The system block diagram is shown in Figure 8.

 

Figure 8 System Block Diagram

 

The design of this system mainly consists of six parts: light chasing control, voltage conversion, optocoupler switch control, charging control, lighting control and host computer interface control. Light chasing and charging are the core of this system. Light chasing control adopts the method of photoelectric tracking and visual sun motion trajectory tracking. The charging part adopts the CN3063 charging management chip that can be powered by solar cells, and combines temperature detection, optocoupler and other controls to realize the function of intelligent charging, and can effectively protect lithium batteries, activate lithium batteries and improve the performance of lithium batteries. Based on the change of the output voltage of the solar panel, the step-up/step-down circuit is considered to obtain the best charging regulation. In the lighting state control part, a photoresistor is used to detect the intensity of external light to control the on and off of the lighting, and PWM (pulse width modulation) is used to adjust the brightness of the lighting. The host computer console is used to observe the output voltage of the solar cell, the terminal voltage of the lithium battery, and the temperature of the lithium battery, and provides manual control functions, which realizes manual management while being intelligent.

 

2. Detailed design

(1) Lithium battery and solar cell selection

①Lithium battery selection

Based on considerations of safety, lightness and capacity, we use 4000mAh polymer lithium batteries and aluminum-plastic packaging. Different from the metal shell of liquid lithium batteries, they will not explode but only swell in case of safety hazards. They are light in weight, 40% lighter than steel shell liquid lithium batteries and 20% lighter than aluminum shell liquid lithium batteries. They have large capacity and small internal resistance, which is smaller than the internal resistance of conventional batteries, making the effective discharge capacity higher than other batteries. The shape can be customized and the colloidal electrolyte is used, which has more stable discharge characteristics and a higher discharge platform. They have high operating voltage, high energy density, long cycle life, no memory effect, low self-discharge and no pollution.

 

Scope of application: communication equipment (mobile phones, Internet phones, intercoms, Bluetooth headsets), mobile office equipment (notebook computers, PDAs, portable fax machines, printers), imaging equipment (digital cameras, camcorders, mobile DVDs, mobile TVs, MP3, MP4), others (flashlights, mining lamps, toys, aircraft models).

②Solar cell selection

When selecting solar cells, it is necessary to comprehensively consider their material, process, weight, photoelectric conversion efficiency, power, etc. The parameters of the solar panel used in this system are shown in Table 1.

 

Table 1 Selected solar cell parameters

Specification

110*134mm

Open circuit voltage

9V

Short circuit current

170mA

power

1.5W

Technology

Single crystal silicon lamination process

 
 

Considering the actual output power of solar cells and the power consumption of the system itself, we connect four solar panels with parameters shown in Table 1 in parallel. The parallel connection method is shown in Figure 9.

 

(2) Voltage conversion part

① Buck circuit

Solution 1: Use the LM7805 chip to convert the solar output voltage into 5V. This chip is cheap, but its disadvantages are high power consumption and low efficiency, which is not conducive to the solar-powered charging system.

 

Solution 2: Use the LM1117 chip. The LM1117 is a low-dropout third-generation linear voltage regulator chip with positive voltage output. It has internal overheat protection and current limiting circuits, low power consumption, and internally limits the maximum power consumption, making it suitable for battery chargers. For fixed voltage output, a smaller capacitor can be used.

 

The complexity of the peripheral circuits of the above two solutions is basically the same. Although the price of LM1117 is much higher than that of LM7805, considering the rectifier power consumption, we choose LM1117 as the buck chip. The application circuit is shown in Figure 10.

 

Figure 10 Buck circuit

 

②Boost circuit

 Solution 1: Use MC34063 as a boost chip. MC34063 is dedicated to the control part of the DC-DC converter. It contains a temperature-compensated bandgap reference source, a duty cycle control oscillator, a driver and a high-current output switch, which can output a switching current of 1.5A. It can use the least external components to form a switch-type boost converter, a buck converter and a power inverter.

 

 

Solution 2: Use transistors, capacitors, inductors, and resistors to build a boost circuit. This solution is more complicated and cannot produce a stable voltage when the input voltage fluctuates.

 

Through comparison, we choose solution 1. The advantage of this solution is that it can obtain a stable output voltage when the output voltage of the solar panel fluctuates. Its application circuit is shown in Figure 11.

 

Figure 11 Boost circuit

 

(3) Charging switch circuit

Solution 1: Use an ordinary relay as the charging switch. Due to mechanical movement, sparks may occur and the switching time is long.

 

Solution 2: Use TLP521 optocoupler as charging switch. TLP521 is a contactless switch element composed entirely of solid-state electronic components. It uses the electrical, magnetic and optical characteristics of electronic components to achieve reliable isolation between input and output, and uses the switching characteristics of high-power transistors, power field-effect transistors, unidirectional thyristors and other devices to achieve contactless and sparkless connection and disconnection of the controlled circuit. Based on the above advantages, we use optocoupler as a switch device, and its application circuit is shown in Figure 12.

 

Figure 12 Optocoupler switch

 

When the microcontroller loses power suddenly, the charging circuit may be mistakenly turned on due to the low level of I/O. Therefore, an external inverter 7SLS04 is used to control the high level to prevent the charging circuit from being mistakenly turned on.

 

(4) Charging control part

Solution 1: Use the charging management chip MAX1898. MAX1898 and external transistor PNP or PMOS

 

The charger can accurately perform constant current/constant voltage charging, with a battery voltage accuracy of ±0.75%, controllable charging current, automatic input power monitor, self-start charging and other functions. However, the MAX1898 requires a stable voltage input and is not used in solar-powered systems.

 

Solution 2: Use the charging management chip CN3063 powered by solar cells. The device includes a power transistor inside, and does not require an external current detection resistor and blocking diode when used; it has an 8-bit analog-to-digital conversion circuit inside, which can automatically adjust the charging current according to the current output capacity of the input voltage source. Users do not need to consider the worst case and can maximize the current output capacity of the input voltage source; the input voltage range is between 4.35V-6V; when the lithium battery voltage is low, the trickle charging mode is used to activate the lithium battery; when the power supply voltage is off, it automatically enters a low-power sleep mode, and dual indication outputs for charging status and charging end status; automatic recharging function, battery temperature monitoring function.

 

Of the two solutions mentioned above, CN3063 is used as the charging management chip for this system because it can be powered by solar cells and is cheaper than MAX1898. Also, considering that MAX1898 is not easy to solder manually, we use CN3063.

 

The pin arrangement of CN3063 is shown in the figure.

 

                           Figure 13 CN3060 pin arrangement

 

The functions of each pin are described in Table 2.

 

Table 2 CN3063 pin functions

 

 

Its typical application circuit is shown in Figure 14.

 

Figure 14 CN3063 application circuit

 

Application information of CN3063:

Low power supply voltage latch

 

CN3063 has a power supply voltage detection circuit inside. When the power supply voltage is lower than the power supply voltage threshold, the chip is in the shutdown state and charging is also prohibited.

Sleep Mode

There is a sleep state comparator inside. When the input voltage is lower than the battery terminal voltage plus 20mv, the charger is in sleep mode. Only when the input voltage rises to above the battery terminal voltage of 50mv, the charger leaves sleep mode and enters normal working state.

 

Input voltage source current limiting mode

When the current output capability of the CN3063 input voltage source is less than the set charging current, the 8-bit analog-to-digital conversion circuit inside the device automatically controls the charging current according to the current output capability of the input voltage source. At this time, the actual charging current may be less than the set charging current, but under the premise that the voltage applied to the 4th pin VIN of CN3063 is not less than the minimum operating voltage of 4.35, the charging current can be maximized. In this mode, the user does not need to consider the worst case, as long as the charging current is set according to the maximum current output capability of the input voltage source. It is very suitable for charging the battery using a voltage source with limited current output capability such as a solar cell.

 

Charging End

In the constant voltage charging state, when the voltage applied to the 4th pin VIN of CN3063 is greater than 4.45V, and when the charging current is less than 1/10 of the set constant current charging current, the charging cycle ends. In the input voltage source current limiting mode, even if the charging current is less than 1/10 of the set constant current charging current, charging will continue and will not end. This ensures that the battery can be charged even when the current output capability of the input voltage source is very weak.

 

Pre-charge state

At the beginning of the charging cycle, if the voltage of the battery voltage Kelvin detection input terminal (FB) is lower than 3V, the charger is in the pre-charging state and the charger charges the battery at 10% of the constant current charging mode charging current.

 

Battery voltage Kelvin detection

CN3063 has a battery voltage Kelvin detection input (FB), which is connected to the constant voltage charging error amplifier through the precision resistor voltage divider network inside the chip. The FB pin can be directly connected to the positive electrode of the battery, which can effectively avoid the influence of the parasitic resistance (including wire resistance, contact resistance, etc.) between the positive electrode of the battery and the 5th pin of CN3063 on charging. The existence of these parasitic resistances will cause the charger to enter the constant voltage charging state too early, prolong the charging time, and even make the battery not fully charged. These problems can be solved by using the battery voltage Kelvin detection. If this pin is left floating, CN3063 is always in the pre-charging state, and the charging current is 1/10 of the set constant current charging current.

 

Set constant current charging current

In constant current mode, the formula for calculating the charging current is:

 

in,Indicates the charging current in A.Indicates the resistance from the ISET pin to ground in ohms.

 

In this system, the charging current is set to 500mA, so,=1800V/0.5A=3.6KΩ.

 

Battery temperature monitoring

In order to prevent the battery from being damaged by over-high or under-low temperature, CN3063 has an internal battery temperature monitoring circuit. Battery temperature monitoring is achieved by measuring the voltage of the TEMP pin. When the voltage of the TEMP pin is greater than 46%*VIN for more than 0.15 seconds, the chip works normally; if the voltage of the TEMP pin is less than 46%*VIN for more than 0.15 seconds, CN3063 considers that the battery temperature is out of range and charging will be temporarily stopped. When the voltage of the TEMP pin is greater than 46%*VIN for more than 0.15 seconds again, charging will continue.

 

In this system, the TEMP pin is connected to the ground, the battery temperature monitoring function is disabled, and the DS18B20 is used as a replacement to monitor the lithium battery voltage in real time for easy observation.

 

Recharge

When a charging cycle ends, if the voltage at the battery voltage Kelvin detection input is lower than the recharge threshold, CN3063 automatically starts a new charging cycle.

 

Constant current/constant voltage/constant temperature charging

The battery is charged in constant current/constant voltage/constant temperature mode. In constant current mode, if the power consumption of CN3063 is too large and the junction temperature of the device is close to 115°C, the amplifier Tamp starts to work together and automatically adjusts the charging current to keep the junction temperature of the device at about 115°C.

 

Open drain status indication output

 

There are two open-drain status indication terminalsand, these two status indication terminals can drive light-emitting diodes or microcontroller ports.Used to indicate the charging status. When charging,is low level;Used to indicate the end of charging. When charging is completed,When the battery temperature is outside the normal temperature range for more than 0.15 seconds,andWhen the battery is not connected to the charger, the charger will quickly charge the output capacitor to the constant voltage charging voltage. Due to the leakage current of the battery voltage Kelvin detection input terminal FB pin, the voltage of the FB pin and the BAT pin will slowly drop to the recharge threshold, thus forming a ripple voltage of 100mv at the FB pin and the BAT pin.The output pulse signal indicates that no battery is installed. When the external capacitor of the battery connection terminal BAT pin is 4.7uF, the pulse period is about 10Hz.The pin is connected to the red LED, The pin is connected to the green LED.

 

Table 3 lists the two status indicators and their corresponding charging status.

 

Table 3 Relationship between status indicator and charging status

 

(5) Temperature monitoring

Solution 1: Use thermistors as sensors. The change between thermistors and temperature is nonlinear, and the 8-bit microcontroller has limited computing power. When using it, it is necessary to abandon the complex calculation formula and use the table lookup method to calculate the temperature. The temperature accuracy depends on the AD sampling accuracy, the temperature table accuracy and thermistor accuracy.

 

Solution 2: Use DS18B20 temperature sensor. When using it, you only need to write a strict timing sequence to directly read the temperature value, and the lower four bits are processed as decimals to get a more accurate temperature value.

 

Since the change of thermistor and temperature is nonlinear, and it is impossible to use complex calculation formulas to obtain accurate temperature values, we adopt solution 2, which is to stop charging when the lithium battery temperature is greater than 60°C.

 

The application circuit of DS18B20 is shown in Figure 15.

 

Figure 15 Temperature monitoring

 

(6) Lighting control

Solution 1: Determine whether it is day or night by detecting the resistance of the photoresistor, and adjust the brightness of the light according to the resistance of the photoresistor.

 

Solution 2: By detecting the output voltage of the solar panel, we can determine whether it is day or night and further adjust the brightness of the lighting.

 

Comparing the two solutions, the output voltage of the solar panel in Solution 2 is not only affected by the external light intensity, but also related to other factors such as temperature. To avoid misjudgment, we adopt Solution 1. In Solution 1, according to the resistance value of the photoresistor, it is easier to use pulse width modulation (PWM) to simulate the DA function.

 

The application circuit is shown in Figure 16.

 

Figure 16 Lighting

 

When the external light intensity is detected to be lower than the threshold, turn on the light, and use the PCA of the STC12C5A60S2 microcontroller to output PWM waves to simulate the DA function. The program is as follows:

 

void SetLed(uchar PWM_LOW)

{

   CCON=0; //PCA control register initialization

   CL=0; // PCA counter low 8 bits cleared

   CH=0; //PCA counter high 8 bits cleared

   CMOD=0X02; //Mode setting

  

   CCAP0H=CCAP0L=PWM_LOW; //Send the photoresistor value to the PCA capture/compare register

   CCAPM0=0X42; //Set PCA working mode

   CR=1; //Start PCA counter

}

rg0=GetADCResult(2); //Photoresistor value collection

if(rg0>=0xa0) //When the resistance value is greater than the threshold, dimming

SetLed(rg0-0xa0);

else

   SetLed(0); //Otherwise, send 0 to turn off the light

(7) Light tracking control

Solution 1: Use dual servos to build a servo gimbal. This method can track light in all directions, but in actual use, the servos will "grab power", which will cause large fluctuations in the power supply voltage and even produce strong jitter, which is not conducive to control and energy collection.

 

Solution 2: Use only one servo and combine it with mechanical light tracking. According to the data, when the angle between the solar panel and the ground plane is the same as the local latitude, the light energy utilization rate is the highest. The mechanical components used in this solution can manually adjust the angle between the solar panel and the ground plane, and then achieve light tracking by controlling the servo servo.

 

By comparison, we chose Option 2. Option 2 saves more electricity. At the same time, three photoresistors are placed at different positions of the solar panel. The sensitivity of the photoresistors to the brightness of the environment is used to design a light source sensor, that is, a voltage divider circuit of a photoresistor and a known resistor. The voltage at the photoresistor end and the known resistor end is collected. By analyzing the voltage of the analog quantity, the intensity of the light can be vaguely judged. By comparing the voltage values ​​obtained in the other two light-seeking sensor circuits, the position of the light source can be determined. The single servo mechanical structure is used to lock the direction of the light source position in the direction of the middle photoresistor in real time.

 

     Figure 17 Photoresistor detection

 

Due to the sensitivity of photoresistors to the environment, the scattered light in the environment causes the photoresistors of the same specification to have different resistance values ​​under the same illumination. For this reason, a black cylindrical shield is added in front of each photoresistor to make the reference resistance values ​​of the photoresistors basically the same, so that there is a unified standard for the comparison of the resistance values ​​of the three when detecting the light source, and the accuracy of light source detection is improved.

 

The collected voltage value is an analog quantity, which improves the spatial accuracy of light source detection. The analog quantity can also be compared and assigned the corresponding proportional coefficient and differential coefficient to be substituted into the steering gear control software module. The circuit diagram of the photoresistor detecting the light source is shown in Figure 17.

 

In actual use, it is found that when there is external interference signal, insufficient voltage of power supply, etc., it will cause the servo to shake, so we use independent microcontroller and independent power supply to complete the tracking.

 

Light avoids jitter caused by signal interference and insufficient voltage. At the same time, it also avoids the problem of unstable voltage of other modules caused by the servo "grabbing power".

 

The independent power supply comes from the lithium battery, which is boosted by the PT1301 IC chip for use by the servo, and a load indicator light (blue) and a lithium battery voltage low warning indicator light (yellow) are added. For detailed information, please refer to Appendix 2.

 

The main procedures are as follows:

#define steer_center 60

#define right_limit 100

#define left_limit 20

#define KP 10 //Proportional coefficient

 

sbit pwm=P3^7;

 

uchar rg1,rg2,rg3;

uchar last_pwm_value_init; //Last servo output value initialization

uchar control_pwm; //Servo PWM output value

uchar last_control_pwm; //Last servo PWM output value

 

void get_analog() //Collect the voltage value in the three-way photoresistor lighting system

{

   rg1=GetADCResult(0);

   rg2=GetADCResult(1);

   rg3=GetADCResult(2);

}

 

uchar analog_analyse()

{

    get_analog();

    if(last_pwm_value_init==0)

    {

        last_control_pwm=steer_center;

        last_pwm_value_init=1; //initialization completed

   }

    if(rg2-rg1>0&&rg3>=rg2)

       control_pwm=last_control_pwm-(rg2-rg1)*KP/80;

    else if(rg2-rg3>0&&rg1>=rg2)

       control_pwm=last_control_pwm+(rg2-rg3)*KP/80;

    else if(rg1-rg2>0&&rg3-rg2>0)

   {

        if(rg2<80)

        {

            control_pwm=last_control_pwm;   

        }

        //else //control_pwm=last_control_pwm+(rg1-rg2)*8/80-(rg3-rg2)*8/80; //Also adjust the angle 

   }  

   else

       control_pwm=steer_center;

   if(control_pwm<=left_limit)

       control_pwm=left_limit; 

   else if(control_pwm>=right_limit)

       control_pwm=right_limit;

   last_control_pwm=control_pwm; //Save the last servo output value

   return control_pwm;}

  

void main()

{

   uchar PWM;

   InitADC(); //AD initialization

   Init_PCA(); //PCA extended timer initialization

   while(1)

   {

       PWM = analog_analyse();

       jd=PWM;

       Delay(12);

    }    

}

 

void PCA_ISR()interrupt 7

{

  CCF1=0;

  CCAP1L=value;

  CCAP1H=value>>8;

  value+=25;

  if(cnt <= jd) //Judge whether the 0.025ms times is less than the angle mark jd=20-100

      pwm=1; //less than, PWM output high level

  else

      pwm=0; // if greater than 0, output low level   

  if (cnt>=800)

      cnt=0;

  else

      cnt++; //0.025ms times plus 1, times always remain at 800, i.e. keep the cycle at 20ms

}

 

(8) Main control unit

Solution 1: Use AVR microcontroller. The I/O port of AVR microcontroller is a real I/O port, which can correctly reflect the real situation of I/O port input/output. It is an industrial-grade product with a large current (sink current) of 10-40 mA, which can directly drive SCR or relay, saving peripheral drive devices.

 

AVR microcontrollers have built-in analog comparators, and their I/O ports can be used for A/D conversion, forming a cheap A/D converter. Devices such as ATmega48/8/16 have 8-channel 10-bit A/D.

 

Some AVR microcontrollers can be used to form a zero peripheral component microcontroller system, so that this type of microcontroller can work without any external components, which is simple, convenient and low cost.

 

Figure 18 AVR MCU pin distribution

 

AVR MCU can reset the startup reset to improve the reliability of the MCU. A watchdog timer is used for safety protection to prevent the program from running wild (flying), improving the product's anti-interference ability. The pin distribution of AVR MCU is shown in Figure 18.

 

Solution 2: Use the new generation enhanced 8051 microcontroller STC12C5A60S2, which has two-way PWM/PCA function; 8-way 10-bit A/D acquisition, conversion speed 250,000 times/second; dual serial ports; internal integrated MAX810 dedicated reset circuit; 60K user program space; internal integrated power-off detection circuit; expandable to 4 16-bit timers; 7-way external interrupt; operating frequency range is 0-35MHZ, equivalent to 0-420MHZ of ordinary 8051; instruction code is fully compatible with traditional 8051 microcontrollers.

 

In summary, due to the large number of A/D detection channels required, we choose the STC12C5A60S2 microcontroller in Solution 2 as the main control chip.

Its pin arrangement is shown in Figure 19.

 

Figure 19 STC12C5A60S2 pin arrangement

 

The clock circuit and reset circuit of the microcontroller are shown in Figure 20 and Figure 21 respectively.

 

Clock circuit:                                   

                             Figure 20 Clock circuit

 

Reset circuit:

  Figure 21 Reset circuit

 

In addition, the system needs to communicate with the host computer and use MAX232 for level conversion to make the TTL level of the microcontroller and the level of the RS232 protocol the same.

 

The specific circuit is shown in Figure 22.

    

           Figure 22 MAX232 to serial port Figure 23 RC filter

 

When using the A/D function, in order to eliminate signal interference, an RC filter circuit is designed at the P1 port, as shown in Figure 23.

 

4. Software Process

(1) Charging management

In this program, firstly, the voltage of the lithium battery is tested three times in a row to see if it is greater than 1V, to determine whether the lithium battery is valid. After the judgment is successful, the output voltage of the solar cell is detected. If the voltage is greater than 6V, the buck charging channel is used, and the charging gating of this channel is turned on, and the buck charging channel is turned off; if the voltage is less than 6V, the boost charging channel is used, and the charging gating of the buck charging channel is turned on, and the boost charging channel gating is turned off. When it is detected that the lithium battery voltage is greater than or equal to 4.2V or the lithium battery temperature is greater than 60°C, all charging channels are turned off. The program keeps detecting the lithium battery voltage until the lithium battery voltage drops to 4V and the temperature is less than 60°C, and then the corresponding charging channel is turned on according to the corresponding situation.

 

The specific program flow chart is shown in Figure 24.

 

   

                       Figure 24 Charging process Figure 25 Serial communication process

 

 

(2) Serial communication

The main task of this program is to realize the communication with the host computer. First, determine whether to send or receive. If it is sending, the collected solar cell voltage, lithium battery voltage, and lithium battery temperature will be sent to the host computer and displayed on the host computer interface; if it is receiving, it is necessary to respond to the command sent by the host computer (0XAA for starting charging, 0XFF for stopping charging) and make corresponding operations.

 

The specific program flow chart is shown in Figure 25.

 

(3) Light tracking control

This program is used to realize real-time light tracking of solar panels. The voltages of three photoresistors and known resistors are collected respectively, and the intensity of light is vaguely judged through analog voltage analysis, and compared with the voltage values ​​obtained in the other two light-seeking sensor circuits, the position of the light source is determined, and the new jd value is assigned to the PCA capture/compare register to generate a new PWM, adjust the rotation angle of the servo, and make the solar cell always aim at the light source.

 

The specific program flow chart is shown in Figure 26.

 

Figure 26 Light chasing process

4. System Features and Innovation

All the energy of this system comes from solar energy, which is an active exploration in line with the trend of the times. After photoelectric conversion, the electrical energy is stored in lithium batteries and then powered to each module. The use of renewable energy responds to the current construction of a "harmonious society" and enhances the competitiveness of this system.

 

This system solves the problem of not being able to work due to low voltage. We have added a low voltage detection interrupt function. When the voltage is too low, an interrupt will be triggered, and the system will save important data. When the voltage is normal, it can resume working. At the same time, when there is no light, the system works on the power stored in the lithium battery. We don’t have to worry about the problem of sudden damage to the lithium battery, because when the lithium battery cannot supply power, as long as there is light, the microcontroller can still start working.

 

This system improves the efficiency of photoelectric conversion. The coordination of mechanical and servo light chasing not only takes into account the power consumption of the servo, but also improves the photoelectric conversion rate. Mechanical light chasing takes advantage of the characteristics of the local geographical location, and makes the angle between the solar panel and the ground consistent with the local latitude. For example, the local latitude of Hefei is about 32°, so we adjust the angle between the solar panel and the ground to about 32°, and then adjust it through the servo to cooperate with light chasing.

 

It should be noted that after the system is installed, this mechanical angle does not need to be adjusted again.

 

The system fully considers the characteristics of lithium batteries and their charging requirements. It uses the CN3063 intelligent charging management chip that can be powered by solar energy, and installs a protection board for lithium batteries. These measures provide guarantees for the safe and effective charging of lithium batteries; the low-voltage trickle charging method can reactivate lithium batteries. Under normal voltage conditions, the constant current/constant voltage charging method can charge lithium batteries more safely and quickly. The system's "recharge" function also prevents over-discharge of lithium batteries; the system also designs two charging channels for boost/buck, using optocouplers as switches. The switch is fast and does not generate sparks. Through program design, the charging channel is automatically switched; the addition of 18B20 temperature detection can effectively prevent lithium batteries from being damaged by excessive temperature, providing a second guarantee for the safety of lithium batteries.

 

The lighting in the system has changed the characteristics of traditional lighting that are either on or off. Pulse width modulation (PWM) is used to simulate the DA function to achieve intelligent dimming. When the external light is weaker, the lighting is brighter, and when the external light is stronger, the lighting is dimmer until it is turned off. The promotion and use of this method will be more energy-efficient.

 

The design of VB host computer interface realizes artificial intelligence management. On the host computer interface, you can intuitively see the operation of the system, including the output voltage of the solar cell, the voltage of the lithium battery, the temperature of the lithium battery, and the change curve of the lithium battery voltage. If the system fails, you can control it on the host computer and stop charging in time to avoid greater losses.

 

There is still a lot of room for improvement in this system. For example, if the economy permits, wired transmission can be changed to wireless transmission to achieve communication; the power of solar panels can be increased, lithium battery packs can be used, and inverter modules can be added to generate 220V AC power for small power appliances, etc.

 

5. System Application and Prospects

This system can be used for solar chargers, new street lights, flashlights, toys, and model airplanes. It can be used in communication equipment such as mobile phones, Internet phones, intercoms, and Bluetooth headsets; mobile office equipment such as notebook computers, PDAs, portable fax machines, and printers; and imaging equipment such as digital cameras, video cameras, mobile DVDs, mobile TVs, MP3s, and MP4s.

 

Since this system can effectively protect lithium batteries, activate lithium batteries, and extend the life of lithium batteries, it can also be considered to be used on signal transmission towers to charge lithium battery packs, which can save the cost of replacing lithium battery packs for communication service providers.

 

According to the light-tracking characteristics of the system, the system can also be installed on the roof to provide the possibility of household electricity use; if installed on the top of an electric car, no matter where the car goes, as long as there is sunlight, it will find the best position to absorb light and store energy.

 

In short, the system has a wide range of applications. As long as there is light in the working environment and lithium batteries are used, it can be considered for use after modification, and its development prospects are quite good.

 

Appendix 1 Introduction to Lithium Battery Protection Board

The IC chip used in the lithium battery protection board used in the system is DW01+. DW01+ is a lithium battery protection circuit designed to prevent lithium batteries from being damaged or shortened due to overcharging, overdischarging, and excessive current. It has a high-precision voltage detection and time delay circuit. Its operating current is low, with overcharge detection of 4.3V and overcharge release of 4.05V; overdischarge detection of 2.5V and overdischarge release of 3.0V; there is an over-protection reset resistor inside the chip, which is widely used in the protection circuit of single-cell lithium batteries. The pin arrangement of DW01+ is shown in Figure 27.

     

Figure 27 DW01+ pin arrangement

 

The functions of each pin of DW01+ are shown in Table 4.

 

Table 4DW01+ pin functions

 

The application circuit of DW01+ is shown in Figure 28.

 

Figure 28 DW01+ application circuit

Appendix II Introduction to PT1301 voltage boost, load indication, and low voltage alarm indication

1. PT1301 boost

PT1301 is a small size high efficiency step-up DC/DC converter with a startup voltage of less than 1V. It adopts adaptive current mode PWM control loop, can work stably and efficiently in a wide range of load current, and does not require any external compensation circuit; PT1301 contains a 2A power switch, and the maximum output current can reach 300mA when powered by lithium battery. At the same time, PT1301 also provides a drive port for driving external power devices (NMOS or NPN) to extend the output current when the application requires a larger load current. The low quiescent current of 14μA, coupled with high efficiency, can make the battery last longer, so it is very suitable for powering the servo.

The pin arrangement of PT1301 is shown in Figure 29

  

             

                   Figure 29 PT1301 pin arrangement

 

The functions of each pin of PT1301 are shown in Table 5.

 

Table 5 PT1301 pin functions

 

The typical application circuit of PT1301 is shown in Figure 30.

 

Figure 30 PT1301 application circuit

 

2. Load indication

The principle of the load indicator light is shown in Figure 31.

 

Figure 31 Load indication

 

Working principle analysis: When the power supply is connected to the load, the indicator light will light up. When the current required by the load is larger, the indicator light will be brighter; on the contrary, when the current required by the load is reduced, the indicator light will become dimmer. This circuit is used to observe the power consumption of the servo.

 

3. Low pressure alarm indication

This system has a lithium battery low voltage alarm indication function. When the lithium battery voltage is lower than 3.3V, the alarm indicator light will light up. The TP74 chip is used here.

 

TP74 is a high-precision, low-power voltage detector. The chip consists of a reference voltage generator, a voltage sampling circuit, a comparator and an output unit; it can provide two outputs, NMOS open drain and CMOS, for the detection of 1.5V-3.6V power supply voltage, and can provide voltage detection for most microprocessors and digital system power supplies. When the input voltage is lower than the preset value Vdf), the reset signal is activated until the input voltage is restored and the circuit works again. The pin arrangement of TP74 is shown in Figure 32.  

                                      

 Figure 32 TP74 pin arrangement

 

The functions of the TP74 pins are shown in Table 6.

 

Table 6 TP74 pin function description

 

The principle of low pressure alarm indication is shown in Figure 33.

 

Figure 33 Low pressure alarm indication

 

Working principle analysis: When the input voltage Vin>3.3V, the output voltage Vout=Vin, at this time, the voltages at both ends of the light-emitting diode are equal, so when the lithium battery voltage is higher than 3.3V, the indicator light is off; if the input voltage Vin<3.3V, the output voltage Vout is zero, at this time, there is a voltage difference at both ends of the light-emitting diode, and the indicator light is on. Table 7 lists the status and meaning of the load indicator light and the low voltage alarm indicator light during use.

 

Table 7 Status and meaning of load indicator light and low voltage alarm indicator light

 

 

Load indicator light (blue)

Lithium battery low voltage warning indicator (yellow)

Lithium battery standby

Destroy

Destroy

Lithium battery in use

Bright

Destroy

Lithium battery in use and battery voltage is low

Destroy

Bright

The lithium battery is in standby mode and the battery voltage is low

Destroy

Flash

 

 

 

 

 

 

 

 

Appendix III Schematic diagram of peripheral charging circuit

 

Reference address:Design of intelligent light-chasing lithium battery charging system

Previous article:Independently operated small wind turbine
Next article:How does a board-level power supply strike a balance between performance and size?

Latest Power Management 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号