Showing posts with label mppt. Show all posts
Showing posts with label mppt. Show all posts
Monday, October 24, 2016
MPPT Circuit using PIC16F88 with 3 Level Charging
MPPT Circuit using PIC16F88 with 3 Level Charging
An MPPT as we all know refers to maximum power point tracking which is typically associated with solar panels for optimizing their outputs with maximum efficiency. In this post we learn how to make a PIC16F88 microcontroller based MPPT circuit with a 3-stage charging.
This data was donated by: Mr. hisham bahaa-aldeen (hisham2630@gmail.com)
The optimized output from MPPT circuits is primarily used for charging batteries with maximum efficiency from the available sunshine.
New hobbyists normally find the concept to difficult and get confused with the many parameters associated with MPPT, such as the maximum power point, "knee" of the I/V graph etc.
Actually theres nothing so complex about this concept, because a solar panel is nothing but just a form of power supply.
Optimizing this power supply becomes necessary because typically solar panels lack current, but posses excess voltage, this abnormal specs of a solar panel tends to get incompatible with standard loads such as 6V, 12V batteries which carry higher AH rating and lower voltage rating compared to the panel specs, and furthermore the ever-varying sunshine makes the device extremely inconsistent with its V and I parameters.
And thats why we require an intermediate device such as an MPPT which can "understand" these variations and churn out the most desirable output from a connected solar panel.
You might have already studied this simple IC 555 based MPPT circuit which is exclusively researched and designed by me and provides an excellent example of a working MPPT circuit.
The basic idea behind all MPPTs is to drop or trim down the excess voltage from the panel according to the load specs making sure that the deducted amount of voltage is converted into an equivalent amount of current, thus balancing the I x V magnitude across the input and the output always up to the mark...we cannot expect anything more than this from this useful gadget, do we?
In this post we study an MPPT circuit which is quite similar to the IC 555 design, the only difference being the use of a microcontroller PIC16F88 and an enhanced 3-level charging circuit.

The basic function of the various stages can be understood with the help of the following description:
1) The panel output is tracked by extracting a couple of information from it through the associated potential divider networks.
2) One opamp from IC2 is configured as a voltage follower and it tracks the instantaneous voltage output from the panel through a potential divider at its pin3, and feeds the info to the relevant sensing pin of the PIC.
3) The second opamp from IC2 becomes responsible for tracking and monitoring the varying current from the panel and feeds the same to another sensing input of the PIC.
4) These two inputs are processed internally by the MCU for developing a correspondingly tailored PWM for the buck converter stage associated with its pin#9.
5) The PWM out from the PIC is buffered by Q2, Q3 for triggering the switching P-mosfet safely. The associated diode protects the mosfet gate from overvolatges.
6) The mosfet switches in accordance with the switching PWMs and modulates the buck converter stage formed by the inductor L1 and D2.
7) The above procedures produce the most appropriate output from the buck converter which is lower in voltage as per the battery, but rich in current.
8) The output from the buck is constantly tweaked and appropriately adjusted by the IC with reference to the sent info from the two opamps associated with the solar panel.
9) In addition to the above MPPT regulation, the PIC is also programmed to monitor the battery charging through 3 discrete levels, which are normally specified as the bulk mode, absorption mode, an the float mode.
10) The MCU "keeps an eye" on the rising battery voltage and adjusts the buck current accordingly maintaining the correct Ampere levels during the 3 levels of charging procedure. This is done in conjunction with the MPPT control, thats like handling two situations at a time for delivering the most favorable results for the battery.
11) The PIC itself is supplied with a precision regulated voltage at its Vdd pinout through the IC TL499, any other suitable voltage regulator could be replaced here for rendering the same.
12) A thermistor can be also seen in the design this may be optional but can be effectively configured for monitoring the battery temperature and feeding the info to the PIC, which effortlessly processes this third information for tailoring the buck output making sure that the battery temperature never rises above unsafe levels.
13) The LED indicators associated with the PIC indicate the various charging states for the battery which allows the user to get an up-to-date information regarding the charging condition of the battery throughout the day.
14) The proposed MPPT Circuit using PIC16F88 with 3-Level Charging supports 12V battery charging as well as 24V battery charging without any change in the circuit, except the values shown in parenthesis and VR3 setting which needs to be adjusted to allow the output to be 14.4V at the onset for a 12V battery and 29V for a 24V battery.
The next article gives the access to the entire source code for the above discussed MPPT circuit using PIC16F88
This data was donated by: Mr. hisham bahaa-aldeen (hisham2630@gmail.com)
The optimized output from MPPT circuits is primarily used for charging batteries with maximum efficiency from the available sunshine.
New hobbyists normally find the concept to difficult and get confused with the many parameters associated with MPPT, such as the maximum power point, "knee" of the I/V graph etc.
Actually theres nothing so complex about this concept, because a solar panel is nothing but just a form of power supply.
Optimizing this power supply becomes necessary because typically solar panels lack current, but posses excess voltage, this abnormal specs of a solar panel tends to get incompatible with standard loads such as 6V, 12V batteries which carry higher AH rating and lower voltage rating compared to the panel specs, and furthermore the ever-varying sunshine makes the device extremely inconsistent with its V and I parameters.
And thats why we require an intermediate device such as an MPPT which can "understand" these variations and churn out the most desirable output from a connected solar panel.
You might have already studied this simple IC 555 based MPPT circuit which is exclusively researched and designed by me and provides an excellent example of a working MPPT circuit.
The basic idea behind all MPPTs is to drop or trim down the excess voltage from the panel according to the load specs making sure that the deducted amount of voltage is converted into an equivalent amount of current, thus balancing the I x V magnitude across the input and the output always up to the mark...we cannot expect anything more than this from this useful gadget, do we?
The above automatic tracking and appropriately converting the parameters efficiently is implemented using a PWM tracker stage and a buck converter stage, or sometimes a buck-boost converter stage, although a solitary buck converter gives better results and is simpler to implement.
In this post we study an MPPT circuit which is quite similar to the IC 555 design, the only difference being the use of a microcontroller PIC16F88 and an enhanced 3-level charging circuit.

