brock

Wednesday, September 19, 2012

Microcontroller Based Solar Charger


As the sources of conventional energy deplete day by day, resorting to alternative sources of energy like solar and wind energy has become need of the hour.

Solar-powered lighting systems are already available in rural as well as urban areas. These include solar lanterns,
 solar home lighting systems, solar streetlights, solar garden lights and solar power packs. All of them consist of four components: solar photovoltaic module, rechargeable battery, solar charge controller and load.

In the solar-powered lighting system, the solar charge controller plays an important role as the 
system’s overall success depends mainly on it. It is considered as an indispensable link between the solar panel, battery and load.

The microcontroller-based solar charge controller described here has the following features:

1. Automatic dusk-to-dawn operation of the load
2. Built-in digital voltmeter (0V-20V range)
3. Parallel- or shunt-type regulation
4. Overcharge protection
5. System status display on LCD
6. Deep-discharge protection
7. Low battery lock
8. Charging current changes to ‘pulsed’ at full charge
9. Low current consumption
10. Highly efficient design based on microcontroller
11. Suitable for 10-40W solar panels for 10A load

The circuit of the solar charge controller is shown in Fig. 1. It comprises microcontroller AT89C2051, serial analogue-to-digital converter ADC0831, optocoupler MCT2E, regulator 7805, MOSFETs BS170 and IRF540N, transistor BC547, LCD and a few discrete components. Component description is given below.

Microcontroller. Microcontroller AT89C2051 is the heart of the circuit. It is a low-voltage, high-performance, 8-bit microcontroller that features 2 kB of Flash, 128 bytes of RAM, 15 input/output (I/O) lines, two 16-bit timers/counters, a five-vector two-level interrupt architecture, a full-duplex serial port, a precision analogue comparator, on-chip oscillator and clock circuitry. A 12MHz crystal is used for providing the basic clock frequency. All I/O pins are reset to ‘1’ as soon as RST pin goes high. Holding RST pin high for two machine cycles, while the oscillator is running, resets the device. Power-on reset is derived from resistor R1 and capacitor C4. Switch S2 is used for manual reset.
   
Serial ADC.
  The microcontroller monitors the battery voltage with the help of an analogue-to-digital
 converter. The ADC0831 is an 8-bit successive approximation analogue-to-digital converter with a serial I/O and very low conversion time of typically 32 μs. The differential analogue voltage input allows increase of thecommon-mode rejection and offsetting of the analogue zero input voltage. Inaddition, the voltage reference input can be adjusted to allow encoding of anysmaller analogue voltage span to the full eight bits of resolution. It is available in an 8-pin PDIP package and can be interfaced to the microcontroller with only three wires.
   
LCD module.
 The system
 status and battery voltage are displayed on an LCD based on HD44780 controller. The backlight feature of the LCD makes it readable even in low light conditions. The LCD is used here in 4-bit mode to save the microcontroller’s port pins. Usually the 8-bit mode of interfacing with a microcontroller requires eleven pins, but in 4-bit mode the LCD can be interfaced to the microcontroller using only seven pins.
   
Solar panel.
 The solar
 panel used here is meant to charge a 12V battery and the wattage can range from 10 to 40 watts. The peak unloaded voltage output of the solar panel will be around 19 volts. Higher-wattage panels can be used with some modifications to the controller unit.
   
Rechargeable battery.
 The solar energy is converted into electrical energy and stored in a 12V lead-acid battery.
 The ampere-hour capacity ranges from 5 Ah to 100 Ah.
   
Dusk-to-dawn sensor.
 
Normally, in a solar-photovoltaic-based installation—for example, solar home lighting
 system, solar lantern or solar streetlight—the load (the light) is switched on at dusk (evening) and switched off at dawn (morning). During daytime, the load is disconnected from the battery and the battery is recharged with current from the solar panel. The microcontroller needs to know the presence of the solar panel voltage to decide whether the load is to be connected to or disconnected from the battery, or whether the battery should be in charging mode or discharging mode. A simple sensor circuit is built using a potential divider formed around resistors R8 and R9, zener diode ZD1 and transistor T1 for the presence of panel voltage.
   
Charge control.
 
Relay RL1 connects the solar panel to the battery through diode D1. Under normal conditions,
 it allows the charging current from the panel to flow into the battery. When the battery is at full charge (14.0V), the charging current becomes ‘pulsed.’ To keep the overall current consumption of the solar controller low, normally-closed (N/C) contacts of the relay are used and the relay is normally in de-energised state.
   
Load control.
 
One terminal of the load is connected to the battery through fuse F1 and another terminal of the load to an n-channel power MOSFET T3. MOFETs are voltage-driven devices that require virtually no drive
 current. The load current should be limited to 10A. One additional MOSFET is connected in parallel for more than 10A load current.

Circuit description

Basically, there are two methods of controlling the charging current: series regulation and parallel (shunt) regulation. A series regulator is inserted between the solar panel and the battery. The series type of regulation ‘wastes’ a lot of energy while charging the battery as the control circuitry is always active and series regulator requires the input voltage to be 3-4 volts higher than the output voltage. The current and voltage output of a solar panel is governed by the angle of incidence of light, which keeps varying.
   
Parallel regulation is preferred in solar field. In parallel regulation, the control circuitry allows the charging
 current (even in mA) to flow into the battery and stop charging once the battery is fully charged. At this stage, the charging current is wasted by converting into heat (current is passed through low-value, high-wattage resistor); this part of the regulation dissipates a lot of heat.
   
In this project, we have used parallel regulation technique but instead of wasting the charging current as heat,
 we have made it pulsed and applied to the battery to keep the battery topped-up.
   
After power-on, the microcontroller reads the battery voltage with the help of the ADC and displays the
 values on the LCD. It monitors the input signal from the dusk-to-dawn sensor and activates the load or charging relay RL1 accordingly. The digital voltmeter works up to 20V. As Vref of the ADC is connected to VCC (5V), the input voltage to the ADC cannot exceed +5V. A potential divider is used at pin 2 of the ADC (IC2) using resistors R5, R6 and R7 to scale down the voltage from 0V-20V to 0V-05V. The ADC output is multiplied four times and displayed on the LCD as battery voltage.
   
When the solar panel voltage is present, the dusk-to-dawn sensor provides a signal to the microcontroller,
 which then displays ‘charging’ message on the LCD. During charging, the battery voltage is continuously monitored. When the voltage reaches 14.0V, the microcontroller interrupts the charging current by energising the relay, which is connected to MOSFET BS170 (T2), and starts a 5-minute timer. During this stage, the LCD shows “battery full.”
   
After five minutes, the relay reconnects the panel to the battery. This way, the charging current is pulsed at the
 intervals of five minutes and the cycle repeats until the panel voltage is present.
   
When the panel voltage falls below the zener diode (ZD1) voltage of the dusk-to-dawn sensor, the microcontroller
 senses this and activates the load by switching on MOSFET T3 via optocoupler IC3 and “load on” message is displayed.
   
In this mode, the microcontroller monitors for low battery. When the battery voltage drops below 10 volts, the
 microcontroller turns off the load by switching off MOSFET T3 and “battery low—load off” message is displayed.

Normally, when the load is switched off, the battery voltage tends to rise back and the load oscillates between
 ‘on’ and ‘off ’ states. To avoid this, the microcontroller employs a hysteresis control by entering into a ‘lock’ mode during low-battery state and comes out of the lock mode when the dusk-to-dawn sensor receives the panel voltage (the next morning). During lock mode, the microcontroller keeps converting the ADC value and displays the battery voltage on the LCD.

Code: