dsPIC33 Active Power Factor Correction using dsPIC33FJ12MC202 with Proteus Simulation

Summary of dsPIC33 Active Power Factor Correction using dsPIC33FJ12MC202 with Proteus Simulation


This project implements Active Power Factor Correction (PFC) using a dsPIC33FJ12MC202 microcontroller, following Microchip AN1106. It uses synchronized ADC sampling and high-frequency PWM to run voltage and current PI control loops (inside an ADC interrupt), driving a PFC MOSFET stage in Proteus VSM simulation. The design regulates a DC bus while shaping input current to follow AC voltage, and includes power-on delay, fault handling, and simulation validation suitable for embedded power electronics study and hardware porting.

Parts used in the dsPIC33 Active Power Factor Correction Project:

  • dsPIC33FJ12MC202 microcontroller
  • Bridge rectifier
  • PFC inductor
  • Power MOSFETs
  • DC bus capacitors
  • Voltage sensing network
  • Current sensing network
  • PWM gate driver stage
  • AC voltage source (simulation)

Introduction

This microcontroller project demonstrates an Active Power Factor Correction (PFC) system implemented using a dsPIC33 controller and validated through Proteus simulation.
Based on Microchip Application Note AN1106, the project shows how digital control techniques improve power quality by shaping input current to follow the AC voltage waveform.
It is a practical embedded systems design focused on real-world power electronics applications.
The project combines ADC sampling, PWM-based control, and PI compensators to regulate both voltage and current loops.
Ideal for engineers exploring power control, firmware-driven PFC, and DIY electronics simulations.This dsPIC33 PFC simulation demonstrates active power factor correction using the dsPIC33FJ12MC202 microcontroller. The dsPIC33 PFC simulation is validated in Proteus and focuses on digital control of voltage and current loops. Engineers can study and modify this dsPIC33 PFC simulation before implementing real hardware.

dsPIC33 PFC hardware testing workbench setup
Illustrative View of the Concept.

How the Project Works (Overview)

The system converts AC input to a regulated DC bus while actively correcting the power factor.
The dsPIC33 continuously samples AC voltage, AC current, and DC bus voltage using its ADC module.
A voltage PI controller maintains the desired DC bus level, while a current PI controller ensures the input current follows the AC waveform.
PWM outputs drive the PFC MOSFET stage, shaping the current drawn from the mains.
All control loops execute inside the ADC interrupt for precise timing.

Block Diagram / Workflow Explanation

  1. AC Input & Rectification
    The AC supply is rectified using a bridge rectifier and filtered.

  2. Sensing Stage

    • AC voltage (Vac)

    • AC current (Iac)

    • DC bus voltage (Vdc)

  3. ADC Sampling
    The dsPIC33 ADC samples multiple channels simultaneously, synchronized with PWM.

  4. Control Algorithms

    • Voltage PI loop regulates DC bus

    • Current reference is calculated from Vac

    • Current PI loop controls inductor current

  5. PWM Generation
    PWM2 module drives the PFC switch at high frequency.

  6. DC Bus Output
    Regulated high-voltage DC output with improved power factor.

Key Features (Auto-Generated)

  • Active power factor correction using digital control

  • Dual-loop control: voltage PI + current PI

  • High-frequency PWM-based switching

  • Synchronized ADC sampling using PWM triggers

  • Software-based power-on delay for safe capacitor charging

  • Designed for Proteus VSM simulation

  • Based on Microchip’s AN1106 reference design

Components Used

  • dsPIC33FJ12MC202 microcontroller

  • Bridge rectifier

  • PFC inductor

  • Power MOSFETs

  • DC bus capacitors

  • Voltage and current sensing networks

  • PWM gate driver stage

  • AC voltage source (simulation)

Applications

  • Switched-mode power supplies (SMPS)

  • Power factor correction front ends

  • Industrial power converters

  • Embedded power control training systems

  • Digital power electronics research

  • Educational Proteus simulations for power engineering

Explanation of Code (High-Level)