The basic function of the various stages can be understood with the help of the following description:
1) The panel output is tracked by extracting a couple of information from it through the associated potential divider networks.
2) One opamp from IC2 is configured as a voltage follower and it tracks the instantaneous voltage output from the panel through a potential divider at its pin3, and feeds the info to the relevant sensing pin of the PIC.
3) The second opamp from IC2 becomes responsible for tracking and monitoring the varying current from the panel and feeds the same to another sensing input of the PIC.
4) These two inputs are processed internally by the MCU for developing a correspondingly tailored PWM for the buck converter stage associated with its pin#9.
5) The PWM out from the PIC is buffered by Q2, Q3 for triggering the switching P-mosfet safely. The associated diode protects the mosfet gate from overvolatges.
6) The mosfet switches in accordance with the switching PWMs and modulates the buck converter stage formed by the inductor L1 and D2.
7) The above procedures produce the most appropriate output from the buck converter which is lower in voltage as per the battery, but rich in current.
8) The output from the buck is constantly tweaked and appropriately adjusted by the IC with reference to the sent info from the two opamps associated with the solar panel.
9) In addition to the above MPPT regulation, the PIC is also programmed to monitor the battery charging through 3 discrete levels, which are normally specified as the bulk mode, absorption mode, an the float mode.
10) The MCU "keeps an eye" on the rising battery voltage and adjusts the buck current accordingly maintaining the correct Ampere levels during the 3 levels of charging procedure. This is done in conjunction with the MPPT control, thats like handling two situations at a time for delivering the most favorable results for the battery.
11) The PIC itself is supplied with a precision regulated voltage at its Vdd pinout through the IC TL499, any other suitable voltage regulator could be replaced here for rendering the same.
12) A thermistor can be also seen in the design this may be optional but can be effectively configured for monitoring the battery temperature and feeding the info to the PIC, which effortlessly processes this third information for tailoring the buck output making sure that the battery temperature never rises above unsafe levels.
13) The LED indicators associated with the PIC indicate the various charging states for the battery which allows the user to get an up-to-date information regarding the charging condition of the battery throughout the day.
14) The proposed MPPT Circuit using PIC16F88 with 3-Level Charging supports 12V battery charging as well as 24V battery charging without any change in the circuit, except the values shown in parenthesis and VR3 setting which needs to be adjusted to allow the output to be 14.4V at the onset for a 12V battery and 29V for a 24V battery.
The next article gives the access to the entire source code for the above discussed MPPT circuit using PIC16F88
Available link for download
Saturday, October 1, 2016
Synchronous Switch Mode MPPT Battery Charge Controller Circuit
Synchronous Switch Mode MPPT Battery Charge Controller Circuit
The device bq24650 includes an advanced built-in MPPT Synchronous Switch-Mode Battery Charge Controller. It offers a high level of input voltage regulation, which prevents the charging current to the battery each time input voltage drops below a specified amount. Learn More:
Whenever the input is attached with a a solar panel, the supply stabilization loop pulls down the charging amp to ensure that the solar panel is enabled to produce maximum power output.
The bq24650 promises to provide a constant-frequency synchronous PWIVI controller with optimal level of accuracy with current and voltage stabilization, charge preconditioning, charge cut-off, and charging level checking.
The chip charges the battery in 3 discrete levels: pre-conditioning, constant current, and constant voltage.
Charging is is cut-off as soon as the amp level nears the 1/10 of the rapid charging rate. The pre-charge timer is set to be at 30 minutes.
The bq2465O without a manual intervention restarts the charging procedure in case the battery voltage reverts below an internally set limit or reaches a minimum quiescent amp sleep mode while the input voltage goes below the battery voltage.
The device is designed to charge a battery from 2.1V to 26V with VFB internally fixed to a 2.1V feedback point. The charging amp spec is preset internally by fixing a well matched sensing resistor.
The bq24650 can be procured with a 16 pin, 3.5 x 3.5 mm^2 thin QFN option.
Courtesy: MPPT Synchronous Switch-Mode Battery Charge Controller Circuit
The bq24G50 employs an extremely accurate voltage regulator for the deciding on the charging voltage. The charging voltage is preset by means of a a resistor divider from the battery to ground, with the midpoint hooked up the VFB pin.
The voltage at the VFB pin is clamped to 2.1V, in order to produce the following formula for the level of regulation voltage:
V(batt) = 2.1V x [1 + R2/R1]
where R2 is linked from VFB to the battery and R1 is connected from VFB to GND. Li-Ion, LiFePO4, as well as SMF lead acid batteries are ideally supported battery chemistries.
A majority of over the shelf Li-ion cells can now be effectively charged up to 4.2V/cell. A LiFePO4 battery supports the process of a substantially higher charge and discharge cycles, but the down side is that the the energy density is not too good. The recognized cell voltage is 3.6V.
The charge profile of the two cells Li-Ion and LiFePO4 is preconditioning, constant current, and constant voltage. For an effective charge/discharge life, the end-of-charge voltage limit may possibly be cut down to 4.1V/cell however its energy density could become a lot lower compared to the Li-based chemical specification, lead acid continues to be much preferred battery because of its reduced production expenses as well as rapid discharge cycles.
The common voltage threshold is from 2.3V to 2.45V. After the battery is seen to be completely topped up, a float or trickle charge becomes mandatory in order make up for the self-discharge. The trickle charge threshold is 100mV-200mV below the constant voltage point.
A solar panel may have an exclusive level on the V-I or V-P curve, popularly known as the Maximum Power Point (MPP), wherein the complete photovoltaic (PV) system relies with optimum efficiency and generates the required maximum output power.
The constant voltage algorithm is the most easy Maximum Power Point Tracking (MPPT) option available. The bq2465O automatically shuts down the charging amp such that the maximum power point is is enabled for producing maximum efficiency.
The chip bq2465O incorporates a "SLEEP" comparator to identify the means of supply voltage on the VCC pin, because of the fact that VCC may be terminated both from a battery or an external AC/DC adapter unit.
If the VCC voltage is more significant the SRN voltage, and the additional criteria are fulfilled for the charging procedures, the bq2465O subsequently begins making an attempt to charge a connected battery (please see the Enabling and Disabling Charging section).
lf SRN voltage is higher with respect to the VCC, symbolizing that a battery is the source from where the power is being acquired, the bq2465O is enabled for a lower quiescent current ( <15uA) SLEEP mode to prevent amperage leakage from the battery.
lf VCC is below the UVLO limit, the IC is cut-off, after which VREF LDO is switched off.
The following concerned aspects need to be ensured before the charging process of the proposed MPPT Synchronous Switch-Mode Battery Charge Controller Circuit is initialized:
Charging process is enabled (MPPSET > 175mV)
The unit is not in Under-Voltage-Lock-Out (UVLO) functionality and VCC is above the VCCLOWV limit
The IC is not in SLEEP functionality (i.e. VCC > SRN)
VCC voltage is below the AC over-voltage limit (VCC < VACOV)
30ms time lapse is fulfilled after the first power-up
REGN LDO and VREF LDO voltages are fixed at the specified junctures
Thermal Shut (TSHUT) is not initialized
- TS bad is not identified
Any one of the following technical issues may inhibit the proceeding charging of the battery:
Charging is is deactivated (MPPSET < 75mV)
Adapter input is disconnected, provoking the IC to get into a VCCLOWV or SLEEP functionality
Adapter input voltage is below the 100mV above battery mark
Adapter is rated at higher voltage
REGN or VREF LDO voltage is not as per the specs
TSHUT IC warmth limit is identified
TS voltage happens to move out of the specified range which may indicate that the battery temperature is extremely hot or alternatively much cooler
Self-Triggered In-built SOFT-START CHARGER CURRENT
The charger by irself soft-starts the charger power regulation current each time the charger moves into the fast-charge to establish that there is absolutely no overshoot or stressful conditions on the externally connected capacitors or the power converter.
The soft-start is featured with of stepping-up the chaging stabilization amp into eight uniformly executed operational steps next to the prefixed charging current level. All the assigned steps carry on for around 1.6ms, for a specified Up period of 13ms. Not a single external parts are called for enabling the discussed operational
function.
The synchronous buck PWM converter employs a predetermined frequency voltage mode with feed-forvvard control strategy.
A version III compensation configuration lets the system to incorporate ceramic capacitors at the output stage of the converter. The compensation
input stage is associated internally between the feedback output (FBO) along with an error amplifier input (EAI).
The feedback compensation stage is rigged between the error amplifier input (EAI) and error amplifier output (EAO). The LC output filter stage needs to be determined to enable a resonant frequency of around 12 kHz - 17 kHz for the device, for which the resonant frequency, fo, is formulated as:
fo = 1 / 2 ? ?LoCo
An integrated saw-tooth ramp is allowed to compare the internal EAO error control input to alter the duty-cycle of the converter.
The ramp amplitude is 7% of the input adapter voltage enabling it to be permanently and completely proportional to the input supply of the adapter voltage.
This cancels away any sort of loop gain alterations on account of a variation in the input voltage and simplifies the loop compensation procedures. The ramp is balanced out by 300mV so that a zero percent duty-cycIe is achieved when the EAO signal is below the ramp.
The EAO signal is likewise qualified to outnumber the saw-tooth ramp signal with a purpose to achieve a 100% duty cycIe PWM demand.
Built in gate drive logic makes it possible accomplishing 99.98% duty-cycle at the same time confirming the
N-channel upper device consistently carries as much as necessary voltage to always be 100 % on.
In the event the BTST pin to PH pin voltage reduces below 4.2V for longer than three intervals, in that case the high-side n-channeI power MOSFET is switched off while the low-side n-channe| power MOSFET is triggered to draw the PH node down and charge-up the BTST capacitor.
After that the high-side driver normalizes to 100% duty-cycle procedure until the (BTST-PH) voltage is observed to decline low yet again, on account of outflow current depleting the BTST capacitor below 4.2 V, as well as reset pulse is reissued.
The predetermined frequency oscillator maintains rigid command over the switching frequency under most circumstances of input voltage, battery voltage, charge current, and temperature, simplifying output filter layout and retaining it away from the audible disturbances state.
Whenever the input is attached with a a solar panel, the supply stabilization loop pulls down the charging amp to ensure that the solar panel is enabled to produce maximum power output.
The bq24650 promises to provide a constant-frequency synchronous PWIVI controller with optimal level of accuracy with current and voltage stabilization, charge preconditioning, charge cut-off, and charging level checking.
The chip charges the battery in 3 discrete levels: pre-conditioning, constant current, and constant voltage.
Charging is is cut-off as soon as the amp level nears the 1/10 of the rapid charging rate. The pre-charge timer is set to be at 30 minutes.
The bq2465O without a manual intervention restarts the charging procedure in case the battery voltage reverts below an internally set limit or reaches a minimum quiescent amp sleep mode while the input voltage goes below the battery voltage.
The device is designed to charge a battery from 2.1V to 26V with VFB internally fixed to a 2.1V feedback point. The charging amp spec is preset internally by fixing a well matched sensing resistor.
The bq24650 can be procured with a 16 pin, 3.5 x 3.5 mm^2 thin QFN option.

