Design and Construction of a Microcontroller-Based ac Power Control System

DOI : 10.17577/IJERTV3IS110029

Download Full-Text PDF Cite this Publication

Text Only Version

Design and Construction of a Microcontroller-Based ac Power Control System

Akinkuade S. T

Science Technology Department, Federal Polytechnic,

Ado-Ekiti, Nigeria

Itakorode O. D

Science Technology Department, Federal Polytechnic,

Ado-Ekiti, Nigeria

AbstractOne of the numerous ways through which sophistication can be introduced into an electrical system is by providing users with some form of electronic power control; so that the level of illumination in a room, speed of food mixers, electric drills, sewing machines and heat generated by a heating element in an oven or incubators can be controlled with better accuracy and efficiency. The use of RC network in controlling the firing angle of a Silicon Controlled Rectifier(SCR) and Triac in power control circuits is limited to °, an attempt to increase the angle to 18° makes circuits to be complex and less reliable. The quest for possibility of controlling the ac power that is delivered to a load in the entire period of each half-cycle of a sinusoidal voltage prompts the use of a microcontroller in this work. A microcontroller; AT 80C52 was used to adjust the firing angle of a Triac; BT 136-600E in ten equal steps within each half-cycle of the mains ac voltage (220 V, 50Hz). The results indicate that firing angles between ° and 18° can be obtained using the circuit.