The firmware configures the dsPIC33 for high-speed control operation.
The oscillator is set for fast execution suitable for real-time power control.
ADC and PWM modules are tightly synchronized to ensure accurate sampling.

The ADC interrupt is the heart of the control system:

  • Handles power-on delay

  • Executes voltage PI control

  • Computes AC current reference

  • Runs current PI controller

  • Updates PWM duty cycle

Fault handling and trap ISRs ensure system stability during abnormal conditions.

Source Code

Download
 © 2005 Microchip Technology Inc.
*
* FileName:        PFC Project.c
* Dependencies:    Header (.h) files if applicable, see below
* Processor:       dsPIC30Fxxxx
* Compiler:        MPLAB® C30 v3.00 or higher
*
* SOFTWARE LICENSE AGREEMENT:
* Microchip Technology Incorporated ("Microchip") retains all ownership and
* intellectual property rights in the code accompanying this message and in all
* derivatives hereto.  You may use this code, and any derivatives created by
* any person or entity by or on your behalf, exclusively with Microchip,s
* proprietary products.  Your acceptance and/or use of this code constitutes
* agreement to the terms and conditions of this notice.
*
* CODE ACCOMPANYING THIS MESSAGE IS SUPPLIED BY MICROCHIP "AS IS".  NO
* WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS CODE, ITS INTERACTION WITH MICROCHIP,S
* PRODUCTS, COMBINATION WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.

Proteus Simulation

The Proteus VSM simulation models the complete PFC power stage along with sensing and control circuitry.
ADC sampling is triggered by PWM events, closely matching real hardware behavior.
During simulation, the DC bus voltage stabilizes after the power-on delay, and input current aligns with the AC voltage waveform.
This setup allows safe validation of control algorithms before hardware implementation.

(FAQs)

1. Why is Proteus simulation used for this project?

Proteus allows safe testing of high-voltage PFC control without real hardware risks.

2. Can this code run on other dsPIC33 devices?

It is optimized for dsPIC33FJ12MC202 but can be ported with peripheral changes.

3. Why is ADC triggered by PWM?

To ensure sampling occurs at consistent points in the switching cycle.

4. What causes unstable DC bus voltage in simulation?

Incorrect PI parameters, ADC scaling errors, or PWM frequency mismatch.

5. Can this project be extended to hardware?

Yes, it is based on a Microchip reference design intended for real systems.

6. Why is there a power-on delay?

To allow DC bus capacitors to charge safely before enabling PFC switching.

7. What PWM frequency is used?

The firmware configures PWM for high-frequency operation suitable for PFC.

8. Is this suitable for beginners?

Best suited for intermediate users familiar with embedded power control.

Conclusion

This dsPIC33 Active Power Factor Correction project is a solid example of modern embedded systems design applied to power electronics.
It demonstrates how digital control, ADC synchronization, and PWM generation work together in real-world applications.
Using Proteus simulation, learners can explore PFC concepts safely while gaining hands-on firmware experience.
A valuable reference for anyone working with microcontroller-based power control systems.

Quick Solutions to Questions related to dsPIC33 Active Power Factor Correction Project:

  • Why is Proteus simulation used for this project?
    Proteus allows safe testing of high-voltage PFC control without real hardware risks.
  • Can this code run on other dsPIC33 devices?
    It is optimized for dsPIC33FJ12MC202 but can be ported with peripheral changes.
  • Why is ADC triggered by PWM?
    To ensure sampling occurs at consistent points in the switching cycle.
  • What causes unstable DC bus voltage in simulation?
    Incorrect PI parameters, ADC scaling errors, or PWM frequency mismatch.
  • Can this project be extended to hardware?
    Yes, it is based on a Microchip reference design intended for real systems.
  • Why is there a power-on delay?
    To allow DC bus capacitors to charge safely before enabling PFC switching.
  • What PWM frequency is used?
    The firmware configures PWM for high-frequency operation suitable for PFC.
  • Is this suitable for beginners?
    Best suited for intermediate users familiar with embedded power control.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter