Development of simple solar charge controller using 8-bit microcontroller attiny85

. This paper present simple and inexpensive solar charge controller (SCC) using 8-bit microcontroller ATtiny85. The SCC using a pulse width modulation (PWM) signal to transistor and MOSFET to control current that generated by the microcontroller. The battery voltage state also monitored using a series resistor paralleled to the battery and the voltage drop connected to the microcontroller. The design of SCC consists of 3 major part i.e. microcontroller, current driver, voltage sensing. The purpose of measurement is to know the characteristics of 2 charging modes, mode 1 (one) and mode 2 (two), that occur in the system created. The measured data is the battery voltage as independent variable, and the solar panel’s voltage, the current that flow towards battery and the power provided for charging. Measurements are conducted from the battery voltage state of 7.84 V to 8.4 V. The results show that the solar charge controller using 8-bit microcontroller ATtiny85 was successfully managed to provide current and voltage according to expected design with 400 mA, 8.9 V for the first charging case and 150 mA, 12 V for the second charging case.


Introduction
Many regions in Indonesia have not been provided electricity that most of these regions is relatively remote. One of the main reason is the cost to providing the electricity is expensive and relatively difficult because the access that available to the area is impossible for heavy machinery and vehicle to pass. Therefore, using solar cell as another source of electricity is very possible especially for lowering cost [1]. Solar cell is utilized to absorb solar radiation and convert it to electricity in the remote area [2]. Solar cell usually uses a solar charge controller to keep battery from overcharging. Solar charge controller (SCC) is a voltage and/or current regulator from solar cell to batteries that is keep batteries from overcharging.
Generally, Solar charge controller use pulse width modulation (PWM) for transferring power from solar cell to battery [3]. The PWM utilize switching mechanism to realized Constant Current-Constant Voltage (CC-CV). CC-CV is a charging method consist of two phase, the first phase is to charge the battery with enough high current until near its maximum voltage then the second phase is to charge the battery with decaying and lower current. The first phase is not really constant because the current depend on the sun irradiance at the moment. PWM solar charge controller is different from MPPT (Maximum Power Point Track). MPPT is a DC-DC converter that maintain the maximum available power while PWM is just a switch to maintain the charging mechanism so the battery will last long [4], [5].
However, the MPPT controller is complicated and expensive. Therefore, this paper present simple and inexpensive solar charge controller using 8-bit microcontroller ATtiny85. The development of the solar charge controller in this paper provide a charging procedure using PWM as its driving mechanism for charging method along with its characterization.   , generated current (IL) and material condition such as dopan, the semi conductor material and design. Isc shows the maximum possible current in short circuit load. Isc affected by the available spectrum (E) occured and the spectral reponse (SR) of the panel [7]. Spectral response (SR) shows how much the panel produce pair of carrier by specific photon of a wavelength [7]. Fill factor determined how square the curve, this parameter also determine the loaded and maximum power of the voltage and current Fill Factor affected by the Voc of the panel and the idealty parameter (n). I-V curve it self will no be same under different condition because of this parameter.  Figure 3 shows the block diagram of the system designed of solar charge controller. The power generated from the solar panel must first supplying small amount of sufficient power to the microcontroller. The microcontroller checks the battery voltage condition from battery monitor, then the microcontroller determines whether the battery meets 3 conditions for the designated charging mode i.e. fully charged battery (above 8.4 V), almost fully charged (above 8 V), full power charging (below 8 V). The cycle goes on for about 20 seconds until the battery fully charged.

Design of Solar Charge Controller
Electrical circuit schematic and photographs of the developed solar charge controller are shown in Figure 4. The design of solar charge controller consists of 3 major part i.e. Microcontroller, Voltage Sensing, and Current Driver. Microcontroller used in this SCC is 8-bit microcontroller ATtiny85. Voltage sensing utilizes two series connected resistor. Current driver employs a transistor and a n-channel MOSFET.

Microcontroller
Microcontroller ATtiny85 was utilized to process input and output in the solar charge controller. The input comes from voltage sensing. The output is PWM used to controlling the transistor of current driver, by sending appropriate PWM voltage to transistor the current driver will be able to flow the corresponding current to the battery. The microcontroller used a voltage regulator to make the power of the microcontroller is stable.