KeywordsSystem; Control; Power; Firing Angle; Triac; Microcontroller.


    It is often desired to control the power fed to a load using electronic methods. Such methods permit a fine control of power with better efficiency than electrical methods. Semiconductor devices that are often used to control the flow of current in a circuit are diodes, diode ac (Diac) Thyristors or Silicon Controlled Rectifier (SCR) and Triode ac (Triac) [5]. Diodes only conduct when it is forward biased and have no external control of the start of conduction. Thyristors allow control of the start of conduction in the positive half-cycle of an ac voltage but rely on periodic reversal of current to turn them off. Triac on the other hand has the ability to conduct current in both half- cycles by using positive or negative gate pulse which provides control on the start of conduction; therefore it can be used to provide a control of power in ac circuits of lighting equipment, hot-air oven, electric incubator and electric heater and in universal single phase ac motor. In these systems, power is controlled by means of phase angle variation of the conduction period through the setting of different firing times corresponding to different firing angles.

    The mains voltage is an alternating type that reverses its polarity many times per second and it is sinusoidal in nature. The instantaneous value of such a voltage is usually expressed as:

    v(t) =Vsint (1)

    Where V is the amplitude of the voltage in volts and is the angular frequency in radians per second and t is time in seconds, the period T which is the time it takes the voltage to complete a whole cycle can be written in terms of angular frequency as:

    T=2/ (2)

    The physical frequency f which is measured in hertz (Hz) is related to the angular frequency as:

    = 2f (3)


    T=1/f (4)

    The root-mean-square (rms) value of an ac voltage described by (1) is proportional to the integral of the square of the instantaneous voltage over a period of the voltage, average power delivered to a load by such a voltage is the ratio of the square of rms voltage to the resistance of the load.An ac power controller is a unit that can vary the rms value of the voltage across a load while keeping the frequency constant. Methods that are often used in power control are ON/OFF control, Phase-angle control and pulse-width modulation ac chopper control [2].Power electronic components such as Triac and Thyristors are often used to delay the firing angle in a wave; this causes only part of the wave to be outputted to the load. The firing angle of these devices is the angle in a half-cycle of a sinusoidal signal at which they begin to conduct; is usually the object of control. The remaining angle of the cycle in which the device conducts is the conduction angle . These angles are complimentary.In analogue circuits the firing angle is usually controlled through an RC network in which a capacitor charges through a resistor and discharges through the gate of the Triac, such a network can only change the firing angle between 0° and 90°, but with operational amplifiers and more sophisticated circuits, the firing angle can be changed from 0° to 180° in both cycles of the ac voltage [4]. A digital circuit that can be used to provide control of ac power: precision ac power control was reported by [3]; apart from the complexity of the circuit, the system is not purely electronic.A microelectronics system has a microprocessor in its

    circuitry. It stores the program on which it operates a memory unit and executes the program sequentially at the rate that depends on the clock signal applied to it. One of the numerous advantages of a microelectronic system is its ability to respond to internal or external stimuli called interrupts that must be addressed by the system. Interrupts are electrical signals that are either generated internally by timers or provided by a peripheral system to allow effective communication with the microprocessor or Central Processing Unit (CPU). The CPU checks for the presence of any interrupt at the end of execution of each line the program, the sequential order of execution of the program is broken if there is a interrupt and a particular segment of the program called the Interrupt Service Routine (ISR)which has been specifically written to take care of the interrupt is executed. The CPU resumes the execution of the main program after dealing with the interrupt [1].A microprocessor together with memory units that is fabricated on a chip is a microcontroller. Application of microcontrollers in electronics has led to high performance and reliability; low power consumption and space.Apart from these advantages, microcontrollers are able to meet the computing needs of many tasks efficiently. The availability of software development tools such as compilers, assemblers and debuggers and reliable sources of microcontrollers makes it possible to develop microelectronic systems easily.The use of a microelectronics system to control firing of the gate of a Triac as a means of increasing the reliability and reducing the complexity of a power control system investigated in this project. A microcontroller was used to generate a delay at the beginning of each half-cycle of an ac voltage and fires the gate of a Triac at the end of the delay, the period of the delay depends on the interrupt generated when a switch is pressed.


    The frequency f of the mains ac voltage is 50 Hz, so the period T of its waveform according to (4) is 0.02 s. The period of a half-cycle; is 0.5T = 0.01 s.This interval is divided into ten equal parts , as shown in (5).

    = 0.01/10 = 0.001 s (5)

    The microcontroller is expected to check for the beginning of each half-cycle of the sinusoidal waveform (when the waveform is zero) as an interrupt, and generate a delay whose period is a multiple of before producing a pulse that will fire the gate of a Triac. The delay parameter which is a factor with which will be multiplied will be supplied to the microcontroller as another interrupt through a switch. The delay to be generated will then corresponds to firing angles of 0° to 180° in ten steps.



    The ac mains voltage is stepped down by the power transformer, the ac voltage is rectified by diodes D1 and D2, R1 and R2 form a potential divider across the pulsating dc voltage produced by the rectifier, a sample of the voltage appears at the slider terminal of potentiometer R2, this signal is applied to IC 1 which operates as a non-inverting amplifier. The voltage gain of the amplifier is 1 + R3/R5. The gain of the amplifier is made to be high such that the op-amp is driven into saturation unless its input signal is zero; it is acts as a zero crossing detector of the ac wave. D3 serves to prevent the filter capacitor C1 from altering pulsated waveform applied to IC 1, the voltage regulator provides a steady dc voltage for IC 1 and the microcontroller. The microcontroller produces a pulse waveform at the frequency of 100 Hz being the frequency of pulsated dc produced by a full wave rectifier. The duty cycle of the pulse waveform is 7 %. An interrupt is fed to the microcontroller by the op-amp; each time the ac voltage completes a half-cycle, upon the receipt of the interrupt (INT 0), a delay of a particular period (depending on the number of time switch s is operated) is generated before the pulses are produced. Whenever switch S is pressed, another interrupt (INT 1) of higher priority is applied to the microcontroller; this causes the microcontroller to count the number of time the switch is operated and changes the delay parameter so that the phase angle of the ac waveform and the train of pulses can be adjusted. The signal from the microcontroller is switches on Q1 whenever it at logic 1 (5 V) current flows through Q1, D4 and R8 to the gate of the Triac, this triggers the gate and switches on the Triac. R7 and C3 form a snubber circuit that ensures the Triac is switched of when the voltage across the load is zero.


    • Generate a train of pulses at 100 Hz.

    • Use timer 0 to generate delay of 0.001 s.

    • Use timer 1 as a 16-bit counter to produce a train of pulses at 100 Hz being the frequency of full-wave rectified ac waveform.

    • On receiving interrupt 1, increase the count by 1, display the count, reset the count to 0 when count reaches 10 (decimal).

      • On the receipt of interrupt 0 (when the ac signal crosses zero), check the count of timer 1 and generate appropriate delay starting from the beginning of the cycle.

      • Continue to produce the pulses at 100 Hz.

    logic 1

    SETB P1.0 ;Put P1.0 at

    MOV TH1,#0FDH

    MOV TL1,#43H ;set tr1 at f826

    SETB TR1 ;start timer 1

    JNB TF1,$ ;remain if there


    is no overflow

    CLR TR1 ;stop timer 1

    CPL P1.0 ;compliment

    ORG 0000H

    LJMP MAIN ;go to main




    CLR TF1 ;clear the timer MOV TH1,#0DBH

    MOV TL1,#0F0H ;set tr1 register


    ORG 0013H ; ISR OF INT 1 Allows the power level to be selected

    CALL DELAY1 ; delay of about 0.1 sec

    to b9af

    ADD A,#01H 1

    ;increase the count in register A by

    CLR TF1 ;clear timer flag


    SJMP START ; repeat the cycle



    ;generates a delay of 0.001 to 0.01 sec

    ORG 0030H

    MOV TH0,30


    MOV P1,#00H ;make p1 an output port

    MOV TL0,31

    MOV P2,#00H ;make p2 an output port

    SETB TR0

    MOV P3,#0FFH ;make p3 an input port

    JNB TF0,$

    SETB TR1 ;start timer JNB TF1,$ ;remain if there is no overflow CLR TR1 ;stop timer 1

    MOV TMOD,#11H ;timer 1 is a 16-

    bit counter, timer 2 is 8-bit auto reload counter

    MOV IE,#85H;int0 and int1 are enabled MOV IP,#03H;make int 1 have high


    MOV A,#00H

    CALL CHECK ;to determine what to

    display and delay parameter


    START: ;Generates a sq. wave of freq.100hz TLH=


    DELAY1: ;Generates a delay of 0.1 seconds MOV R2,#0C8H

    GET:MOV R1,#0FAH DJNZ R1,$


    CJNE A,#00H,ONE

    MOV 30,#0FFH MOV 31,#0FFH

    MOV P2,#0FCH

    ;display 0



    CJNE A,#01H,TWO

    MOV 30,#0DEH

    MOV 31,#0E7H

    MOV P2,#60H

    ;display 1



    CJNE A,#02H,THR

    MOV 30,#0E0H

    MOV 31,#0BFH

    MOV P2,#0DAH



    CJNE A,#03H,FOUR

    MOV 30,#0E4H

    MOV 31,#0A7H

    MOV P2,#0F2H



    CJNE A,#04H,FIVE

    MOV 30,#0E8H

    MOV 31,#08FH

    MOV P2,#66H



    CJNE A,#05H,SIX

    MOV 30,#0ECH

    MOV 31,#077H

    MOV P2,#0B7H



    CJNE A,#06H,SEV


    0.001 TO .01 s

    MOV 30,#0F0H MOV 31,#05FH MOV P2,#0BEH SJMP TRY

    SEV: CJNE A,#07H,EGT MOV 30,#0F4H MOV 31,#047H MOV P2,#0E0H SJMP TRY



    FULL: MOV A,#00H MOV 30,#0FFH MOV 31,#0FFH MOV P2,#08EH TRY: RET


  7. COMPONENTS OF THE SYSTEM Table 1 shows the components used in the construction of

    the power control system.



    Labels in circuit

    Part number/


    Description/ Specification

    Transformer Diodes

    Capacitors Resistors

    Regulator Transistor

    Amplifier Microcontroller


    D1, D2 & D3 D4

    C1 C2 C3 R1 R2 R3 R4 R5 R6 R7 R8


    IC1 MCU

    1N 4001

    1N 4148

    10 F 16 V

    1 F 16 V

    0.1 F 400 V 10 K

    50 K

    10 K

    1 K


    4.7 100 100 7805 BC 107

    LM 324 AT 80C52

    BT 136-600E

    220 /12 Vac Rectifier Signal diode Electrolytic Electrolytic Non-polarised

    0.25 W

    Log. Potentiometer

    0.25 W

    0.25 W

    0.25 W

    0.25 W 5 W

    0.25 W

    5 V regulator Small signal NPN BJT


    4 Quadrant Triac


    Results of measurements taken at certain points in the circuit are shown in the figures below:

    Fig 1. Output of the Rectifier as sampled by R1 and R2

    Fig2. Output of the zero crossing detector

    Fig3. Output of zero crossing detector (top) an microcontroller (bottom) showing large firing angle

    Fig4. Output of zero crossing detector (top) and microcontroller (bottom) showing small firing angle

    The non-inverting amplifier of a gain of 1001 amplifies the sampled rectified ac waveform to produce a rectangular waveform of duty cycle 95 % and amplitude of 3 V as shown in Figs. 4 and 5. The firing angle of the Triac calculated from fig. 4 is 18°; in fig. 5, the angle is 135°. These firing angles correspond to 10 % and 75 % of the period of the pulsated dc voltage produced by a full wave rectifier shown in fig. 2.

  9. CONCLUSIONAND RECCOMENDATION According to the design, the firing angle is expected

    to be in multiples of 18°. The error observed in the second firing angle may be due to a difference in the frequency of the input voltage ant the frequency of the train of pulses produced by the microcontroller. A possible solution to this problem is to allow the microcontroller measure the frequency of the input voltage, before generating the train of pulses and to determine the periods of delay to be introduced whenever the switch is operated. The results reveal that ac power can be controlled with precision using a microcontroller.


Anil K. M. (2007), Digital Electronics: Principles, Devices and Applications,John Wiley & Sons, Ltd.

Rashid M. H (2010), Power Electronics Handbook: Devices, Circuits and Applications, Elsevier, pp 147-154. Pratap S (2012 ), (

Malvino A. P (1999), Electronics Principles, 6ed, Glencoe/McGraw-Hill, New York, pg. 509

Mehta V.K and Mehta R (2008), Principles of Electronics, 10ed, S.Chand, New Delhi, pp 522-523.

Leave a Reply