ARID ZONE JOURNAL OF ENGINEERING, TECHNOLOGY & ENVIRONMENT AZOJETE December 2020. Vol. 16(4):793-802 Published by the Faculty of Engineering, University of Maiduguri, Maiduguri, Nigeria. Print ISSN: 1596-2490, Electronic ISSN: 2545-5818 www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 793 ORIGINAL RESEARCH ARTICLE DESIGN ANALYSIS OF MICROCONTROLER BASED AUTOMATIC POWER MANAGEMENT IN PHOTOVOLTAIC SYSTEMS A. A. Okandeji1, F. Onaifo2, O. O. Olaluwoye2, S. N. Ukagu3, B. O. Sosanya4 and I. E. Imobhio3 1Department of Electrical/Electronic Engineering, University of Lagos, Akoka, Lagos State, Nigeria. 2Department of Electrical/Electronic Engineering, Olabisi Onabanjo University, Ogun State, Nigeria. 3Department of Electrical and Computer Engineering, Igbinedion University, Okada, Edo State, Nigeria 4Curative Integrated Services Limited, Lagos, Nigeria *Corresponding author’s email address: aokandeji@unilag.edu.ng 1.0 Introduction Solar energy is an alternative source of energy in rural and remote areas of Nigeria. It complements rapid development of small scale industries and reduces the rural–urban drift. The country receives abundant solar radiation and sunshine. Accordingly, solar energy is the most promising of the renewable energy (RE) resources in Nigeria due to its apparent abundance. Energy radiated from the sun is about 384.6 septillion watts which is 1.082 million ton of oil equivalent (mtoe) per day (Kadafa, 2012). This is about 4000 times the current daily crude oil production in Nigeria, and about 13,000 times the natural gas daily production, based on standard energy unit (Maijama’a et al., 2015). Inspite of the abundance of solar as a RE source, there must be a conscious effort to manage RE in rural areas to avoid a complete impromptu shutdown of the photovoltaic (PV) system. The basic idea of the energy management system is to disconnect load in the system in the order of less importance. In a more general term, this is called load shedding in power system operations. Effectively, Load shedding is a measure of last resort to prevent the collapse of the power system be it a central generation, microgrid or stand alone (Osueke et al., 2013). When there is insufficient power station capacity to supply the demand (load) from all the customers, the electricity system becomes unbalanced, which can cause it to trip out the supply (a blackout), and which could take days to restore. In the context of a PV RE source, terminating supply to an unused electrical appliance is aimed at saving the available electrical energy. Saving electricity (by using energy-efficient appliances, switching off equipment when not in use, using alternative sources of energy) has benefits such as reduced cost, less pollution, better use of natural resources (coal, water and fuel), and less wear and tear on the power stations, transmission and distribution systems, and it saves customers money. In terms of capacity constraints, saving electricity also means that the load on the national power system is reduced (Gujba et al., 2015). This helps to stabilize the balance between the available generation and the demand, in ARTICLE INFORMATION ABSTRACT This work considered the design analysis of an energy management system to control the state of battery discharge of a solar power system without any form of load discrimination, thus preventing a sudden system shut down. The state of discharge of the storage battery is monitored by the voltage level sensor. In particular, four voltage levels were used in this work namely: 11.5V (for less critical), 11.0V, 10.5V and 10.0V (for most critical load). The outputs of the sensors are then connected to a microcontroller which is programmed to isolate the loads in the order of priority. Tests result showed that at different voltage levels, specific load was disconnected from the desired voltage thus, stored energy was efficiently conserved. Accordingly, this prototype design ensures efficient energy management in photovoltaic systems. © 2020 Faculty of Engineering, University of Maiduguri, Nigeria. All rights reserved. Submitted 2 May, 2020 Revised 23 November, 2020 Accepted 27 November, 2020 Keywords: Energy-management voltage-level-sensor Microcontroller energy conservation solar power system mailto:aokandeji@unilag.edu.ng http://www.azojete.com.ng Okandeji et al: Design Analysis of Microcontroler Based Automatic Power Management in Photovoltaic Systems. AZOJETE,16(4):793-802. ISSN 1596-2490; e-ISSN 2545-5818, www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 794 this way, reducing the risk of load shedding. (Nasir et al., 2014) developed an automatic load- shedding strategy for stand-alone photovoltaic system which was designed using the SoftCad Eagle PCB Design Software for schematic design. Test results showed that the load is shed when the power is smaller than the load demands. In contrast to existing results, this work considers the development of an energy management system to manage the storage depth of discharge in a solar powered home, without any form of discrimination on the connected load thereby preventing the system from a sudden shutdown. In particular, by using a microcontroller to coordinate the processes between the voltage sensors and the output interface, the state of discharge of the storage battery is monitored by the voltage level sensor resulting into efficient management of the stored energy. 2.0 Materials and Methods This section focuses on the analysis and design considerations of the proposed PV energy management system. 2.1 Design of The Voltage Sensors In this study, the operational amplifier (op-amp) comparator is used as the voltage sensor. The circuit for a basic operational amplifier comparator is shown in Figure 1. It is possible to use an op-amp as a comparator as it fulfills the basic requirements for the function. In operation, the operational amplifier goes into positive or negative saturation depending upon the input voltages. As the gain of the operational amplifier will generally exceed 100000, the output will run into saturation when the inputs are only fractions of a millivolt apart. Although op-amps are widely used as comparators, special comparator chips are far better. This specific comparator chips offer very fast switching times well above those offered by most op-amps that are intended for more linear applications. Typical slew rates are in the region of several thousand volts per microsecond, although more often, figures of propagation delay are quoted. A typical comparator circuit will have one of the inputs held at a given voltage. This may often be a potential divider from a supply or reference source. The other input is taken to the point to be sensed. In this study, the fixed input is held by a Zener diode at 3.9V while other references are fixed 0.6V apart. The input voltage to the fixed unit is fixed by a regulator 7809. The forward voltage drop is utilized for this purpose. The value of the resistor is given by the equation R = Vcc−Vz Iz , (1) where Vcc = is 9V from the regulator, Vz is the Zener breakdown voltage chosen as 3.9V (the most critical load), and Iz is the Zener current chosen as 10mA (from the data sheet of the diode). Note that the choice of these values as given in the data sheet helps to procure a resistor whose value is available in the standard resistor table. Therefore, R = (9 − 3.9)/ (0.001) = 5100Ω. A close value to this on the standard resistor table is 5.6kΩ. The sensed input is then fixed by a voltage divider network using a pot resistor connected to the floating battery voltage. http://www.azojete.com.ng Arid Zone Journal of Engineering, Technology and Environment, December, 2020; Vol. 16(4):793-802. ISSN 1596-2490; e-ISSN 2545- 5818; www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 795 Figure 1: Circuit for a basic operational amplifier comparator 2.2 Microcontroller Pin Description PIC16F84 has a total of 18 pins as shown in Figure 2. It is most frequently found in a Dual-in- package (DIP)18 type case but can also be found in surface mount devices (SMD) case which is smaller from a DIP. Surface Mount Devices, in general, suggests that holes for pins to go through when mounting aren't necessary in soldering this type of component. Figure 2: Pin assignment of PIC 16F84A Pin no.1 RA2 Second pin on port A. Used as an input Pin no.2 RA3 Third pin on port A. Used as an input. Pin no.3 RA4 Fourth pin on port A. TOCK1 which functions as a timer is also found on this pin. Pin no.4 MCLR Reset input and Vpp programming voltage of a microcontroller. Pin no.5 Vss Ground of power supply. Pin no.6 RB0 Zero pin on port B. Interrupt input is an additional function. Pin no.7 RB1 First pin on port B. No additional function, but could be used as an output. Pin no.8 RB2 Second pin on port B. No additional function, but could be used as an output. Pin no.9 RB3 Third pin on port B. No additional function, but could be used as an output. Pin no.10 RB4 Fourth pin on port B. Used as output. Pin no.11 RB5 Fifth pin on port B. Used as output. Pin no.12 RB6 Sixth pin on port B. Used as output. Pin no.13 RB7 Seventh pin on port B. Used as output. Pin no.14 Vdd Positive power supply pole. Pin no.15 OSC2 Pin assigned for connecting with an oscillator. Pin no.16 OSC1 Pin assigned for connecting with an oscillator. Pin no.17 RA2 Second pin on port A. Used as an input. Pin no.18 RA1 First pin on port A. Used as an input. 2.2.1 Crystal Oscillator The crystal oscillator in this study is kept in a metal housing with two pins where the frequency at which the crystal oscillates is recorded. One ceramic capacitor of 30pF whose other end is connected to the ground needs to be connected with each pin. Oscillator and capacitors can be packed in a joint case with three pins. Such element is called ceramic resonator. The center pin of the element is the ground, while end pins are connected with OSC1 and OSC2 pins on the microcontroller. In this study, for operational efficiency, the oscillator is placed nearer to the microcontroller to avoid any interference on the lines on which the microcontroller is receiving a clock (Theraja and Theraja, 2008). Figure 3 shows the diagram of an oscillator with the PIC16F84 microcontroller. file:///C:/Users/user/Downloads/azojete143/www.azojete.com.ng mailto:aokandeji@unilag.edu.ng Okandeji et al: Design Analysis of Microcontroler Based Automatic Power Management in Photovoltaic Systems. AZOJETE,16(4):793-802. ISSN 1596-2490; e-ISSN 2545-5818, www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 796 Figure 3: Diagram of an Oscillator with the PIC16F84 The pins 15 and 16 are connected to the two ends of the crystal oscillator as shown in Figure 3. As discussed above, the function of the crystal oscillator is to provide the timing which it controls by dividing the signal which enters the PIC16F84. The frequency at which the crystal oscillator operates is at 4Mhz. The two ceramic capacitors C1 and C2 which are of values of 22nF act as filters to ensure that interference does not affect the microcontroller receiving a clock. 2.3 Design of the Relay Interface An electronic circuit will normally need a relay driver using a transistor circuit in order to convert its low power direct current (DC) switching output of the microcontroller into a high- power main alternating current (AC) switching output. However, the low-level signals from an electronic circuit which is derived from the microcontroller stage is incapable of driving a relay directly because a relay requires relatively higher DC which is normally not available from the microcontroller stage. In this study, to overcome the above issue, a relay control stage is imperative for the circuit. The relay driver is an additional transistor stage attached with the relay which needs to be operated as shown in Figure 4. This transistor is typically and solely employed for operating the relay in response to the commands received from the preceding control stage. Figure 4: Basic Circuit Diagram of the relay driver The configuration of Figure 4 only involves a transistor, a base resistor, and the relay with a fly back diode. Since the base drive voltage to the transistor is the major source for controlling the relay operations, there is a need to perfectly calculate the value for optimal results. The base resistor current value (Ib) is directly proportional to the current across the collector/emitter leads of the transistor or in other words, the relay coil current, which is the collector load of the transistor, becomes one of the main factors and directly influences the value of the base resistor of the transistor. From (Theraja and Theraja, 2008), the basic formula for calculating the base resistor of the transistor is given by the expression: Rb = Vb−0.6 Ib (2) But Ib = Relay Coil Current /hFE, then Rb = Vb−0.6 hFE Relay coil current (3) http://www.azojete.com.ng Arid Zone Journal of Engineering, Technology and Environment, December, 2020; Vol. 16(4):793-802. ISSN 1596-2490; e-ISSN 2545- 5818; www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 797 where R = base resistor of the transistor, Vb = source or the trigger voltage to the base resistor, hFE = forward current gain of the transistor. The expression, which is the “relay current,” may be obtained by solving ohm’s law (Theraja and Theraja, 2008): I = Vs/Rc, where I is the required relay current, Vs is the supply voltage to the relay, Rc is the relay coil resistance. The relay coil resistance can be easily identified by using a multi-meter. In this study, the supply voltage Vs = 12 V, the coil resistance is 400 Ohms. Then, relay current I = 12/400 = 0.03 or 30 mA. Also, the hFE of transistor (BC547) from datasheet is 150. Applying the above values into equation (2) we obtain, Rb = (Vb − 0.6) × Hfe ÷ Relay Current; Rb = (12 – 0.6)150/0.03 = 57,000 Ohms or 57 K, the closest value being 56 K. For the diode connected across the relay coil, although it is no way related with the above calculation, it still cannot be ignored. The diode ensures that the reverse electromotive force (EMF) generated from the relay coil is shorted through it, and not dumped into the transistor. Without this diode, the back EMF would try to find a path through the collector emitter of the transistor and in the course damage the transistor permanently, within seconds. The circuit diagram of the prototype design is shown in Figure 5. . file:///C:/Users/user/Downloads/azojete143/www.azojete.com.ng mailto:aokandeji@unilag.edu.ng Okandeji et al: Design Analysis of Microcontroler Based Automatic Power Management in Photovoltaic Systems. AZOJETE,16(4):793-802. ISSN 1596-2490; e-ISSN 2545-5818, www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 798 Figure 5: Circuit diagram http://www.azojete.com.ng Arid Zone Journal of Engineering, Technology and Environment, December, 2020; Vol. 16(4):793-802. ISSN 1596-2490; e-ISSN 2545- 5818; www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 799 2.4 Hardware unit construction The hardware unit for the prototype design was cased in a 9 X 9 X 3 parterres box. Holes were drilled for the mounting of the connecting terminals and the circuit using bolts and nuts. Figure 6 shows the picture of the packaged prototype. . Figure 6: The picture of the prototype design 3.0 Testing of the Voltage Sensors 3.1 Testing and Performance Evaluation This section focuses on the testing and performance evaluation of the prototype design. In particular, to ensure proper functionality of the unit, the various sections of the system are tested. 3.2 Testing of the Voltage Sensors The battery voltage is monitored by the voltage level sensor. A variable DC bench power supply was used to simulate battery voltage. Four levels were used in this design namely: 11.5V (for less critical), 11.0V, 10.5V and 10.0V (for most critical load). As the supply varies between the nominal voltage level and the minimum state of discharge, the outputs of the sensors were monitored and the result obtained is shown in Table 1. Table 1: The outputs of the sensors and the result obtained Input voltage Sensor 1 Sensor 2 Sensor 3 Sensor 4 VBAT>12V High high High High VBAT<11.5 Low high high High VBAT<11.0 Low low high High VBAT<10.5 Low low low High VBAT<10.0 Low low low Low As shown in Table 1, as the input battery voltage is greater than 12V, all four sensors remain active (high). As the input battery voltage becomes less than 11.5V, all sensors remain active except sensor 1 (low). Furthermore, as the input battery voltage goes below 11.0, two sensors remains active while the other two remains inactive. A further decrease in the input battery voltage triggers high and low sensor response to ensure efficient conservation of battery power. However, for an input battery voltage below 10V, all four sensors remain inactive (low). The outputs of these sensors are connected to a microcontroller which is programmed to isolate the loads in the order of priority. 3.2 Testing of the Microcontroller As stated earlier, the objective of using a microcontroller is to coordinate the processes between the voltage sensors and the output interface. When the sensors sense the voltage level, a signal is sent to the input pin of the microcontroller, and the microcontroller, acting on file:///C:/Users/user/Downloads/azojete143/www.azojete.com.ng mailto:aokandeji@unilag.edu.ng Okandeji et al: Design Analysis of Microcontroler Based Automatic Power Management in Photovoltaic Systems. AZOJETE,16(4):793-802. ISSN 1596-2490; e-ISSN 2545-5818, www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 800 the programmed instruction, activate the appropriate output. The output of the sensors, when fed into the data input of the microcontroller, an inversion of the input logic, as shown in Table 2, is obtained. Table 2: The outputs of the micro controller and the result obtained Input voltage Output 1 Output 2 Output 3 Output 4 VBAT>12V Low low low Low VBAT<11.5 high Low low Low VBAT<11.0 high high low Low VBAT<10.5 high high high Low VBAT<10.0 high high high High 3.3 Testing of the Relay Interface The relay interface was connected to the output of the microcontroller through a transistor. The base transistor receives the signal (voltage) and turns ON the collector current which activates the relay coil to disconnect the load and at the same time turn ON the LED indicator. 3.4 Testing of the Complete Prototype Design The complete prototype design was tested using the variable work bench power supply and the outputs monitored. At 12.5V, the four outputs were active as shown in the Figure 7. At 11.1V three outputs were active as shown in Figure 8. Figure 9 shows that the two outputs were active when the input voltage is 10.8V. Also, Figure 10 shows that only one output was active when the input voltage is 10.5V. Finally, as shown in Figure 11, all outputs were inactive when the input voltage is below 10.0V. Figure 7: At 12.5V, the four outputs were active Figure 8: At 11.1V three outputs were active http://www.azojete.com.ng Arid Zone Journal of Engineering, Technology and Environment, December, 2020; Vol. 16(4):793-802. ISSN 1596-2490; e-ISSN 2545- 5818; www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 801 Figure 9: Two outputs were active when the input voltage is 10.8V. Figure 10: One output was active when the input voltage is 10.5V Figure 11: All outputs were inactive when the input voltage is below 10.0V 4.0 Conclusions This work considered the development of an energy management method for a photovoltaic system to control the rate of discharge in order to prevent sudden system shut down without any form of discrimination on the load. The load on the solar system is first categorized in the order of importance as more critical and less critical. The state of discharge of the storage battery is monitored by the voltage level sensor. Four voltage level were used in this design namely: 11.5V (for less critical), 11.0V, 10.5V and 10.0V (for most critical load). The outputs of the sensors are connected to a microcontroller which is programmed to isolate the loads in the order of priority. The output of the microcontroller was interfaced to the AC load using electromechanical relays. Monitoring indicators is also included to enable visual insights into the connected loads. A digital voltmeter was also incorporated to indicate the battery voltage. file:///C:/Users/user/Downloads/azojete143/www.azojete.com.ng mailto:aokandeji@unilag.edu.ng Okandeji et al: Design Analysis of Microcontroler Based Automatic Power Management in Photovoltaic Systems. AZOJETE,16(4):793-802. ISSN 1596-2490; e-ISSN 2545-5818, www.azojete.com.ng Corresponding author’s e-mail address: aokandeji@unilag.edu.ng 802 Tests result showed that at different voltage levels, specific load was disconnected from the desired voltage level, thus, stored energy was efficiently conserved. References Gujba, H., Mulugetta, Y. and Azapagic, A. 2015. The household cooking sector in Nigeria: Environmental and economic sustainability assessment. Resources Journal, Article 4: 412-433. Kadafa, AA. 2012. Oil exploration and spillage in the Niger Delta of Nigeria. Civil and Environmental Research, 2(3): 38-51. Maijama’a, D., Maijama’a, L., and Umar, M. 2015. Renewable sources of energy for economic development in Nigeria. International Journal of Sustainable Energy and Environmental Research, 4(2): 49-63. Nasir, MNM., Farith, MM., Jali, MH., Jamri, MS., Jaafar, HI., and Sulaima, MF. 2014. Development of automatic load-shedding strategy for stand-alone photovoltaic system. International Journal of Applied Engineering Research, 9(20): 6895-6906. Osueke, CO., Uguru-Okorie, DC., and Abanihi, VK. 2013. Electricity stability in Nigeria through increased hydro power generation. International Journal of Emerging Technology and Advanced Engineering, 3(1): 9-13. Theraja, BL., and Theraja, AK. 2008. A Textbook of Electrical Technology. S. Chand and Company Limited, New Delhi, India http://www.azojete.com.ng