Voltage Sensing
Voltage sensing consist of two series connected resistor. These resistors then connected in parallel to the battery. The voltage drops on the resistor that connected directly to the ground will be the input voltage to the micro controller. The value of the two resistors used is varied so that when the battery is full the second resistor has a voltage below 5 volts. It should be noted that the resistors used need to have a large enough quantity so the most of the current from.

Current Driver
The current driver consists of a transistor and a nchannel MOSFET. The transistor used as driver for the MOSFET. When PWM voltage is high, the transistor resistance would be a short connection. The MOSFET gate will short connected to the ground and will be switched on. When the PWM voltage received lower, the transistor will have a certain resistance and so did the MOSFET and the current passed through will be less.
The experiment was conducted to characterized the designed system in the paper. The measured data is the battery voltage as independent variable, and the solar panel's voltage, the current that flow towards battery and the power provided for charging. The solar panel used is SUNLITE 10 WP solar panel with its Voc value is 22 V, Isc value is 0.58 A, Vmp value is 18.36 V and Imp Value is 0.54. The purpose of measurement of this magnitude is to know the characteristics of 2 charging modes that occur in the system created, while the third mode is a cut off operation is done by battery management system (BMS) installed that available in the market so in this paper no measurement related to the third mode. Which are the full power charging and almost fully charged. Measurements are conducted from the battery voltage state of 7.84 V to 8.4 V.

Results and Discussion
The results of two measurements were conducted in this paper. The first measurement was a simulation of the SCC design using a DC Power Supply as a replacement for the solar panel to test the system and mechanism of the design. The second measurement was conducted using real solar panel under the direct sunlight with the spec as mentioned before. Moreover, there are two cases that represent the characteristics of 2 charging modes. Case 1 (one) is full power charging for battery that is not full capacity (below 8 V). Case 2 (two) is no charging mode for fully charged battery (above 8 V).

