Devices & Components
Arduino Uno Rev3
TDC-M20-36PV panel
TC4420 Driver
B25 0 to 25V Voltage Sensor Module
Resistor, 70 ohm
INA169 Analog DC Current Sensor
DC-DC Switching Boost, Inverting Regulator
Software & Tools
Proteus 8.6
Arduino IDE
Project description
Code
INC_Code.ino
c_cpp
Below the code of incremental conductance algorithm, to compile it, please go to "Sketch" menu and click on "Export compiled Binary". Then the ".hex" will be generated in the Sketch Folder.
1/***************************************************************************** 2 Copyright Motahhir All Rights Reserved 3*****************************************************************************/ 4 5/***************************************************************************** 6 Header Files included 7 *****************************************************************************/ 8 9/****************************************************************************** 10 PROJECT : MPPT (INC) implementation 11 Function : INC Arduino Code 12 ****************************************************************************** 13 * * 14 Written by : Saad Motahhir Date : 09/10/2016 15 * * 16 Email : saad.motahhir@usmba.ac.ma 17 ****************************************************************************** 18 MODIFICATION LOG: 19 ****************************************************************************** 20 Modified by : Date : 21 Comments : 22 ******************************************************************************/ 23#include <LiquidCrystal.h> 24 LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 25 26float sensorValue1 = 0; 27float sensorValue2 = 0; 28float voltageValue = 0; 29float currentValue = 0; 30float Power_now = 0, Power_anc=0, Current_anc =0,Voltage_anc=0, deltaI=0, deltaV=0 ; 31float delta = 1.4; 32float pwm = 128; 33void setup() 34{ 35 pinMode(6, OUTPUT); 36 lcd.begin(16, 2); 37} 38 39void loop() 40{ 41 sensorValue1 = analogRead(A0); 42 sensorValue2 = analogRead(A1); 43 voltageValue= (sensorValue1 * 5.0 /1023.0) *5; 44 currentValue= (sensorValue2 * 5.0 /1023.0); 45 lcd.setCursor(0, 0); 46 Power_now = voltageValue * currentValue; 47 48 lcd.print("Ppv="); 49 lcd.print(Power_now); 50 lcd.print("W"); 51 lcd.setCursor(0, 1); 52 lcd.print("V="); 53 lcd.print(voltageValue); 54 lcd.print("V I="); 55 lcd.print(currentValue); 56 lcd.print("A"); 57 deltaI= currentValue-Current_anc; 58 deltaV= voltageValue-Voltage_anc; 59 if(deltaV==0) 60 { if(deltaI==0) 61 {// nothing to do 62 } 63 else 64 { if(deltaI>0) 65 pwm=pwm-delta; 66 else 67 pwm=pwm+delta; 68 } 69 } 70 else 71 { if((voltageValue*deltaI)+(currentValue*deltaV)==0) 72 {// nothing to do 73 } 74 75 else 76 { if((deltaI/deltaV)+(currentValue/voltageValue)>0) 77 78 pwm=pwm-delta; 79 80 else 81 pwm=pwm+delta; 82 83 } 84 } 85 86Voltage_anc= voltageValue; 87Current_anc= currentValue; 88Power_anc=Power_now; 89if(pwm > 240) 90 pwm=240; 91if (pwm < 15) 92 pwm=15; 93 analogWrite(6, pwm); 94} 95 96
PandO_Code.ino
c_cpp
Below the code of perturb and observe algorithm, to compile it, please go to "Sketch" menu and click on "Export compiled Binary". Then the ".hex" will be generated in the Sketch Folder.
1/***************************************************************************** 2 Copyright Motahhir All Rights Reserved 3*****************************************************************************/ 4 5/***************************************************************************** 6 Header Files included 7 *****************************************************************************/ 8 9/****************************************************************************** 10 PROJECT : MPPT (P&O) implementation 11 Function : P&O Arduino Code 12 ****************************************************************************** 13 * * 14 Written by : Saad Motahhir Date : 09/10/2016 15 * * 16 Email : saad.motahhir@usmba.ac.ma 17 ****************************************************************************** 18 MODIFICATION LOG: 19 ****************************************************************************** 20 Modified by : Date : 21 Comments : 22 ******************************************************************************/ 23#include <LiquidCrystal.h> 24LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 25 26float sensorValue1 = 0; 27float sensorValue2 = 0; 28float voltageValue = 0; 29float currentValue = 0; 30float Power_now = 0, Power_anc = 0, voltage_anc = 0; 31float delta = 3; 32float pwm = 128; 33void setup() 34{ 35 pinMode(6, OUTPUT); 36 lcd.begin(16, 2); 37} 38 39void loop() 40{ 41 sensorValue1 = analogRead(A0); 42 sensorValue2 = analogRead(A1); 43 voltageValue = (sensorValue1 * 5.0 / 1023.0) * 5; 44 currentValue = (sensorValue2 * 5.0 / 1023.0); 45 lcd.setCursor(0, 0); 46 Power_now = voltageValue * currentValue; 47 48 lcd.print("Ppv="); 49 lcd.print(Power_now); 50 lcd.print("W"); 51 lcd.print(pwm); 52 lcd.setCursor(0, 1); 53 lcd.print("V="); 54 lcd.print(voltageValue); 55 lcd.print("V I="); 56 lcd.print(currentValue); 57 lcd.print("A"); 58 59 60 61 if (Power_now > Power_anc) 62 { if (voltageValue > voltage_anc) 63 pwm = pwm - delta; 64 else 65 pwm = pwm + delta; 66 } 67 else 68 { 69 if (voltageValue > voltage_anc) 70 pwm = pwm + delta; 71 else 72 pwm = pwm - delta; 73 } 74 Power_anc = Power_now; 75 voltage_anc = voltageValue; 76 if (pwm < 20) 77 pwm = 20; 78 if (pwm > 150) 79 pwm = 150; 80 81 analogWrite(6, pwm); 82} 83 84 85
INC_Code.ino
c_cpp
Below the code of incremental conductance algorithm, to compile it, please go to "Sketch" menu and click on "Export compiled Binary". Then the ".hex" will be generated in the Sketch Folder.
1/***************************************************************************** 2 Copyright Motahhir All Rights Reserved 3*****************************************************************************/ 4 5/***************************************************************************** 6 Header Files included 7 *****************************************************************************/ 8 9/****************************************************************************** 10 PROJECT : MPPT (INC) implementation 11 Function : INC Arduino Code 12 ****************************************************************************** 13 * * 14 Written by : Saad Motahhir Date : 09/10/2016 15 * * 16 Email : saad.motahhir@usmba.ac.ma 17 ****************************************************************************** 18 MODIFICATION LOG: 19 ****************************************************************************** 20 Modified by : Date : 21 Comments : 22 ******************************************************************************/ 23#include <LiquidCrystal.h> 24 LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 25 26float sensorValue1 = 0; 27float sensorValue2 = 0; 28float voltageValue = 0; 29float currentValue = 0; 30float Power_now = 0, Power_anc=0, Current_anc =0,Voltage_anc=0, deltaI=0, deltaV=0 ; 31float delta = 1.4; 32float pwm = 128; 33void setup() 34{ 35 pinMode(6, OUTPUT); 36 lcd.begin(16, 2); 37} 38 39void loop() 40{ 41 sensorValue1 = analogRead(A0); 42 sensorValue2 = analogRead(A1); 43 voltageValue= (sensorValue1 * 5.0 /1023.0) *5; 44 currentValue= (sensorValue2 * 5.0 /1023.0); 45 lcd.setCursor(0, 0); 46 Power_now = voltageValue * currentValue; 47 48 lcd.print("Ppv="); 49 lcd.print(Power_now); 50 lcd.print("W"); 51 lcd.setCursor(0, 1); 52 lcd.print("V="); 53 lcd.print(voltageValue); 54 lcd.print("V I="); 55 lcd.print(currentValue); 56 lcd.print("A"); 57 deltaI= currentValue-Current_anc; 58 deltaV= voltageValue-Voltage_anc; 59 if(deltaV==0) 60 { if(deltaI==0) 61 {// nothing to do 62 } 63 else 64 { if(deltaI>0) 65 pwm=pwm-delta; 66 else 67 pwm=pwm+delta; 68 } 69 } 70 else 71 { if((voltageValue*deltaI)+(currentValue*deltaV)==0) 72 {// nothing to do 73 } 74 75 else 76 { if((deltaI/deltaV)+(currentValue/voltageValue)>0) 77 78 pwm=pwm-delta; 79 80 else 81 pwm=pwm+delta; 82 83 } 84 } 85 86Voltage_anc= voltageValue; 87Current_anc= currentValue; 88Power_anc=Power_now; 89if(pwm > 240) 90 pwm=240; 91if (pwm < 15) 92 pwm=15; 93 analogWrite(6, pwm); 94} 95 96
PandO_Code.ino
c_cpp
Below the code of perturb and observe algorithm, to compile it, please go to "Sketch" menu and click on "Export compiled Binary". Then the ".hex" will be generated in the Sketch Folder.
1/***************************************************************************** 2 Copyright Motahhir All Rights Reserved 3*****************************************************************************/ 4 5/***************************************************************************** 6 Header Files included 7 *****************************************************************************/ 8 9/****************************************************************************** 10 PROJECT : MPPT (P&O) implementation 11 Function : P&O Arduino Code 12 ****************************************************************************** 13 * * 14 Written by : Saad Motahhir Date : 09/10/2016 15 * * 16 Email : saad.motahhir@usmba.ac.ma 17 ****************************************************************************** 18 MODIFICATION LOG: 19 ****************************************************************************** 20 Modified by : Date : 21 Comments : 22 ******************************************************************************/ 23#include <LiquidCrystal.h> 24LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 25 26float sensorValue1 = 0; 27float sensorValue2 = 0; 28float voltageValue = 0; 29float currentValue = 0; 30float Power_now = 0, Power_anc = 0, voltage_anc = 0; 31float delta = 3; 32float pwm = 128; 33void setup() 34{ 35 pinMode(6, OUTPUT); 36 lcd.begin(16, 2); 37} 38 39void loop() 40{ 41 sensorValue1 = analogRead(A0); 42 sensorValue2 = analogRead(A1); 43 voltageValue = (sensorValue1 * 5.0 / 1023.0) * 5; 44 currentValue = (sensorValue2 * 5.0 / 1023.0); 45 lcd.setCursor(0, 0); 46 Power_now = voltageValue * currentValue; 47 48 lcd.print("Ppv="); 49 lcd.print(Power_now); 50 lcd.print("W"); 51 lcd.print(pwm); 52 lcd.setCursor(0, 1); 53 lcd.print("V="); 54 lcd.print(voltageValue); 55 lcd.print("V I="); 56 lcd.print(currentValue); 57 lcd.print("A"); 58 59 60 61 if (Power_now > Power_anc) 62 { if (voltageValue > voltage_anc) 63 pwm = pwm - delta; 64 else 65 pwm = pwm + delta; 66 } 67 else 68 { 69 if (voltageValue > voltage_anc) 70 pwm = pwm + delta; 71 else 72 pwm = pwm - delta; 73 } 74 Power_anc = Power_now; 75 voltage_anc = voltageValue; 76 if (pwm < 20) 77 pwm = 20; 78 if (pwm > 150) 79 pwm = 150; 80 81 analogWrite(6, pwm); 82} 83 84 85
Downloadable files
Costless and effective Embedded system based control for PV system
As shown in the incremntal conductance (INC) structure (figure below), it contains several division computations which require a stronger microcontroller including large memory, high clock frequency, and floating-point computation, and this reduces the opportunity to use a low-cost development board as Arduino UNO which is based on ATMEGA328P because it does not contain a hardware divider, but it provides a one-chip 2 cycle multiplier as shown in the figure below (datasheet of ATMEGA328P). Therefore, to design a costless and effective MPPT embedded software, a modified INC algorithm is presented through the elimination of all division computations occurring in the conventional NC method. As a result, the complication of the algorithm operation can be reduced and consequently, minimize the real-time processing with faster response. This, makes the utilization of low-cost microcontrollers possible.
Costless and effective Embedded system based control for PV system

