Login | Register | Advertise | About Us | Contact Us  
    H O M E   >>  A R T I C L E S

Microcontroller-Based Solar Charger

Subscribe to Electronicsforu.com

Microcontroller-Based Solar Charger 

Arun Kumar Vadla

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

Fig.1:Circuit of microcontroller-based solar charger

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 analogueto- digital converter with a serial I/O and very low conversion time of typically 32 μs. The differential analogue voltage input allows increase of the common-mode rejection and offsetting of the analogue zero input voltage. In addition, the voltage reference input can be adjusted to allow encoding of any smaller 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 withn 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 deenergised 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

Fig2: Pin configurations of
BC547, BS170 and IRF540

Construction and testing

Pin configurations of transistor BC547, MOSFET BS170 and MOSFET IRF540 are shown in Fig.2. An actual-size, single-side PCB for the microcontroller-based solar charger is shown in Fig.3(View as PDF) and its component layout in Fig.4(View as PDF). Wire the circuit on the PCB. Prior to inserting the programmed microcontroller into the PCB, check for soldering mistakes like shorts, and for proper connections using a multimeter. Mount power MOSFET IRF540 on a suitable heat-sink. Before switching on the controller unit, connect the leads of the battery, load and solar panel at appropriate places on the board.

Switch on the unit and the message “Solar Charge Controller–EFY” is displayed on the LCD for two seconds. The system status messages are displayed on line 1 of the LCD and the battery voltage is displayed on line 2.

A small graphic representing the battery status is also displayed on line 2 of the LCD

EFY note: If the unit is switched on without the solar panel connected, the “Battery Low—Load Off” message is displayed irrespective of the battery voltage. The display changes to “charging” as soon as the panel is connected.

2. There will be slight variation in the voltage displayed because of the tolerance levels of potential-divider resistors in the ADC section and Vref of the ADC being directly connected to VCC (the output of 7805 has an accuracy of 2-5 per cent) instead of dedicated temperature-compensated voltage reference.


The source program for the project is written in Assembly language and assembled using Metalink’s ASM51 assembler, which is freely available on the Internet for download. It is well commented for easy understanding and works as per the flow-chart shown in Fig.5. The hex file ‘solar.hex’ is to be burnt into the microcontroller.

Fig.5: Flow-chart of the source program

Download the source code and other relevant files:

http://www.efymag.com/admin/issuepdf/Microcontroller Based Solar Charger.zip


Related Articles

Post Comment | 0 Comments

Electronics Buzz
Low-cost, effective wireless security solution
Revised preferential market access policy
Startup culture can help in generating patents in electronics
GPRS-based meter and logger
Changing face of ESDM in India
Electronics for You
LINUX for You
Facts for You
Electronics Bazaar
Electronics Annual Guide
EFY Awards
EduTech Expo
News Verticals
Linux & Open Source
Consumer Electronics
Science & Technology
Educational Institute
EFY Techcenter
© Copyright 2012 EFY Enterprises Pvt. Ltd. All rights reserved.
Reproduction in whole or in part in any form or medium without written permission is prohibited. Usage of the content from the web site is subjectT etor ms and Conditions