{"id":15149,"date":"2024-09-08T10:29:33","date_gmt":"2024-09-08T01:59:33","guid":{"rendered":"https:\/\/people.utm.my\/razman-ayop\/?p=15149"},"modified":"2025-01-15T10:30:40","modified_gmt":"2025-01-15T02:00:40","slug":"pwm-vs-mppt-solar-charge-controller-simulator-educational-kit","status":"publish","type":"post","link":"https:\/\/people.utm.my\/razman-ayop\/pwm-vs-mppt-solar-charge-controller-simulator-educational-kit\/","title":{"rendered":"PWM vs MPPT Solar Charge Controller Simulator Educational Kit"},"content":{"rendered":"\n<p>Pulse Width Modulation (PWM) vs Maximum Power Point Tracking (MPPT) Solar Charge Controller Simulator Educational Kit. LY2024J09301. \u00a9 2024 Universiti Teknologi Malaysia &#8211; All Rights Reserved.<\/p>\n\n\n\n<p>Drawback with Conventional Solar Educational Kit<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Requires sunlight. Unable to be used indoor or raining condition.<\/li>\n\n\n\n<li>Commonly use PWM since MPPT is expensive due to the additional power converter inside the charge controller. The cost and complexity become higher if both method is included.<\/li>\n\n\n\n<li>If use MPPT, the algorithm cannot be observed since it\u2019s too fast (&lt;1s).<\/li>\n\n\n\n<li>Change in battery cannot be observe since the PV and load used for education kit is small.<\/li>\n\n\n\n<li>Difficult to observe the battery full and depleted condition.<\/li>\n\n\n\n<li>Need multiple sensors and displays to observe all the important parameters of the system (commonly 6 sensors and 10 displays). These make the cost high.<\/li>\n\n\n\n<li>Safety issues since the battery can short-circuit and cause fire.<\/li>\n\n\n\n<li>The kit is heavy and takes a large space.<\/li>\n<\/ul>\n\n\n\n<p>The solution is to create an Arduino Simulator of the Solar Charge Controller. Advantages of PWM vs MPPT Solar Charge Controller Educational Kit:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>No need for sunlight.<\/li>\n\n\n\n<li>Can operate in either PWM or MPPT.<\/li>\n\n\n\n<li>The MPPT is set to operate slower, good for education (around 20s).<\/li>\n\n\n\n<li>Change in battery is observable as the battery is set to a very small capacity.<\/li>\n\n\n\n<li>Easy to observe the battery full and depleted condition since battery changes quickly.<\/li>\n\n\n\n<li>No need for sensor as it is inside a simulation model. All the parameters are displayed in 1 display. These make the cost low and easy to observe.<\/li>\n\n\n\n<li>No safety issues at this is only simulator.<\/li>\n\n\n\n<li>The kit is light and small in size.<\/li>\n<\/ul>\n\n\n\n<p>The PV, load, and charge controller is model inside the Arduino, which is the important component of this product. The irradiance (sunlight intensity) and the load are controlled using the potentiometers. The data from the potentiometers is then process by the model to produce the energy flows at the PV, battery, and load. The State of Charge (SOC) of the battery is also counted. There are 2 operating options for charge controller, which are the PWM and MPPT modes. The result of the simulation is then displayed at LCD 2004 with I2C module. The parameters displayed include the voltage, current, and power of the PV, load, and battery, as well as the SOC of the battery. 1 switch is added to control the operating mode (PWM or MPPT).<\/p>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\"><summary>The code for the project is provided here:<\/summary>\n<p>\/\/ Cereated by Razman Ayop on 24 August 2024 to 8 September 2024<br>\/\/ The objective is to help students under Academic Service Learning (ASL) to visualize how PWM &amp; MPPT charge controller works<br>\/\/ The project also is made to test the complexity of the project to ensure it is acceptable for Final Year Project (FYP) or not.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">include<\/h1>\n\n\n\n<h1 class=\"wp-block-heading\">include<\/h1>\n\n\n\n<p>\/\/ 0. Parameters<br>\/\/ 0.1. Battery<br>float SOC; \/\/ State of Charge (SOC)<br>float Vbat_nom=24; \/\/ Nominal Battery Voltage, V<br>float SOCnom=0.5; \/\/ Nominal SOC<br>float SOCini=0.5; \/\/ Initial SOC<br>float SOCmin=0.2; \/\/ Minimum SOC<br>float SOCmax=0.95; \/\/ Maximum SOC<br>float SOCrc=0.5; \/\/ Reconnect SOC<br>float m_Vbat=8; \/\/ Vbat Gradient, V\/SOC<br>float Cbat=40000; \/\/ Battery Capacity, W\/s<br>float Vbat; \/\/ Battery Voltage, V<br>float Ibat; \/\/ Battery Current. +Charge, -Discharge.<br>float Pbat; \/\/ Battery Power,W<br>float Ebat; \/\/ Battery Energy, Ws<br>float Ebat_sto0=SOCini*Cbat; \/\/ Previous Battery Energy Storage, Ws<br>float Ebat_sto; \/\/ Battery Energy Storage, Ws<\/p>\n\n\n\n<p>\/\/ 0.2. PV Model<br>float Voc_stc=50; \/\/ STC Open Circuit Voltage, V<br>float Vmp_stc=40; \/\/ STC Maximum Power Voltage, V<br>float Isc_stc=11; \/\/ STC Short Circuit Current, A<br>float Imp_stc=10; \/\/ STC Maximum Power Current, A<br>float Ns=1; \/\/ Number of Series PV Module<br>float Np=1; \/\/ Number of Parallel PV Module<br>float Voc; \/\/ Open Circuit Voltage, V<br>float Vmp; \/\/ Maximum Power Voltage, V<br>float Isc; \/\/ Short Circuit Current, A<br>float Imp; \/\/ Maximum Power Current, A<br>float G=1000; \/\/ Irradiance, W\/m^2<br>float Gmax=1000; \/\/ Maximum Irradiance, W\/m^2<br>float Vpv; \/\/ PV Voltage, V<br>float Ipv; \/\/ PV Current, A<br>float Ppv; \/\/ PV Power, W<br>float Epv; \/\/ PV Energy, Ws<br>float Vpv0=Vbat_nom; \/\/ Set PV voltage same as battery voltage<br>float Ipv0=1; \/\/ PV Current<\/p>\n\n\n\n<p>\/\/ 0.3. Load Parameters<br>float Vload=0; \/\/ Load Voltage, V<br>float Iload=0; \/\/ Load Current, A<br>float Ploadmax=700; \/\/ Ploadmax, W<br>float Pload; \/\/ Load Power, W<br>float Eload; \/\/ Load Energy, Ws<\/p>\n\n\n\n<p>\/\/ 0.4. Other Parameter<br>float Vstep=0.5; \/\/ P&amp;O MPPT Voltage Step, V<br>float tsam=1; \/\/ Sample Time, s<br>float Sload=0; \/\/ Load Switch, 0=On, 1=Off<br>float Spv=0; \/\/ PV Switch, 0=On, 1=Off<br>int MODE=1; \/\/ Operating Mode. 0=PWM, 1=MPPT<br>float dPV; \/\/ Change of Power-Voltage<br>float Vref=Vbat_nom; \/\/ Reference Voltage<br>float T=12345; \/\/ Test Parameter<\/p>\n\n\n\n<p>\/\/ 0.5. Input<br>int pinG=A0; \/\/ G ADC Pin<br>float valG=1000; \/\/ G Value<br>int pinLoad=A1; \/\/ Load ADC Pin<br>float valLoad; \/\/ Load Value<br>int pinMod=2; \/\/ Mode Digital In Pin<\/p>\n\n\n\n<p>\/\/ 0.6. Output<br>LiquidCrystal_I2C lcd(0x27, 20, 4); \/\/ set the LCD address to 0x27 (SDA A4, SCL A5) for a 20 chars and 4 line display<\/p>\n\n\n\n<p>void setup() {<br>\/\/ Initiate Serial Monitor<br>Serial.begin(9600);<br>Serial.print(&#8220;\\n\\nInitiate Charge Controller\\n&#8221;);<\/p>\n\n\n\n<p>\/\/ Set Digital Input<br>pinMode(pinMod,INPUT);<\/p>\n\n\n\n<p>\/\/ Set LCD<br>lcd.init(); \/\/ initialize the lcd<br>lcd.backlight(); \/\/ Turn on the LCD screen backlight<br>}<\/p>\n\n\n\n<p>void loop() {<br>\/\/ 1. Component Models<br>\/\/ 1.1. PV Array Model<br>delay(500);<br>valG=analogRead(pinG);<br>G=valG\/1023<em>Gmax; Voc=Ns<\/em>Voc_stc;<br>Vmp=Ns<em>Vmp_stc; Isc=G\/1000<\/em>Np<em>Isc_stc; Imp=G\/1000<\/em>Np*Imp_stc;<\/p>\n\n\n\n<p>\/\/ 1.2. Battery Model<br>SOC=Ebat_sto0\/Cbat;<br>Vbat=m_Vbat<em>SOC+(Vbat_nom-m_Vbat<\/em>SOCnom);<\/p>\n\n\n\n<p>\/\/ 1.3. Load<br>valLoad=analogRead(pinLoad);<br>Pload=valLoad\/1023*Ploadmax;<br>if (Sload==1 &amp;&amp; SOC&lt;SOCrc){<br>Vload=0;<br>Iload=0;<br>Pload=0;<br>}<br>else {<br>Vload=Vbat;<br>Iload=Pload\/Vload;<br>Sload=0;<br>}<\/p>\n\n\n\n<p>\/\/ 2.0. PWM vs MPPT<br>MODE=digitalRead(pinMod);<br>if (MODE==LOW){<br>\/\/ 2.1. PWM Mode<br>Vpv=Vbat;<br>if (Vpv&lt;=Vmp){<br>Ipv=(Imp-Isc)\/Vmp<em>Vpv+Isc; } else { Ipv=Imp\/(Vmp-Voc)<\/em>Vpv+(Imp-Imp<em>Vmp\/(Vmp-Voc)); } Ppv=Vpv<\/em>Ipv;<br>Vpv0=Vpv;<br>Ipv0=Ipv;<br>Vref=Vpv;<br>}<\/p>\n\n\n\n<p>else {<br>\/\/ 2.2. MPPT Mode<br>Vpv=Vref;<br>if (Vpv&lt;=Vmp){ Ipv=(Imp-Isc)\/Vmp<em>Vpv+Isc; } else { Ipv=Imp\/(Vmp-Voc)<\/em>Vpv+(Imp-Imp<em>Vmp\/(Vmp-Voc)); } Ppv=Vpv<\/em>Ipv; dPV=(Ppv-Vpv0<em>Ipv0)<\/em>(Vpv-Vpv0); if (dPV&gt;=0) {<br>Vref=Vpv+Vstep;<br>}<br>else {<br>Vref=Vpv-Vstep;<br>}<br>Vpv0=Vpv;<br>Ipv0=Ipv;<br>}<\/p>\n\n\n\n<p>\/\/ 3.0. Energy Management System (EMS)<br>Epv=Ppv<em>tsam; Eload=Pload<\/em>tsam;<br>Spv=0;<br>Ebat=Epv-Eload; \/\/ +Charge, -Discharge<br>Ebat_sto=Ebat_sto0+Ebat;<br>SOC=Ebat_sto\/Cbat;<br>if (Ebat&gt;0){<br>\/\/ 3.1. Excess Energy<br>if (SOC&gt;=SOCmax){<br>\/\/ 3.1.1. Battery Full<br>SOC=SOCmax;<br>Ebat=-Eload;<br>Ebat_sto=Ebat_sto0+Ebat;<br>Vpv=Voc;<br>Ipv=0;<br>Ppv=0;<br>Spv=1;<br>}<br>}<br>else {<br>\/\/ 3.2. Less Energy<br>if (SOC&lt;=SOCmin){<br>\/\/ 3.2.1. Battery Depleted<br>SOC=SOCmin;<br>Ebat=Epv;<br>Ebat_sto=Ebat_sto0+Ebat;<br>Vload=0;<br>Iload=0;<br>Pload=0;<br>Sload=1;<br>}<br>}<br>Ebat_sto0=Ebat_sto;<br>Pbat=Ebat\/tsam;<br>Ibat=Pbat\/Vbat;<\/p>\n\n\n\n<p>\/\/ 4.0. Serial Print<br>Serial.print(&#8220;Vpv = &#8220;);<br>Serial.print(Vpv);<br>Serial.print(&#8220;, Ipv = &#8220;);<br>Serial.print(Ipv);<br>Serial.print(&#8220;, Ppv = &#8220;);<br>Serial.print(Ppv);<br>Serial.print(&#8220;\u2026 Vbat = &#8220;);<br>Serial.print(Vbat);<br>Serial.print(&#8220;, Ibat = &#8220;);<br>Serial.print(Ibat);<br>Serial.print(&#8220;, Pbat = &#8220;);<br>Serial.print(Pbat);<br>Serial.print(&#8220;, SOC = &#8220;);<br>Serial.print(SOC);<br>Serial.print(&#8220;\u2026 Vload = &#8220;);<br>Serial.print(Vload);<br>Serial.print(&#8220;, Iload = &#8220;);<br>Serial.print(Iload);<br>Serial.print(&#8220;, Pload = &#8220;);<br>Serial.print(Pload);<br>Serial.print(&#8220;. TEST = &#8220;);<br>Serial.print(valLoad);<br>Serial.print(&#8220;. \\n&#8221;);<\/p>\n\n\n\n<p>\/\/ 5.0. LCD Display<br>lcd.clear();<br>\/\/PV<br>lcd.setCursor(0, 0);<br>lcd.print(&#8220;PV: &#8220;);<br>lcd.setCursor(4, 0);<br>lcd.print(Vpv);<br>lcd.setCursor(8, 0);<br>lcd.print(&#8220;V &#8220;);<br>lcd.setCursor(10, 0);<br>lcd.print(Ipv);<br>lcd.setCursor(14, 0);<br>lcd.print(&#8220;A &#8220;);<br>lcd.setCursor(16, 0);<br>lcd.print(Ppv);<br>lcd.setCursor(19, 0);<br>lcd.print(&#8220;W &#8220;);<\/p>\n\n\n\n<p>\/\/Load<br>lcd.setCursor(0, 1);<br>lcd.print(&#8220;LD:&#8221;);<br>lcd.setCursor(4, 1);<br>lcd.print(Vload);<br>lcd.setCursor(8, 1);<br>lcd.print(&#8220;V &#8220;);<br>lcd.setCursor(10, 1);<br>lcd.print(Iload);<br>lcd.setCursor(14, 1);<br>lcd.print(&#8220;A &#8220;);<br>lcd.setCursor(16, 1);<br>lcd.print(Pload);<br>lcd.setCursor(19, 1);<br>lcd.print(&#8220;W &#8220;);<\/p>\n\n\n\n<p>\/\/BAT<br>lcd.setCursor(0, 2);<br>lcd.print(&#8220;BA:&#8221;);<br>lcd.setCursor(4, 2);<br>lcd.print(Vbat);<br>lcd.setCursor(8, 2);<br>lcd.print(&#8220;V &#8220;);<br>lcd.setCursor(10, 2);<br>lcd.print(Ibat);<br>lcd.setCursor(16, 2);<br>lcd.print(&#8220;A &#8220;);<br>lcd.setCursor(4, 3);<br>lcd.print(SOC*100);<br>lcd.setCursor(8, 3);<br>lcd.print(&#8220;% &#8220;);<br>lcd.setCursor(10, 3);<br>lcd.print(Pbat);<br>lcd.setCursor(16, 3);<br>lcd.print(&#8220;W &#8220;);<br>}<\/p>\n<\/details>\n\n\n\n<p><\/p>\n\n\n\n<p>This research was supported by Ministry of Higher Education (MOHE) through Fundamental Research Grant Scheme (FRGS\/1\/2021\/TK0\/UTM\/02\/19). The authors would like to express gratitude to Universiti Teknologi Malaysia (UTM) for providing comprehensive facilities. Lastly, thanks to colleagues who have either directly or indirectly contributed to the completion of this work.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"PWM vs MPPT Solar Charge Controller Simulator Educational Kit (Part 1 - Theory)\" width=\"1080\" height=\"608\" src=\"https:\/\/www.youtube.com\/embed\/KYCI9KpeBNU?feature=oembed\"  allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"PWM vs MPPT Solar Charge Controller Simulator Educational Kit (Part 2 - Simulate)\" width=\"1080\" height=\"608\" src=\"https:\/\/www.youtube.com\/embed\/gtNyCNofC3o?feature=oembed\"  allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<div data-wp-interactive=\"core\/file\" class=\"wp-block-file\"><object data-wp-bind--hidden=\"!state.hasPdfPreview\" hidden class=\"wp-block-file__embed\" data=\"https:\/\/people.utm.my\/razman-ayop\/wp-content\/uploads\/sites\/2074\/2024\/09\/Poster-1.pdf\" type=\"application\/pdf\" style=\"width:100%;height:600px\" aria-label=\"Embed of Poster-1.\"><\/object><a id=\"wp-block-file--media-f7276090-d767-4f54-9c05-ca3d155bb2c1\" href=\"https:\/\/people.utm.my\/razman-ayop\/wp-content\/uploads\/sites\/2074\/2024\/09\/Poster-1.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Poster-1<\/a><a href=\"https:\/\/people.utm.my\/razman-ayop\/wp-content\/uploads\/sites\/2074\/2024\/09\/Poster-1.pdf\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-f7276090-d767-4f54-9c05-ca3d155bb2c1\">Download<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Pulse Width Modulation (PWM) vs Maximum Power Point Tracking (MPPT) Solar Charge Controller Simulator Educational Kit. LY2024J09301. \u00a9 2024 Universiti Teknologi Malaysia &#8211; All Rights Reserved. Drawback with Conventional Solar Educational Kit The solution is to create an Arduino Simulator of the Solar Charge Controller. Advantages of PWM vs MPPT Solar Charge Controller Educational Kit: [&hellip;]<\/p>\n","protected":false},"author":24954,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[94,68,50],"tags":[],"class_list":["post-15149","post","type-post","status-publish","format-standard","hentry","category-community-service","category-research-activities","category-teaching-post"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/posts\/15149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/users\/24954"}],"replies":[{"embeddable":true,"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/comments?post=15149"}],"version-history":[{"count":13,"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/posts\/15149\/revisions"}],"predecessor-version":[{"id":15222,"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/posts\/15149\/revisions\/15222"}],"wp:attachment":[{"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/media?parent=15149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/categories?post=15149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/people.utm.my\/razman-ayop\/wp-json\/wp\/v2\/tags?post=15149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}