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 ⚠️
Working with electricity involves serious risk. Ensure you have the necessary skills and take proper safety precautions before attempting any electrical projects. Proceed at your own risk — the author assumes no responsibility for any damage, injury, or issues resulting from the use or misuse of the information provided.
All content on this website is original and protected by copyright. Please do not copy or reproduce content without permission. While most of the resources shared here are open-source and freely accessible for your learning and benefit, your respect for our intellectual effort is appreciated.
If you find our tutorials helpful, consider supporting us by purchasing related materials or sharing our work — it helps keep the content flowing.
Need help or have questions? Leave a comment below — the author is always happy to assist!
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.
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:
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.
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.
Liked this article? Subscribe to our newsletter:
or,
Visit LabProjectsBD.com for more inspiring projects and tutorials.
Thank you!
Check this out: 5 coolest multimeters you can buy
9 Comments
Chandana · 30/07/2020 at 11:38 pm
Many Thanks
Rezaul · 08/08/2020 at 5:45 am
Thank you. আমার আরও আগে খোঁজ পাওয়া উচিত ছিল!
আমি pic mcu & mikroc শেখার চেষ্টা করছি.
Mithun K. Das · 08/08/2020 at 6:05 am
স্বাগতম।
flexo · 20/10/2020 at 10:29 am
this method isn’t suitable for inductive loads
Mithun K. Das · 20/10/2020 at 2:14 pm
Yes. Good for resistive loads only.
MAHBUB JAMAN · 27/01/2022 at 7:02 pm
Sir,
Please give a method for inductive load.
MKDas · 28/01/2022 at 3:58 pm
Use TRIAC and control the firing angle of the TRIAC firing.
Anwar · 02/04/2022 at 12:46 pm
Can you help me with the code for generating SPWM using reference voltage to generate pure sine wave output depending on the reference voltage (Sine wave) using PIC microcontroller?
MKDas · 02/04/2022 at 12:58 pm
There is another article on this. please check it in the blog. Thanks.