We know that the PWM signal is very easy to generate using micro-controllers and we can control DC loads using this PWM signal. If we could use the PWM pulse to drive AC loads, the control circuit would become very easy. This is why many people look for PWM-based driver circuits for AC loads. Here in this article, we will see how we can Regulate AC loads using PWM signal

Disclaimer: Electricity is always dangerous. Proper skill is required to work with electricity. Do work at your own risk. The author will not be responsible for any misuse or harmful act or any mistake you make. The contents of this website are unique and copyright protected. Kindly don’t do any nonsensical act copying and claiming it as yours. Most of the articles published here are kept as open-source to help you. Take the knowledge for free and use it, but if you are interested you can buy the ready resources offered here. If you need any help or guide feel free to comment below, the author will try to help you. Thanks.

Before we start the hardware please read this article first to understand how the PWM signal can be used to control AC loads.

Table of Contents

First we need to generate PWM signal:

Using a micro-controller makes many works easy. For those who are already experienced working with micro-controller, it is very easy to generate a PWM signal. For those who are new, this is not so complex at all.

Here, I’m generating a PWM signal using the PIC16F76 microcontroller. You can select other MCUs with the PWM module built-in. Or you can use software PWM.

Circuit diagram for PWM generation:

Before Regulating AC loads using PWM, we need to generate a PWM signal first. Using a PIC microcontroller and small coding in mikroC, we can do this very easily.

PWM generation using PIC microcontroller

Coding for PWM generation:

This same code will be used to drive the load using a PWM signal.

/*******************************************************************************
* Program for PWM generation with PIC16F76                                     *
* Program Written by_ Engr. Mithun K. Das                                      *
* MCU:PIC16F76; X-Tal:8MHz; mikroC pro for PIC v7.6.0                          *
* Date: 20-07-2020                                                             *
*******************************************************************************/
// LCD module connections
sbit LCD_RS at RB7_bit;
sbit LCD_EN at RB6_bit;
sbit LCD_D4 at RB5_bit;
sbit LCD_D5 at RB4_bit;
sbit LCD_D6 at RB3_bit;
sbit LCD_D7 at RB2_bit;

sbit LCD_RS_Direction at TRISB7_bit;
sbit LCD_EN_Direction at TRISB6_bit;
sbit LCD_D4_Direction at TRISB5_bit;
sbit LCD_D5_Direction at TRISB4_bit;
sbit LCD_D6_Direction at TRISB3_bit;
sbit LCD_D7_Direction at TRISB2_bit;
// End LCD module connections

int duty=0;
int adc_rd=0;
int i = 0;
int parcentage=0;
char text[4];

void main() 
{
  TRISA=0xFF;
  TRISC = 0xF0;
  ADCON0=0x01;
  ADCON1=0x00;
  Lcd_Init();
  Lcd_Cmd(_LCD_CLEAR);
  Lcd_Cmd(_LCD_CURSOR_OFF);
  Lcd_Out(1,1,"AC LOAD CONTROL");
  Lcd_Out(2,1,"USING PWM SIGNAL");
  PWM1_Init(5000);// initialize PWM at 5KHz
  PWM1_Start();//start PWM module
  PWM1_Set_Duty(0);//start zero duty pwm
  Delay_ms(3000);
  Lcd_Cmd(_LCD_CLEAR);
  while(1)
  {
     //control PWM with ADC
     adc_rd=0;
     for(i=0;i<20;i++)
     {
        adc_rd+=ADC_Read(0);
     }
     adc_rd/=20;
     
     //display adc_value
     text[0] = adc_rd/100 + 48;
     text[1] = adc_rd/10%10 + 48;
     text[2] = adc_rd%10 + 48;
     Lcd_Out(1,1,"ADC:");
     Lcd_Out(1,5,text);
     
     
     duty = adc_rd;
     PWM1_Set_Duty(duty);
     
     //display PWM duty
     text[0] = duty/100 + 48;
     text[1] = duty/10%10 + 48;
     text[2] = duty%10 + 48;
     Lcd_Out(2,1,"DUTY:");
     Lcd_Out(2,6,text);
  
     parcentage = duty*100/255;
     
     //display %
     text[0] = parcentage/100 + 48;
     text[1] = parcentage/10%10 + 48;
     text[2] = parcentage%10 + 48;
     Lcd_Out(1,10,"P:");
     Lcd_Out(1,12,text);
     Lcd_Out(1,15,"%");  
  }
}

Simulation result with PIC16F76 PWM generation

AC load drive with PIC16F76:

Now if we use this PWM generating control circuit with our previous AC load driving circuit, then we can design our circuit diagram for our project Regulate AC loads using PWM:

Regulate AC loads using PWM circuit diagram

Here, the PIC16F76 microcontroller is generating a PWM signal, and the duty cycle can be changed by tuning the variable resistor (POT) RV1. As the micro-controller is generating a 5V output signal we need to amplify that signal to switch the MOSFET. An optocoupler 4N35 is used for this purpose. A 12V source is required too which normally comes from the common power supply of the project.

Here a transformer is used across the load to measure the signal across the load. There is no necessity to use this transformer in real hardware.

Regulate AC loads using PWM

Here, the blue signal is the PWM output signal from MCU and the Yellow signal is the signal across the load.

Simulation result:

As we see, this project was easier than the previous one with NE555. Because we can control the frequency very easily from code. That makes our work easy.

I hope this project was helpful to you. If you make one for yourself, it will be a great pleasure for me. Anywhere you need help, let me know. Please share this project and subscribe to my blog. Thank you.

Loading

JLCPCB – Only $2 for PCB Prototype (Any Color)

24 Hours fast turnaround, Excellent quality & Unbeatable prices

$18 Welcome Bonus for new registrations Now!!! https://jlcpcb.com


Check this out: 5 coolest multimeters you can buy


MKDas

I'm Mithun from Bangladesh. Electronics is my passion, love to work with electronics. This is my personal blog. Besides my regular works, I write some articles here. Most of them are open-source and everything is presented in the easiest way so that anyone can understand and learn it. Thanks.

5 Comments

Chandana · July 30, 2020 at 11:38 pm

Many Thanks

Rezaul · August 8, 2020 at 5:45 am

Thank you. আমার আরও আগে খোঁজ পাওয়া উচিত ছিল!
আমি pic mcu & mikroc শেখার চেষ্টা করছি.

flexo · October 20, 2020 at 10:29 am

this method isn’t suitable for inductive loads

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *