Once I found a really simple MPPT
circuit on Chris' website: http://www.freewebs.com/acselectronics/buildppt.html I decided to
build something inspired by his work. I always wanted to build a
switching regulator based on a general purpose simple (and cheap!)
microcontroller instead of specialized switching controller. I choose
PIC16F1503 because it has got build in two comparators, PWM (maybe
not very sophisticated but fully functional) and CWG - new peripheral
from Microchip which can be used to generate dead-band time between
two outputs.
My first goal was to build something as
“prove of concept” so it is not a real MPPT controller because it
doesn't measure a PV cell current, but it adjusts load of the PV cell
to make sure it works with given output voltage. Here is circuit
diagram:
It's actually simple step-down
converter with P-channel MOSFET (I decided to use P-channel because
it allows use of common ground to measure input and output voltage).
Load of this circuit will be a lead-acid battery so I added D3 to
make sure that circuit will not discharge battery. D3 introduces lose
of efficiency so right now I'm thinking about other fancy circuit
which will do that better (with lower voltage loss across itself).
Here is an idea how microcontroller is configured to control switching regulator with its peripherals:
This is straight-forward implementation
of switching regulator but implemented in a microcontroller, after
initialization of FVR (Fixed Voltage Reference), PWM, comparator and
CWG (complementary waveform generator) it works and software can do
something else. And it will do: I plan to implement perturb and
observe algorithm to search for maximum power condition of PV cell. I
plan to introduce some changes to Circuit: I have to add PV cell
current measurement. I also have to add another PWM with RC filter as
a source of voltage of comparator. PIC16F1503 allows me to use a DAC
output as a input signal for comparator but DAC is 5-bit only, it is
to small resolution for effective MPPT tracking.
Another improvement will be second
MOSFET instead of D4 to increase efficiency. Due to a simplicity of
MOSFET driver circuit off-time is longer than I want so I will search
for some improvement, maybe totem-pole circuit?
Here is a waveform on pin 6 of
microcontroller (channel 2) and gate of MOSFET (channel 1), it is clearly visible
that there is much to improve, especially switch-off time.
Here is picture of a circuit itself
during early tests:
It's built on one-side substrate to
minimize costs, why should I order PCB in a fab if I know that
circuit will anyway need changes?
Here is PCB design, as usually I have
to show off how nice PCBs I draw. I used SMD components wherever it
was convenient. I even managed to design whole PCB on one layer
without a single wire-bridge.
I will update this post or I will write
the new one when I will build next version of this circuit with
mentioned improvements.
The software "as it is"
#include <pic.h>
__CONFIG(FOSC_INTOSC & WDTE_OFF & PWRTE_ON & MCLRE_ON & CP_OFF);
void main(void)
{
OSCCONbits.IRCF=13; //4MHz
ANSELA &= ~(1<<2);
TRISA &= ~(1<<2); //konfigurj LEDa
PORTA &= ~(1<<2); //zgas LEDa
PWM1CON=0;
PR2=9; //40 us
PWM1DCH=7;
PWM1DCL=1<<7;
TMR2IF=0;
T2CONbits.T2CKPS=1; //prescaler /4
T2CONbits.TMR2ON=1;
PWM1CONbits.PWM1OE=1;
PWM1CONbits.PWM1EN=1;
TRISC &= ~(1<<5);
FVRCONbits.CDAFVR=1; //4.096V
FVRCONbits.FVREN=1; //enable
ANSELA |= (1<<7); //comparator
TRISC |= (1<<3);
CM1CON1bits.C1PCH=2; //positive input to FVR (1.024V)
CM1CON1bits.C1NCH=3; //ngative input to C2IN3-
CM1CON0bits.C1ON=1; //on
TRISC &= ~(1<<4); //konfiguruj wyjscie do sterowania mosfetem
PORTC &= ~(1<<4);
CWG1CON0bits.G1EN=1; //wlacz
CWG1CON0bits.G1OEB=1; //w?acz wyjscie
CWG1CON0bits.G1POLB=1; //inwersja na wyjsciu
CWG1CON1bits.G1ASDLB=2; //zero w auto shot down
CWG1CON1bits.G1IS=2; //na wejsciu jest PWM
CWG1CON2bits.G1ARSEN=1; //auto restart enabled
CWG1CON2bits.G1ASDSC1=1; // comparator 1
while(1)
{
if(CMOUTbits.MC1OUT)
PORTA |= (1<<2); //wlacz leda
else
PORTA &= ~(1<<2); //zgas LEDa
}
}
This comment has been removed by the author.
ReplyDeleteif u post here this source code . they help me lot !
ReplyDeleteI've added the software. Hope it will help.
Deletevery good
ReplyDeleteSir can youplease send the hex code.
ReplyDeleteSir can youplease send the hex code
DeleteWould you like to make another circuit with all safety features
ReplyDeleteMPPT Solar Charge Controller I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks!
ReplyDeletewhich compiler is used?
ReplyDelete