We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: Ghanshyam Patel
Last Updated: 2016-02-18
Package Version: 3.0.0.0
Category: Power supply
Downloaded: 6960 times
Followed by: 2 users
License: MIT license
This is a switching mode power supply to step up/down a DC voltage with PID control using a PIC18F14K50. The HID interface provides a way to set various parameters without needing additional hardware. The power supply can function without being connected to a PC since it saves all settings and restores them at start-up.
Do you want to subscribe in order to receive notifications regarding "DC-DC PID Controlled Buck-Boost Power Supply with USB HID Interface (mikroBasic, mikroC, MPLAB C18)" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "DC-DC PID Controlled Buck-Boost Power Supply with USB HID Interface (mikroBasic, mikroC, MPLAB C18)" changes.
Do you want to report abuse regarding "DC-DC PID Controlled Buck-Boost Power Supply with USB HID Interface (mikroBasic, mikroC, MPLAB C18)".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
1349059955_dc_dc_pid_contro_mikroc_pic.rar [1.71MB] | mikroC PRO for PIC |
|
1349060291_dc_dc_pid_contro_mikrobasic_pic.rar [1.71MB] | mikroBasic PRO for PIC |
|
Digital Buck-Boost Converter:
This is a more specific application of the “Digital Buck
Converter†but also includes a boost converter option. A useful feature missing
in the “Digital Buck Converter†is input and output current sensing which has
been added to this project. The main goal is to provide low power output, be
portable (at-least semi portable) and be low cost. It is meant to be powered
through USB on a computer or an AC USB wall adapter. To keep the cost down the
voltage and current are controlled through a computer interface which will be
stored in the internal EEPROM so it can be powered without a computer. Input
current control exists so it does not exceed the USB power limit of 2.5W (5V;
500mA) to prevent damage.
The latest revision is designed to output a maximum of 15V,
1A, 2W (about 80% efficient). 96kHz is recommend but up to 240kHz will also
provide a decent PWM resolution without pushing FET drivers and MOSFETs too far.
A PID control loop is implemented to enhance power supply performance.
The computer software was created in Visual Basic 2010 just
like the “Digital Buck Converterâ€. Its main use is to set the state of the
power supply. The firmware is currently only for MPLAB C18 but mikroBasic and
mikroC support is planned.
The firmware operates in Constant Voltage/Current Limit mode
and the computer software switches is to Constant Current/Voltage Limit by
changing the output voltage set point to the maximum setting and use current
limit mode to adjust the actual voltage set point to match the current
required.
The project is open source and the schematic and PCB files
are developed on Labcenter Proteus – ISIS (schematic) and ARES (PCB).
·
PID control gains of buck and boost converter
retuned for this revision while using the FET driver and 96kHz frequency
·
Output current amplifier does not match expected
results; however, it is repeatable an can be individually calibrated for each
board with two different graphs – one for Buck mode and another for Boost mode
·
A dedicated current sense amplifier is used
instead of the op-amp to allow boost mode current sensing since the common mode
voltage is higher than VDD.
Inductor
and Capacitor Selection for Low-Current (250mA Out) & Low-Voltage (5V In)
Power Supply:
Shown in the document.
Inductor
and Capacitor Selection for High-Current (3A Out) & High-Voltage (12V In)
Power Supply:
Shown in the document.
Programming:
PIC18F14K50 can be programmed (with standard programming tool such as PICkit 2) with the HID bootloader (“PIC18F14K50 Custom Bootloader.hexâ€) firmware to use USB connection to re-program the main firmware. The bootloader is optional and more information can be found here:
Digital Buck Converter Program Modification:
Each unique device (same Bill Of Materials) may need to change the following (each can be change through USB interface):
· VInADCFactor: Affected by the feedback resistors, use accurate feedback resistors (low tolerance values) will negate the effect
· VOffset: Seems to be a result of voltage drops in the circuit and the microcontroller itself (maybe due to rounding errors).
Each unique circuit (different Bill Of Materials) may need to change the following (each can be change through USB interface):
· VInADCFactor: Affected by the feedback resistors, use accurate feedback resistors (low tolerance values) will negate the effect
· VOffset: Seems to be a result of voltage drops in the circuit and the microcontroller itself (maybe due to rounding errors).
· Proportional Gain: Changes response time of the power supply. Effective Gain = 1/PGain.
· Integral Gain: Changes the amount of error and response time. Effective Gain = 1/IGain.
· Derivative Gain: Changes the amount overshoot and effect of noise. Effective Gain = 1/DGain.
Calibration:
The “Calibration†excel spreadsheet can be used to calibrate the output by determining VInADCFactor and VOffset. VOffset should be set to zero and VInADCFactor should be set to the nominal multiplication factor multiplied by a 100 (ie. 200 for half-voltage divider input) in the settings (firmware hardcoded or through USB). The “Increment Mode†function can be selected in the PC Interface to automatically set all test points listed in the excel file. Enter the actual values at each set point and a VInADCFactor and VOffset will be produced.
Proportional, Integral, Derivative (PID) Performance Testing:
To test out how well the power supply does, apply various loads and the “PID Test Mode†can be used to alternate (between 25% and 75% of VSetMax) the set-point (step input) every 500ms to. PGain, IGain and DGain are divisors so the effective gains are actually inverted meaning that increasing any of the gains will reduce its effect. PGain is required and IGain & DGain are optional so they can be set to zero without a divide by zero error. The examples use a PD controller to increase responsiveness (PGain) and reduce overshoot (DGain). Adding an IGain did not help and actually made the response worse. The firmware uses the PID gains to affect the rate of change of the PWM Duty Cycle.
Controlling the Power Supply:
The HID interface for Windows allows setting the Output Voltage, the minimum & maximum voltage set points (important if external switches are used), the voltage increments of the output voltage if hardware switches are used, the Voltage Offset & Feedback Voltage Factor for calibration. It will also provide the instantaneous PWM Duty Cycle and the input voltage. It also shows the set voltage of the internal reference.
Operating mode can be switched as well between:
· Normal
· Automatic Voltage Incrementing (0.25V every 4 seconds) which is useful for making calibration measurements semi-automatic
· PID Test Mode to alternate the set point between 25% and 75% of maximum set point voltage every 500ms. A normal trigger mode setting in an oscilloscope will show the rise and fall voltage curves of the power supply.