Simulation Results
In the first measurement, DC power supply was set to 22 V to resembles the solar panel open voltage and the current was limited at 0.52 A to resembles the solar panel full load current. First measurement used case 2 starting voltage of 7.53 V. Figure 6 shows the average charging current of the simulation using the DC power supply as the power. Shows that charging current measured when the case 1 occurred was lower than case 2. Indicate that the system managed to reduce the current. With value 364.62 mA for case 1 and 412.44 mA for case 2. If we compare this condition to the real measurement using the solar panel show that for case 1 charging mode measured is lower indicated that using the solar panel the SCC can reduce the current better. This occurs because the charging current occur in the system for case 1 is following the PWM switching, so the current switches on and off following the frequency. This makes the battery voltage read by the micro controller keeps charging in this mode charging and the dc power supply cannot maintain the constant current because the current flows is over the set current. This makes the charging mode sometime enter back to first mode. The design also affecting the result because the charging mechanism and condition explained before and the case 2 voltage is quite far from the cutoff voltage this condition continue for several hours until it reach 8.4 V. Conclusively, overall charging mechanism fulfilled by this design. Figure 7 shows average charging voltage of both case mode charging. Case 1 shows voltage around 16 Volt average and case 2 around 13 voltage charging. If we compare the case 1 average charging voltage from first measurement with second measurement the values is higher. It shows that the case 1 mode is not very stable because in case 2 mode entered in case 1 but change to case 1 again, and the case 2 voltage that leativly lower than the cut off voltage make this unstable condition hapeen longer than the second measurment. If we compare charging voltage happen in first measurement, the voltage drop for case 1 is larger than case 2. This happens because the FET resistance increase so the voltage also increases. Because the resistance increase it also reduce current that flow and increase the charging voltage. Meanwhile for case 2 the charging voltage is lower than the case 1 because PWM sent to the FET driver which is BJT the the duty cycle is at 100% so the resistance of the FET decrease causes the current that flow to the battery to increace and the charging voltage is dropping. The voltage happen also varies for case 1 is supposed to be around 12 V but happen around 16 Voltage, because for case 2 charghing mechanism follows the duty cycle switching so voltage keep changing according to the PWM signal, when it is high the voltage should around 9 V and when PWM sign is low the PWM should be around 20 V but the measured value of average is quite low the it supposed. Allegedly because the PWM is changing the charging mode keep changing bang to mode below voltage. Third Measurement was conducted by measuring power from the solar panel into the system and the power that charges the battery. This measurement was done under sun when the sky is clear so the raddiance is at it's peak or effective intensity. The measured system are proposed simple pwm system and MPPT that available at the market, to compare the performance between this type of solar controller. The PWM measuring is using the same design as explained above but only in the first case mode. The MPPT measuring is using same solar panel as the the designed PWM controller but the output system is using 12 V. Figure 8 shows the average charging current occur in both case. Case 1 (one) shows larger average charging current than case 2 (two), with a current value of for about 400 mA and 150 mA for case 2. This shows that case 1 managed to charged battery with higher available current to the battery from the intiating voltage state of the battery. Which means the current driver managed to be controlled by the 95% duty cyle PWM produced by the micro controller. Case 2 starts when the battery voltage state is 8.04 V. In this case the PWM produced by the microcontroller have 10% duty cycle. Because of this lesser duty cycle the current that allowed through only when the condition PWM high value only, therefore the current value obtained in this mode has a momentary value then cut off for a longer time then this cycle repeatedly continues.  Figure 9 shows the solar voltage or charging voltage that occurs. In case 1 value of charging voltage close to the value of battery voltage which in this condition value below 8 which is about 9 volt of charging voltage average. This is reasonable because it caused the current driver as if short then the solar panels as directly in parallel with battery. The voltage in case 1 has a slightly larger value, this is due to the use of diodes just before the battery, this is used so that no backflow and solar voltage is maintained higher than the battery and not too similar. In case 2 solar has a higher average charging voltage of about 12 volts. This is because the current driver starts to limit the current so that it seems to have resistance that causes voltage drop increases and the voltage of solar panel.  Table 1 shows comparison value of voltage, current, power, and efficiency between proposed design SCC (PWM Controller) and commercial SCC (MPPT Controller) measured from both input and output of the controller. The voltage input of our controller is actually lower than the commercial one. This happens because the solar cell is connected directly to the battery without using regulator or dc-dc converter so the voltage drop according to the current flow to the load and the load resistance it self. While MPPT the input voltage is higher than proposed design controller, this happens because the MPPT fundamental is using DC-DC converter the input voltage is the original value or maximum loaded voltage of the solar panel with loaded current condition. This indicates that using MPPT can maximizing the power that can be used from the solar panel, input power on MPPT measurement is higher than the proposed design, but this makes MPPT more expensive and need more space than proposed design charging simply because it needs more component such as DC-DC converter IC and the MPPT IC to control the DC-DC converter and it use inductor that use big space while proposed design just need an IC or small Microcontroller to monitor and drives the current. This also shows that if the system or load voltage is relatively lower with significan value MPPT will much be suitable controller, but if the solar panel loaded voltage near the output system voltage, proposed design will be much suitable controller relatively cheaper. The basic MPPT it self purposed to maximizing the potency of the panel but not applying CC-CV method mostly in simple MPPT combining between proposed design and MPPT could be more effective both for charging and the battery life. The efficiency value of proposed design is lower than MPPT but still in tolerable value. Efficiency value could be affected by the the current flow to the microcontroller to perform the charging mechanism and small disspation occured on the transistor and the power MOSFET also the prototype is made on holed PCB. The summary of the comparison performance of our proposed SCC is shown in Table 2.

Conclusion
A solar charge controller is a voltage and/or current regulator from solar cell to battery that keep battery from overcharging. This paper shows a simple solar charge controller using microcontroller ATtiny85 as it's switching mechanism for the charging current driver. For both charging case, this device successfully managed to provide current and voltage according to expected design with 400 mA, 8.9 V for the first charging case and 150 mA, 12 V for the second charging case. This system suitable if the input panel and the output voltage do not change have much different value of voltage.