Modified Incremental conductance algorithm
Modified Incremental conductance algorithm

The experimental setup of the PV system using Arduino
The experimental setup of the PV system using Arduino
Proteus PV panel model simulation
• Please, open \Proteus\Proteus_PV_Panel_Model. • Please, go to graph menu and click on simulate graph as follows:
Proteus PV panel model simulation

Experimental results
Figure below (a) and (b) presents the experimental results of both methods under fast varying of insolation (from 1000 W/m2 to 500 W/m2). A zoom in the results is made. As shown in (a), the conventional method generates more oscillations around the peak of power compared to the modified method as presented in (b). On the other hand, the modified method presents a faster tracking speed with response time equals to 0.1 s which is very lower than the response time obtained by the conventional method (0.36 s).
Experimental results

Add Arduino into Proteus:
• Unzip Arduino Library for Proteus.rar file, you will find two files in it. • These two files are named as ArduinoTEP.LIB and ArduinoTEP.IDX. • Copy these two files and place them in the libraries folder of your Proteus software. • Now, restart your Proteus software and in components section search for ArduinoTEP as shown in below figure:
Add Arduino into Proteus:

Experimental results
Figure below (a) and (b) presents the experimental results of both methods under fast varying of insolation (from 1000 W/m2 to 500 W/m2). A zoom in the results is made. As shown in (a), the conventional method generates more oscillations around the peak of power compared to the modified method as presented in (b). On the other hand, the modified method presents a faster tracking speed with response time equals to 0.1 s which is very lower than the response time obtained by the conventional method (0.36 s).
Experimental results

