Elektor Solar charger

From emboxit
Jump to: navigation, search


Article


Solar-charger-1.jpg


Matthijs Hajer (The Netherlands) During the past year the author has built a standalone solar panel system, which included the construction of the panels themselves. Such a system stores the gener-ated energy in a battery. This is in contrast to a mains-connected system where the excess energy generated is fed back into the national electricity grid. A battery charger/monitor was designed in order to charge the battery correctly, pro-tect it from deep discharges and to monitor its performance. Specifications for the solar panels: 150 watts maximum at 14.5 volts. With allthe losses (glass, temperature, cables, etc.) taken into consideration, the measured current from the combined panels was about 7.5 A during sunny weather (the peak values 38 stated by the manufacturer are rarely reached in practice). This isn't a fast charger. This charger is intended to be used with solar panels and the like (wind and water energy), where the maxi-mum charging current is much less than 0.1 of the battery capacity C. The circuit is built around a PIC .16F877 micro-controller. The battery voltage is measured via input RAO with the help of a 1:3 resistive divider. To measure the current, a 'high-side' reading is taken via R1 (with a value of about 0.03 C), using a number of resistors con-nected in parallel). lC2 amplifies the meas-ured voltage across Rl and buffers it with T3. The resulting 350 mV/A signal is fed to input RA2 of the PlC. The opamp used for the cur-rent measurement needs to have a good rail-to-rail performance and a low input offset. The gain here is (R4+P1)/(R2) and the voltage across the resistor (R4+P1) is directly propor-tional to the measured current. The offset at the output, which is created by the opamp itself, is measured as soon as the'info screen' is closed (pressing S1 or 52) and used as a 'null-offset' for the current measurement. D2 protects the PIC against too large a volt-age at the input. From the measured current and battery volt-age the energy input and the capacity are calculated. This information is shown on the 4x16 LCD display. FET T4 connects the solar panels to the bat-tery to charge it and removes the connection once the battery is fully charged. FET T5 con-nects the load to the battery when the volt- ege is high enough and disconnects it when

he battery voltage becomes too low. The

Schottky diode prevents the battery from slowly discharging into the solar panel when It is dark. T1 and T2 are required to drive the FETs, which work at the battery voltage, rvith the 5 V outputs of the PlC. LED D4 and D5 indicate when the corresponding FET is turned on. The Schottky diode, the current resistor and the FETs have to be provided with small h eatsinks. The code for the PIC is written in C and com-piled using the Hl-TECH C Pro (Lite mode) compiler included with MPLAB. The code uses very little memory and isn't very time-critical. The only thing you have to make sure of is that the firmware runs at a rate of about 10 times per second in order to obtain an accurate value for the capacity measure-ment [Ah]. Following a reset, the PIC loads the capac-ity values [Ah] & [mAh] from its EEPROM and an 'info screen'appears next. This shows the firmware version, the voltages at which the load is turned on and off, and the voltage at which the charger stops charging. When either of Sl or52 is pressed, the PlCtakes 10 measurements in order to determine the off-set of the current measurement stage (lC2). The average is taken ofthese 10 measure-ments and that value is then used to correct all subsequent current measurements. When S1 is pressed, the main program is started, where the battery voltage deter-mines whether the load is turned on or off. When 52 is pressed, the load is immediately connected until the battery voltage drops below 11.5 V. The main program is called 10 times per sec-ond;the LCD is refreshed at a rate of 2Hz.ln the main program the A/D converters are read first, after which the values for V, l, P and C are calculated. The results determine whether the charger and load are turned on. When the main screen is displayed, only 51 has a function: When this switch is pressed, the capacity [Ah] & [mnh] is stored in the EEP-ROM and the info screen is shown. The watchdog function ofthe PIC has been enabled in this project. This way the PIC will be reset if the software crashes. ln this case the info screen will appear again, and the charger and load are turned off, which is a safe state. ln this way the battery is pro-tected against over-charging or a complete discharge due to a crashed PIC micro. When programming the PIC you have to remember to set the configuration bits for the watch-dog timer. At the start ofthe C code they are also set. The limits for charging the battery were taken from the datasheet from Yuasa. This type of maintenance-free gel lead-acid battery is per-fectly suitable for a small solar energy system. lf you use a different type of battery you may have to adjust the voltages in the code some-what. The values used here are: 14.5 V: Gassing voltage 1 3.6 V: Float voltage (small charging current) 12.7 V: No load, 100% charged voltage (no charging current) 1'1.5 V: 50% empty with small load (, < 0.01 C) The charger turns on as soon as the battery voltage drops below 13.6 V. Should the volt-age rise above 14.5 V during the charging, the charger will be turned off. Because the battery will be about 80% charged (accord-ing to the datasheet), the voltage will drop below 13.6 V again. When this happens, the charger will turn on again after 10 seconds and the battery voltage will rise. This process will repeat itself, butthe'charger-off' period will become longer the more the battery is charged. Overnight, a fully charged battery will slowly drop to 12.7 V. Every 5 seconds the PIC transmits a text string via pin RC6/TX (2400 baud,8n1), which shows the current state. This string could for example be sent to a web server or data-log-ger. An example string: ...................... The source and hex code files for this project are available free from the Elektor website as archive file # 090544-1"l.zip. A programmed controlled is available under product number 090544-41.


Tools


Build