BATTERY VOLTAGE REGULATION
The bq24G50 employs an extremely accurate voltage regulator for the deciding on the charging voltage. The charging voltage is preset by means of a a resistor divider from the battery to ground, with the midpoint hooked up the VFB pin.
The voltage at the VFB pin is clamped to 2.1V, in order to produce the following formula for the level of regulation voltage:
V(batt) = 2.1V x [1 + R2/R1]
where R2 is linked from VFB to the battery and R1 is connected from VFB to GND. Li-Ion, LiFePO4, as well as SMF lead acid batteries are ideally supported battery chemistries.
A majority of over the shelf Li-ion cells can now be effectively charged up to 4.2V/cell. A LiFePO4 battery supports the process of a substantially higher charge and discharge cycles, but the down side is that the the energy density is not too good. The recognized cell voltage is 3.6V.
The charge profile of the two cells Li-Ion and LiFePO4 is preconditioning, constant current, and constant voltage. For an effective charge/discharge life, the end-of-charge voltage limit may possibly be cut down to 4.1V/cell however its energy density could become a lot lower compared to the Li-based chemical specification, lead acid continues to be much preferred battery because of its reduced production expenses as well as rapid discharge cycles.
The common voltage threshold is from 2.3V to 2.45V. After the battery is seen to be completely topped up, a float or trickle charge becomes mandatory in order make up for the self-discharge. The trickle charge threshold is 100mV-200mV below the constant voltage point.
INPUT VOLTAGE REGULATION
A solar panel may have an exclusive level on the V-I or V-P curve, popularly known as the Maximum Power Point (MPP), wherein the complete photovoltaic (PV) system relies with optimum efficiency and generates the required maximum output power.
The constant voltage algorithm is the most easy Maximum Power Point Tracking (MPPT) option available. The bq2465O automatically shuts down the charging amp such that the maximum power point is is enabled for producing maximum efficiency.
Switch ON Condition
The chip bq2465O incorporates a "SLEEP" comparator to identify the means of supply voltage on the VCC pin, because of the fact that VCC may be terminated both from a battery or an external AC/DC adapter unit.
If the VCC voltage is more significant the SRN voltage, and the additional criteria are fulfilled for the charging procedures, the bq2465O subsequently begins making an attempt to charge a connected battery (please see the Enabling and Disabling Charging section).
lf SRN voltage is higher with respect to the VCC, symbolizing that a battery is the source from where the power is being acquired, the bq2465O is enabled for a lower quiescent current ( <15uA) SLEEP mode to prevent amperage leakage from the battery.
lf VCC is below the UVLO limit, the IC is cut-off, after which VREF LDO is switched off.
ENABLE AND DISABLE CHARGING
The following concerned aspects need to be ensured before the charging process of the proposed MPPT Synchronous Switch-Mode Battery Charge Controller Circuit is initialized:
Charging process is enabled (MPPSET > 175mV)
The unit is not in Under-Voltage-Lock-Out (UVLO) functionality and VCC is above the VCCLOWV limit
The IC is not in SLEEP functionality (i.e. VCC > SRN)
VCC voltage is below the AC over-voltage limit (VCC < VACOV)
30ms time lapse is fulfilled after the first power-up
REGN LDO and VREF LDO voltages are fixed at the specified junctures
Thermal Shut (TSHUT) is not initialized
- TS bad is not identified
Any one of the following technical issues may inhibit the proceeding charging of the battery:
Charging is is deactivated (MPPSET < 75mV)
Adapter input is disconnected, provoking the IC to get into a VCCLOWV or SLEEP functionality
Adapter input voltage is below the 100mV above battery mark
Adapter is rated at higher voltage
REGN or VREF LDO voltage is not as per the specs
TSHUT IC warmth limit is identified
TS voltage happens to move out of the specified range which may indicate that the battery temperature is extremely hot or alternatively much cooler
Self-Triggered In-built SOFT-START CHARGER CURRENT
The charger by irself soft-starts the charger power regulation current each time the charger moves into the fast-charge to establish that there is absolutely no overshoot or stressful conditions on the externally connected capacitors or the power converter.
The soft-start is featured with of stepping-up the chaging stabilization amp into eight uniformly executed operational steps next to the prefixed charging current level. All the assigned steps carry on for around 1.6ms, for a specified Up period of 13ms. Not a single external parts are called for enabling the discussed operational
function.
CONVERTER OPERATION
The synchronous buck PWM converter employs a predetermined frequency voltage mode with feed-forvvard control strategy.
A version III compensation configuration lets the system to incorporate ceramic capacitors at the output stage of the converter. The compensation
input stage is associated internally between the feedback output (FBO) along with an error amplifier input (EAI).
The feedback compensation stage is rigged between the error amplifier input (EAI) and error amplifier output (EAO). The LC output filter stage needs to be determined to enable a resonant frequency of around 12 kHz - 17 kHz for the device, for which the resonant frequency, fo, is formulated as:
fo = 1 / 2 ? ?LoCo
An integrated saw-tooth ramp is allowed to compare the internal EAO error control input to alter the duty-cycle of the converter.
The ramp amplitude is 7% of the input adapter voltage enabling it to be permanently and completely proportional to the input supply of the adapter voltage.
This cancels away any sort of loop gain alterations on account of a variation in the input voltage and simplifies the loop compensation procedures. The ramp is balanced out by 300mV so that a zero percent duty-cycIe is achieved when the EAO signal is below the ramp.
The EAO signal is likewise qualified to outnumber the saw-tooth ramp signal with a purpose to achieve a 100% duty cycIe PWM demand.
Built in gate drive logic makes it possible accomplishing 99.98% duty-cycle at the same time confirming the
N-channel upper device consistently carries as much as necessary voltage to always be 100 % on.
In the event the BTST pin to PH pin voltage reduces below 4.2V for longer than three intervals, in that case the high-side n-channeI power MOSFET is switched off while the low-side n-channe| power MOSFET is triggered to draw the PH node down and charge-up the BTST capacitor.
After that the high-side driver normalizes to 100% duty-cycle procedure until the (BTST-PH) voltage is observed to decline low yet again, on account of outflow current depleting the BTST capacitor below 4.2 V, as well as reset pulse is reissued.
The predetermined frequency oscillator maintains rigid command over the switching frequency under most circumstances of input voltage, battery voltage, charge current, and temperature, simplifying output filter layout and retaining it away from the audible disturbances state.
Available link for download
Labels:
battery,
charge,
circuit,
controller,
mode,
mppt,
switch,
synchronous
Saturday, September 3, 2016
MPPT Circuit using PIC16F88 Code and HEX
MPPT Circuit using PIC16F88 Code and HEX
The earlier article comprehensively described the circuit details of an MPPT using PIC16F88 microcontroller, here we get the access to the source code for programming the PIC and the HEX file format for the same.
This data was donated by: Mr. hisham bahaa-aldeen (hisham2630@gmail.com)
Programming source code for the proposed 12V/24V solar MPPT circuit using PIC16F88
; 100W Solar Charger
; upgraded with a supplementary bulk charge restart feature after a 4hr break when sunlight returns to panel
; Option set when RB0 low
; Supplementary bulk restart anytime power demanded for float charging. Option set when RB1 low
; Added switch to float mode if bulk charging takes less than 60s. ie if the battery is fully charged
list P=16F88
#include p16f88.inc
ERRORLEVEL -302
ERRORLEVEL -306
;Program Configuration Register 1
__CONFIG _CONFIG1, _CP_ALL & _CCP1_RB3 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_ON & _MCLR_ON & _PWRTE_ON & _WDT_OFF & _INTRC_IO
;Program Configuration Register 2
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
; Bank 0 RAM
DIGITAL equ H20 ; storage
FIRST equ H21 ; first run
CUT_M equ H22 ; cutout voltage high byte
CUT_L equ H23 ; cutout voltage low byte
FLOAT_H equ H24 ; float voltage high byte
FLOAT_L equ H25 ; float voltage low byte
COMP equ H26 ; compensation (temperature)
BATT_HI equ H27 ; battery volts high byte
BATT_LO equ H28 ; battery low byte
DELCNT equ H29 ; delay counter
FLASHER equ H2A ; LED flasher timer
TEMPERATURE equ H2B ; temperature reading deg C
THERMISTOR equ H2C ; thermistor flag for LED
CUT_COMP_M equ H2D ; cutout temp. compensated voltage high byte
CUT_COMP_L equ H2E ; cutout temp. compensated voltage low byte
FLOAT_COMP_M equ H2F ; float temp. compensated voltage high byte
FLOAT_COMP_L equ H30 ; float temp. compensated voltage low byte
NEGATIVE equ H31 ; subtract negative flag
VALUE_1 equ H32 ; delay counter
VALUE_2 equ H33 ; delay counter
HOUR0 equ H34 ; hour counter
HOUR1 equ H35 ; 14 seconds counter for hour counter (256 x 14s=1hour)
SENSOR_COUNT equ H36 ; sensor counter for periodic checking
SENSOR_COUNT1 equ H37 ; sensor counter for periodic checking
CELL_LO equ H38 ; solar cell voltage ls byte
CELL_HI equ H39 ; solar cell voltage ms byte
CELL_I_LO equ H3A ; solar cell current ls byte
CELL_I_HI equ H3B ; solar cell current ms byte
CHARGE_STATE equ H3C ; 0 charge, 1 float
CHARGE_FLAG equ H3D ; flag for charge
CHRG_RATE equ H3E ; charge change rate
CELL_V equ H3F ; solar cell voltage 8-bit
CELL_I equ H40 ; solar cell current 8-bit
PERIOD equ H41 ; power calculation rate
CCPR1_STORE equ H42 ; CCPR1L storage value
POWERH equ H43 ; power ms byte
POWERL equ H44 ; power ls byte
VALUE1 equ H45 ; temporary value
VALUE2 equ H46 ; temporary value
VALUE3 equ H47 ; temporary value
VALUE4 equ H48 ; temporary value
EQ_FLAG equ H49 ; equalisation flag
EQ_LO equ H4A ; ls byte EQ battery voltage
EQ_HI equ H4B ; ms byte EQ battery voltage
EQ_LO_COMP equ H4C ; ls byte temp. compensated EQ battery voltage
EQ_HI_COMP equ H4D ; ms byte temp. compensated EQ battery voltage
EQ_LEVEL equ H4E ; equalisation input (RB4) level store
BATT_IND equ H4F ; battery indicator flag when error
BURST_FLG equ H50 ; burst flag
HOUR3 equ H51 ; 4 hour counter
HOUR2 equ H52 ; 56 seconds counter for hour counter (256 x 56s=1hour)
BULK_TIMER equ H53 ; bulk charge timer (60s)
BULK_TIMER_END equ H54 ; bulk timer ended flag
; math routines
TEMP1 equ H5C
TEMPB0 equ H5D
TEMPB1 equ H5E
TEMPB2 equ H5F
TEMP equ H60
REMB3 equ H61
REMB2 equ H62
REMB1 equ H63
REMB0 equ H64
AARGB5 equ H65
AARGB4 equ H66
AARGB3 equ H67
AARGB2 equ H68
AARGB1 equ H69
AARGB0 equ H6A ; most significant byte of argument A
BARGB3 equ H6B
BARGB2 equ H6C
BARGB1 equ H6D
BARGB0 equ H6E ; most significant byte of argument B
LOOPCOUNT equ H6F ; division counter
; All Banks RAM
; Interrupt store registers
W_TMP equ H70 ; storage of w before interrupt
STATUS_TMP equ H71 ; status storage before interrupt
; start at memory 0
org 0
goto SETUP
org 4
goto INTERRUPT
; position the lookup table at start to avoid a 256 bit boundary
TEMP_CONV ; convert A/D values to deg C based on thermistor R=Ae**(B/T) where (T is in K ie deg C plus 273)
; A =0.01058 and B is 4100
addwf PCL,f ; add value to program counter
; 60 deg C max
retlw D60 ; 60deg C for A/D D49 (8-bit)
retlw D59 ; deg C for A/D D50(8-bit)
retlw D58 ; deg C for A/D D51(8-bit)
retlw D58 ; deg C for A/D D52(8-bit)
retlw D57 ; deg C for A/D D53(8-bit)
retlw D57 ; deg C for A/D D54(8-bit)
retlw D56 ; deg C for A/D D55(8-bit)
retlw D56 ; deg C for A/D D56(8-bit)
retlw D55 ; deg C for A/D D57(8-bit)
retlw D54 ; deg C for A/D D58(8-bit)
retlw D54 ; 54 deg C for A/D D59(8-bit)
retlw D53 ; deg C for A/D D60(8-bit)
retlw D53 ; deg C for A/D D61(8-bit)
retlw D52 ; deg C for A/D D62(8-bit)
retlw D52 ; deg C for A/D D63(8-bit)
retlw D51 ; deg C for A/D D64(8-bit)
retlw D50 ; deg C for A/D D65(8-bit)
retlw D50 ; deg C for A/D D66(8-bit)
retlw D50 ; deg C for A/D D67(8-bit)
retlw D49 ; deg C for A/D D68(8-bit)
retlw D49 ; deg C for A/D D69(8-bit)
retlw D48 ; 48 deg C for A/D D70(8-bit)
retlw D48 ; deg C for A/D D71(8-bit)
retlw D47 ; deg C for A/D D72(8-bit)
retlw D47 ; deg C for A/D D73(8-bit)
retlw D46 ; deg C for A/D D74(8-bit)
retlw D46 ; deg C for A/D D75(8-bit)
retlw D45 ; deg C for A/D D76(8-bit)
retlw D45 ; deg C for A/D D77(8-bit)
retlw D44 ; deg C for A/D D78(8-bit)
retlw D44 ; deg C for A/D D79(8-bit)
retlw D43 ; deg C for A/D D80(8-bit)
retlw D43 ; deg C for A/D D81(8-bit)
retlw D43 ; deg C for A/D D82(8-bit)
retlw D42 ; deg C for A/D D83(8-bit)
retlw D42 ; deg C for A/D D84(8-bit)
retlw D41 ; deg C for A/D D85(8-bit)
retlw D41 ; deg C for A/D D86(8-bit)
retlw D40 ; deg C for A/D D87(8-bit)
retlw D40 ; deg C for A/D D88(8-bit)
retlw D40 ; 40 deg C for A/D D89(8-bit)
retlw D39 ; deg C for A/D D90(8-bit)
retlw D39 ; deg C for A/D D91(8-bit)
retlw D38 ; deg C for A/D D92(8-bit)
retlw D38 ; deg C for A/D D93(8-bit)
retlw D38 ; deg C for A/D D94(8-bit)
retlw D37 ; deg C for A/D D95(8-bit)
retlw D37 ; deg C for A/D D96(8-bit)
retlw D36 ; deg C for A/D D97(8-bit)
retlw D36 ; deg C for A/D D98(8-bit)
retlw D36 ; deg C for A/D D99(8-bit)
retlw D35 ; deg C for A/D D100(8-bit)
retlw D35 ; deg C for A/D D101(8-bit)
retlw D34 ; deg C for A/D D102(8-bit)
retlw D34 ; deg C for A/D D103(8-bit)
retlw D34 ; deg C for A/D D104(8-bit)
retlw D33 ; deg C for A/D D105(8-bit)
retlw D33 ; deg C for A/D D106(8-bit)
retlw D33 ; deg C for A/D D107(8-bit)
retlw D32 ; deg C for A/D D108(8-bit)
retlw D32 ; 32 deg C for A/D D109(8-bit)
retlw D32 ; deg C for A/D D110(8-bit)
retlw D31 ; deg C for A/D D111(8-bit)
retlw D31 ; deg C for A/D D112(8-bit)
retlw D30 ; deg C for A/D D113(8-bit)
retlw D30 ; deg C for A/D D114(8-bit)
retlw D30 ; deg C for A/D D115(8-bit)
retlw D29 ; deg C for A/D D116(8-bit)
retlw D29 ; deg C for A/D D117(8-bit)
retlw D29 ; deg C for A/D D118(8-bit)
retlw D28 ; deg C for A/D D119(8-bit)
retlw D28 ; deg C for A/D D120(8-bit)
retlw D28 ; deg C for A/D D121(8-bit)
retlw D27 ; deg C for A/D D122(8-bit)
retlw D27 ; deg C for A/D D123(8-bit)
retlw D27 ; deg C for A/D D124(8-bit)
retlw D26 ; deg C for A/D D125(8-bit)
retlw D26 ; deg C for A/D D126(8-bit)
retlw D26 ; deg C for A/D D127(8-bit)
retlw D25 ; deg C for A/D D128(8-bit)
retlw D25 ; deg C for A/D D129(8-bit)
retlw D24 ; deg C for A/D D130(8-bit)
retlw D24 ; deg C for A/D D131(8-bit)
retlw D24 ; deg C for A/D D132(8-bit)
retlw D24 ; deg C for A/D D133(8-bit)
retlw D23 ; deg C for A/D D134(8-bit)
retlw D23 ; deg C for A/D D135(8-bit)
retlw D23 ; deg C for A/D D136(8-bit)
retlw D22 ; deg C for A/D D137(8-bit)
retlw D22 ; deg C for A/D D138(8-bit)
retlw D22 ; deg C for A/D D139(8-bit)
retlw D21 ; deg C for A/D D140(8-bit)
retlw D21 ; deg C for A/D D141(8-bit)
retlw D21 ; deg C for A/D D142(8-bit)
retlw D20 ; deg C for A/D D143(8-bit)
retlw D20 ; deg C for A/D D144(8-bit)
retlw D20 ; deg C for A/D D145(8-bit)
retlw D19 ; deg C for A/D D146(8-bit)
retlw D19 ; deg C for A/D D147(8-bit)
retlw D19 ; deg C for A/D D148(8-bit)
retlw D18 ; deg C for A/D D149(8-bit)
retlw D18 ; deg C for A/D D150(8-bit)
retlw D18 ; deg C for A/D D151(8-bit)
retlw D17 ; deg C for A/D D152(8-bit)
retlw D17 ; deg C for A/D D153(8-bit)
retlw D17 ; deg C for A/D D154(8-bit)
retlw D16 ; deg C for A/D D155(8-bit)
retlw D16 ; deg C for A/D D156(8-bit)
retlw D16 ; deg C for A/D D157(8-bit)
retlw D15 ; deg C for A/D D158(8-bit)
retlw D15 ; deg C for A/D D159(8-bit)
retlw D15 ; deg C for A/D D160(8-bit)
retlw D14 ; deg C for A/D D161(8-bit)
retlw D14 ; deg C for A/D D162(8-bit)
retlw D14 ; deg C for A/D D163(8-bit)
retlw D13 ; deg C for A/D D164(8-bit)
retlw D13 ; deg C for A/D D165(8-bit)
retlw D13 ; deg C for A/D D166(8-bit)
retlw D12 ; deg C for A/D D167(8-bit)
retlw D12 ; deg C for A/D D168(8-bit)
retlw D12 ; deg C for A/D D169(8-bit)
retlw D11 ; deg C for A/D D170(8-bit)
retlw D11 ; deg C for A/D D171(8-bit)
retlw D11 ; deg C for A/D D172(8-bit)
retlw D10 ; deg C fo
Read more »
This data was donated by: Mr. hisham bahaa-aldeen (hisham2630@gmail.com)
Programming source code for the proposed 12V/24V solar MPPT circuit using PIC16F88
; 100W Solar Charger
; upgraded with a supplementary bulk charge restart feature after a 4hr break when sunlight returns to panel
; Option set when RB0 low
; Supplementary bulk restart anytime power demanded for float charging. Option set when RB1 low
; Added switch to float mode if bulk charging takes less than 60s. ie if the battery is fully charged
list P=16F88
#include p16f88.inc
ERRORLEVEL -302
ERRORLEVEL -306
;Program Configuration Register 1
__CONFIG _CONFIG1, _CP_ALL & _CCP1_RB3 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_ON & _MCLR_ON & _PWRTE_ON & _WDT_OFF & _INTRC_IO
;Program Configuration Register 2
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
; Bank 0 RAM
DIGITAL equ H20 ; storage
FIRST equ H21 ; first run
CUT_M equ H22 ; cutout voltage high byte
CUT_L equ H23 ; cutout voltage low byte
FLOAT_H equ H24 ; float voltage high byte
FLOAT_L equ H25 ; float voltage low byte
COMP equ H26 ; compensation (temperature)
BATT_HI equ H27 ; battery volts high byte
BATT_LO equ H28 ; battery low byte
DELCNT equ H29 ; delay counter
FLASHER equ H2A ; LED flasher timer
TEMPERATURE equ H2B ; temperature reading deg C
THERMISTOR equ H2C ; thermistor flag for LED
CUT_COMP_M equ H2D ; cutout temp. compensated voltage high byte
CUT_COMP_L equ H2E ; cutout temp. compensated voltage low byte
FLOAT_COMP_M equ H2F ; float temp. compensated voltage high byte
FLOAT_COMP_L equ H30 ; float temp. compensated voltage low byte
NEGATIVE equ H31 ; subtract negative flag
VALUE_1 equ H32 ; delay counter
VALUE_2 equ H33 ; delay counter
HOUR0 equ H34 ; hour counter
HOUR1 equ H35 ; 14 seconds counter for hour counter (256 x 14s=1hour)
SENSOR_COUNT equ H36 ; sensor counter for periodic checking
SENSOR_COUNT1 equ H37 ; sensor counter for periodic checking
CELL_LO equ H38 ; solar cell voltage ls byte
CELL_HI equ H39 ; solar cell voltage ms byte
CELL_I_LO equ H3A ; solar cell current ls byte
CELL_I_HI equ H3B ; solar cell current ms byte
CHARGE_STATE equ H3C ; 0 charge, 1 float
CHARGE_FLAG equ H3D ; flag for charge
CHRG_RATE equ H3E ; charge change rate
CELL_V equ H3F ; solar cell voltage 8-bit
CELL_I equ H40 ; solar cell current 8-bit
PERIOD equ H41 ; power calculation rate
CCPR1_STORE equ H42 ; CCPR1L storage value
POWERH equ H43 ; power ms byte
POWERL equ H44 ; power ls byte
VALUE1 equ H45 ; temporary value
VALUE2 equ H46 ; temporary value
VALUE3 equ H47 ; temporary value
VALUE4 equ H48 ; temporary value
EQ_FLAG equ H49 ; equalisation flag
EQ_LO equ H4A ; ls byte EQ battery voltage
EQ_HI equ H4B ; ms byte EQ battery voltage
EQ_LO_COMP equ H4C ; ls byte temp. compensated EQ battery voltage
EQ_HI_COMP equ H4D ; ms byte temp. compensated EQ battery voltage
EQ_LEVEL equ H4E ; equalisation input (RB4) level store
BATT_IND equ H4F ; battery indicator flag when error
BURST_FLG equ H50 ; burst flag
HOUR3 equ H51 ; 4 hour counter
HOUR2 equ H52 ; 56 seconds counter for hour counter (256 x 56s=1hour)
BULK_TIMER equ H53 ; bulk charge timer (60s)
BULK_TIMER_END equ H54 ; bulk timer ended flag
; math routines
TEMP1 equ H5C
TEMPB0 equ H5D
TEMPB1 equ H5E
TEMPB2 equ H5F
TEMP equ H60
REMB3 equ H61
REMB2 equ H62
REMB1 equ H63
REMB0 equ H64
AARGB5 equ H65
AARGB4 equ H66
AARGB3 equ H67
AARGB2 equ H68
AARGB1 equ H69
AARGB0 equ H6A ; most significant byte of argument A
BARGB3 equ H6B
BARGB2 equ H6C
BARGB1 equ H6D
BARGB0 equ H6E ; most significant byte of argument B
LOOPCOUNT equ H6F ; division counter
; All Banks RAM
; Interrupt store registers
W_TMP equ H70 ; storage of w before interrupt
STATUS_TMP equ H71 ; status storage before interrupt
; start at memory 0
org 0
goto SETUP
org 4
goto INTERRUPT
; position the lookup table at start to avoid a 256 bit boundary
TEMP_CONV ; convert A/D values to deg C based on thermistor R=Ae**(B/T) where (T is in K ie deg C plus 273)
; A =0.01058 and B is 4100
addwf PCL,f ; add value to program counter
; 60 deg C max
retlw D60 ; 60deg C for A/D D49 (8-bit)
retlw D59 ; deg C for A/D D50(8-bit)
retlw D58 ; deg C for A/D D51(8-bit)
retlw D58 ; deg C for A/D D52(8-bit)
retlw D57 ; deg C for A/D D53(8-bit)
retlw D57 ; deg C for A/D D54(8-bit)
retlw D56 ; deg C for A/D D55(8-bit)
retlw D56 ; deg C for A/D D56(8-bit)
retlw D55 ; deg C for A/D D57(8-bit)
retlw D54 ; deg C for A/D D58(8-bit)
retlw D54 ; 54 deg C for A/D D59(8-bit)
retlw D53 ; deg C for A/D D60(8-bit)
retlw D53 ; deg C for A/D D61(8-bit)
retlw D52 ; deg C for A/D D62(8-bit)
retlw D52 ; deg C for A/D D63(8-bit)
retlw D51 ; deg C for A/D D64(8-bit)
retlw D50 ; deg C for A/D D65(8-bit)
retlw D50 ; deg C for A/D D66(8-bit)
retlw D50 ; deg C for A/D D67(8-bit)
retlw D49 ; deg C for A/D D68(8-bit)
retlw D49 ; deg C for A/D D69(8-bit)
retlw D48 ; 48 deg C for A/D D70(8-bit)
retlw D48 ; deg C for A/D D71(8-bit)
retlw D47 ; deg C for A/D D72(8-bit)
retlw D47 ; deg C for A/D D73(8-bit)
retlw D46 ; deg C for A/D D74(8-bit)
retlw D46 ; deg C for A/D D75(8-bit)
retlw D45 ; deg C for A/D D76(8-bit)
retlw D45 ; deg C for A/D D77(8-bit)
retlw D44 ; deg C for A/D D78(8-bit)
retlw D44 ; deg C for A/D D79(8-bit)
retlw D43 ; deg C for A/D D80(8-bit)
retlw D43 ; deg C for A/D D81(8-bit)
retlw D43 ; deg C for A/D D82(8-bit)
retlw D42 ; deg C for A/D D83(8-bit)
retlw D42 ; deg C for A/D D84(8-bit)
retlw D41 ; deg C for A/D D85(8-bit)
retlw D41 ; deg C for A/D D86(8-bit)
retlw D40 ; deg C for A/D D87(8-bit)
retlw D40 ; deg C for A/D D88(8-bit)
retlw D40 ; 40 deg C for A/D D89(8-bit)
retlw D39 ; deg C for A/D D90(8-bit)
retlw D39 ; deg C for A/D D91(8-bit)
retlw D38 ; deg C for A/D D92(8-bit)
retlw D38 ; deg C for A/D D93(8-bit)
retlw D38 ; deg C for A/D D94(8-bit)
retlw D37 ; deg C for A/D D95(8-bit)
retlw D37 ; deg C for A/D D96(8-bit)
retlw D36 ; deg C for A/D D97(8-bit)
retlw D36 ; deg C for A/D D98(8-bit)
retlw D36 ; deg C for A/D D99(8-bit)
retlw D35 ; deg C for A/D D100(8-bit)
retlw D35 ; deg C for A/D D101(8-bit)
retlw D34 ; deg C for A/D D102(8-bit)
retlw D34 ; deg C for A/D D103(8-bit)
retlw D34 ; deg C for A/D D104(8-bit)
retlw D33 ; deg C for A/D D105(8-bit)
retlw D33 ; deg C for A/D D106(8-bit)
retlw D33 ; deg C for A/D D107(8-bit)
retlw D32 ; deg C for A/D D108(8-bit)
retlw D32 ; 32 deg C for A/D D109(8-bit)
retlw D32 ; deg C for A/D D110(8-bit)
retlw D31 ; deg C for A/D D111(8-bit)
retlw D31 ; deg C for A/D D112(8-bit)
retlw D30 ; deg C for A/D D113(8-bit)
retlw D30 ; deg C for A/D D114(8-bit)
retlw D30 ; deg C for A/D D115(8-bit)
retlw D29 ; deg C for A/D D116(8-bit)
retlw D29 ; deg C for A/D D117(8-bit)
retlw D29 ; deg C for A/D D118(8-bit)
retlw D28 ; deg C for A/D D119(8-bit)
retlw D28 ; deg C for A/D D120(8-bit)
retlw D28 ; deg C for A/D D121(8-bit)
retlw D27 ; deg C for A/D D122(8-bit)
retlw D27 ; deg C for A/D D123(8-bit)
retlw D27 ; deg C for A/D D124(8-bit)
retlw D26 ; deg C for A/D D125(8-bit)
retlw D26 ; deg C for A/D D126(8-bit)
retlw D26 ; deg C for A/D D127(8-bit)
retlw D25 ; deg C for A/D D128(8-bit)
retlw D25 ; deg C for A/D D129(8-bit)
retlw D24 ; deg C for A/D D130(8-bit)
retlw D24 ; deg C for A/D D131(8-bit)
retlw D24 ; deg C for A/D D132(8-bit)
retlw D24 ; deg C for A/D D133(8-bit)
retlw D23 ; deg C for A/D D134(8-bit)
retlw D23 ; deg C for A/D D135(8-bit)
retlw D23 ; deg C for A/D D136(8-bit)
retlw D22 ; deg C for A/D D137(8-bit)
retlw D22 ; deg C for A/D D138(8-bit)
retlw D22 ; deg C for A/D D139(8-bit)
retlw D21 ; deg C for A/D D140(8-bit)
retlw D21 ; deg C for A/D D141(8-bit)
retlw D21 ; deg C for A/D D142(8-bit)
retlw D20 ; deg C for A/D D143(8-bit)
retlw D20 ; deg C for A/D D144(8-bit)
retlw D20 ; deg C for A/D D145(8-bit)
retlw D19 ; deg C for A/D D146(8-bit)
retlw D19 ; deg C for A/D D147(8-bit)
retlw D19 ; deg C for A/D D148(8-bit)
retlw D18 ; deg C for A/D D149(8-bit)
retlw D18 ; deg C for A/D D150(8-bit)
retlw D18 ; deg C for A/D D151(8-bit)
retlw D17 ; deg C for A/D D152(8-bit)
retlw D17 ; deg C for A/D D153(8-bit)
retlw D17 ; deg C for A/D D154(8-bit)
retlw D16 ; deg C for A/D D155(8-bit)
retlw D16 ; deg C for A/D D156(8-bit)
retlw D16 ; deg C for A/D D157(8-bit)
retlw D15 ; deg C for A/D D158(8-bit)
retlw D15 ; deg C for A/D D159(8-bit)
retlw D15 ; deg C for A/D D160(8-bit)
retlw D14 ; deg C for A/D D161(8-bit)
retlw D14 ; deg C for A/D D162(8-bit)
retlw D14 ; deg C for A/D D163(8-bit)
retlw D13 ; deg C for A/D D164(8-bit)
retlw D13 ; deg C for A/D D165(8-bit)
retlw D13 ; deg C for A/D D166(8-bit)
retlw D12 ; deg C for A/D D167(8-bit)
retlw D12 ; deg C for A/D D168(8-bit)
retlw D12 ; deg C for A/D D169(8-bit)
retlw D11 ; deg C for A/D D170(8-bit)
retlw D11 ; deg C for A/D D171(8-bit)
retlw D11 ; deg C for A/D D172(8-bit)
retlw D10 ; deg C fo
Available link for download
Subscribe to:
Posts (Atom)