TOP Contributors

  1. MIKROE (2653 codes)
  2. Alcides Ramos (351 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136650 times)
  2. FAT32 Library (69864 times)
  3. Network Ethernet Library (55901 times)
  4. USB Device Library (46244 times)
  5. Network WiFi Library (41871 times)
  6. FT800 Library (41107 times)
  7. GSM click (28960 times)
  8. PID Library (26403 times)
  9. mikroSDK (26325 times)
  10. microSD click (25341 times)
Libstock prefers package manager

Package Manager

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]

< Back
Project

DC-DC PID Controlled Buck-Boost Power Supply with USB HID Interface (mikroBasic, mikroC, MPLAB C18)

Rating:

11

Author: Ghanshyam Patel

Last Updated: 2016-02-18

Package Version: 3.0.0.0

Category: Power supply

Downloaded: 6890 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.

No Abuse Reported

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)".

  • Information
  • Comments (3)

Project Blog

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.

Hardware Limit

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.

Computer Software and Firmware

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.

Schematic & PCB

The project is open source and the schematic and PCB files are developed on Labcenter Proteus – ISIS (schematic) and ARES (PCB).

Ongoing Development

Rev. A3: Tested

·         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

Rev. A4: Untested

·         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.

Digital Buck Converter:

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:

http://www.libstock.com/projects/view/55/microchip-hid-bootloader-template-and-adc-over-usb-for-pic18f-and-pic24f-pic18f14k50-pic18f27j53-pic18f2553-pic18f4553-pic24fj64gb002-tested

 

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.


ALSO FROM THIS AUTHOR

NEC IR Protocol Encoder/Decoder with PIC16F150X Timer1 Gate signal capture (MPLAB XC8, mikroC, mikroBasic)

0

A project to encode (remote) and decode (receiver) InfraRed signals using the NEC protocol. It uses the Timer1 Gate function to continually capture the signal to reduce software load and gives it a fast response. The idea is to reverse polarity on the Timer1 Gate capture as soon as it interrupts so it can capture both the high & low signals.

[Learn More]

USB Logic Tool - PIC18F14K50 in mikroBasic, mikroC, MPLAB C18

5

The device is meant to be a prototyping aid and designed to work well by minimizing breadboard space used, interaction through a visual interface, easy setup and low cost. The low cost allows it to be built at home or a PCB can be purchased for a low price.

[Learn More]

Microchip HID Bootloader Template and ADC Over USB for PIC18F and PIC24F (PIC18F14K50, PIC18F27J53, PIC18F2553, PIC18F4553, PIC24FJ64GB002 Tested)

15

A template for mikroBasic, mikroC and MPLAB C18/C30 that is compatible with Microchip's HID Bootloader for PIC18F and PIC24F microcontrollers and PIC18F14K50, PIC18F27J53, PIC18F2553, PIC18F4553 and PIC24FJ64GB002 have been tested. ADC Over USB Example (firmware and Visual Basic 2010 project) and a custom HID bootloader project are also included.

[Learn More]