MPPT-in-Proteus
Download data from gethub
https://github.com/motahhir/MPPT-in-Proteus
Simulate the MPPT controller in Proteus under variable irradiance
• Please, open Proteus\Proteus_MPPT_Irradiance Variation • Load the .hex file in the Arduino Uno. • Click on play to simulate the PV system or go to graph menu and click on simulate graph to generate Ppv(t) curve.
Simulate the MPPT controller in Proteus under variable irradiance
Simulate the MPPT controller in Proteus under stable irradiance
• Please, open Proteus\Proteus_MPPT_stable irradiance • Load the .hex file in the Arduino Uno. • Click on play to simulate the PV system or go to graph menu and click on simulate graph to generate Ppv(t) curve.
Simulate the MPPT controller in Proteus under stable irradiance
Conventional Incremental conductance algorithm
Conventional Incremental conductance algorithm

Proteus PV panel model simulation
• Please, open \Proteus\Proteus_PV_Panel_Model. • Please, go to graph menu and click on simulate graph as follows:
Proteus PV panel model simulation

Add Arduino into Proteus:
• Unzip Arduino Library for Proteus.rar file, you will find two files in it. • These two files are named as ArduinoTEP.LIB and ArduinoTEP.IDX. • Copy these two files and place them in the libraries folder of your Proteus software. • Now, restart your Proteus software and in components section search for ArduinoTEP as shown in below figure:
Add Arduino into Proteus:

Simulate the MPPT controller in Proteus under variable irradiance
• Please, open Proteus\Proteus_MPPT_Irradiance Variation • Load the .hex file in the Arduino Uno. • Click on play to simulate the PV system or go to graph menu and click on simulate graph to generate Ppv(t) curve.
Simulate the MPPT controller in Proteus under variable irradiance
MPPT-in-Proteus
Download data from gethub
https://github.com/motahhir/MPPT-in-Proteus
Conventional Incremental conductance algorithm
Conventional Incremental conductance algorithm

Modified Incremental conductance algorithm
Modified Incremental conductance algorithm

Simulate the MPPT controller in Proteus under stable irradiance
• Please, open Proteus\Proteus_MPPT_stable irradiance • Load the .hex file in the Arduino Uno. • Click on play to simulate the PV system or go to graph menu and click on simulate graph to generate Ppv(t) curve.
Simulate the MPPT controller in Proteus under stable irradiance
The experimental setup of the PV system using Arduino
The experimental setup of the PV system using Arduino
Comments
Only logged in users can leave comments