Hello folks,
Here is the post about Frequency control of Inverter with Avr microcontroller.
There are two method to control output power of inverter they are
1)PWM control (read this post)
2)Frequency control
Que: "How power of inverter is controlled by frequency control?"
Ans: This method is for series or parallel resonant circuit connected as load to the inverter.
as you can see in the graph that maximum current flows at resonance frequency. if the frequency is above or below that the current decreases and power can be controlled with variation in frequency.
so, now you know why you need frequency control of inverter for power control in L-C tank circuits.
But, how to do that with AVR?
We can use timers in AVR microcontroller to produce frequency whatever we want.(sounds so easy, yes it is so easy!!!)
But,that's not all we just don't have to make a pulse from microcontroller we have to make two non-overlapping pulses for full bridge inverter
as you can see from the fig we have to trigger S1 and S4 at same time and S2 and S3 at same time but pulses P1(for S1 and S4) and P2(S2and S3) should be non overlapping!!!
that has been taken care in the programming. We have inserted approx 6uS guard time for two pulses.
this is the specifications of below written BASCOM-code
1)Guard time of 6uS
2)Frequency display on LCD
3)2.1kHz to 10.8kHz frequency range
--------------------------------------------------------------------------------------------------------
'author:keyuracharya.blogspot.com
$regfile = "m8535.dat" ' specify the used micro
$crystal = 16000000 ' used crystal frequency
'$baud = 9600 ' use baud rate
'$hwstack = 32 ' default use 32 for the hardware stack
'$swstack = 10 ' default use 10 for the SW stack
'$framesize = 40
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.2 , Rs = Portc.0
Config Lcd = 16 * 2
Cursor Off
Dim Mybit1 As Bit
Dim Timer1_val As Byte
Dim Freq As Single
Dim T1 As Integer
Dim Diff As Byte
Dim S1 As String * 16
Mybit1 = 1
Timer1_val = 150
Config Portb.3 = Output
Config Portd.7 = Output
Ddra = 0
Porta = 255
Declare Sub Feequency_display
Locate 1 , 1
Lcd "Freq.control"
Enable Interrupts
Enable Compare2
Config Timer2 = Timer , Prescale = 32
On Compare2 Overflow_timer2
Call Feequency_display
Do
If Pina.4 = 0 Then
If Timer1_val < 240 Then
Incr Timer1_val
Call Feequency_display
End If
End If
If Pina.5 = 0 Then
If Timer1_val > 150 Then
Decr Timer1_val
Call Feequency_display
End If
End If
Loop
End
Overflow_timer2:
Portb.3 = 0
Portd.7 = 0
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
Portb.3 = Mybit1
Toggle Mybit1
Portd.7 = Mybit1
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
Timer2 = Timer1_val
Return
Sub Feequency_display
Waitms 100
Diff = 255 - Timer1_val
T1 = 4 * Diff
T1 = T1 + 32
Freq = 1000 / T1
S1 = Fusing(freq , "#.##")
Locate 2 , 1
Lcd S1 ; "kHz "
End Sub
-------------------------------------------------------------------------------------------------
the output of this code is shown in figure above
Here "VSM counter timer" is used to measure frequency produced by AVR.
and you can see two non overlapping pulses generated from AVR.
the connection diagram is shown below.
yet this is only the pulse generated from microcontroller,we have to apply them to MOSFET like IRF640 or IRFZ44,for that opto coupler like MCT2E can be used.you can read this post to see how to isolate the microcontroller from High power circuit.
Here is the post about Frequency control of Inverter with Avr microcontroller.
There are two method to control output power of inverter they are
1)PWM control (read this post)
2)Frequency control
Que: "How power of inverter is controlled by frequency control?"
Ans: This method is for series or parallel resonant circuit connected as load to the inverter.
LC Resonance curve |
so, now you know why you need frequency control of inverter for power control in L-C tank circuits.
But, how to do that with AVR?
We can use timers in AVR microcontroller to produce frequency whatever we want.(sounds so easy, yes it is so easy!!!)
But,that's not all we just don't have to make a pulse from microcontroller we have to make two non-overlapping pulses for full bridge inverter
Full bridge full controlled inverter |
that has been taken care in the programming. We have inserted approx 6uS guard time for two pulses.
this is the specifications of below written BASCOM-code
1)Guard time of 6uS
2)Frequency display on LCD
3)2.1kHz to 10.8kHz frequency range
--------------------------------------------------------------------------------------------------------
'author:keyuracharya.blogspot.com
$regfile = "m8535.dat" ' specify the used micro
$crystal = 16000000 ' used crystal frequency
'$baud = 9600 ' use baud rate
'$hwstack = 32 ' default use 32 for the hardware stack
'$swstack = 10 ' default use 10 for the SW stack
'$framesize = 40
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.2 , Rs = Portc.0
Config Lcd = 16 * 2
Cursor Off
Dim Mybit1 As Bit
Dim Timer1_val As Byte
Dim Freq As Single
Dim T1 As Integer
Dim Diff As Byte
Dim S1 As String * 16
Mybit1 = 1
Timer1_val = 150
Config Portb.3 = Output
Config Portd.7 = Output
Ddra = 0
Porta = 255
Declare Sub Feequency_display
Locate 1 , 1
Lcd "Freq.control"
Enable Interrupts
Enable Compare2
Config Timer2 = Timer , Prescale = 32
On Compare2 Overflow_timer2
Call Feequency_display
Do
If Pina.4 = 0 Then
If Timer1_val < 240 Then
Incr Timer1_val
Call Feequency_display
End If
End If
If Pina.5 = 0 Then
If Timer1_val > 150 Then
Decr Timer1_val
Call Feequency_display
End If
End If
Loop
End
Overflow_timer2:
Portb.3 = 0
Portd.7 = 0
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
Portb.3 = Mybit1
Toggle Mybit1
Portd.7 = Mybit1
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
Timer2 = Timer1_val
Return
Sub Feequency_display
Waitms 100
Diff = 255 - Timer1_val
T1 = 4 * Diff
T1 = T1 + 32
Freq = 1000 / T1
S1 = Fusing(freq , "#.##")
Locate 2 , 1
Lcd S1 ; "kHz "
End Sub
-------------------------------------------------------------------------------------------------
the output of this code is shown in figure above
Here "VSM counter timer" is used to measure frequency produced by AVR.
and you can see two non overlapping pulses generated from AVR.
the connection diagram is shown below.
yet this is only the pulse generated from microcontroller,we have to apply them to MOSFET like IRF640 or IRFZ44,for that opto coupler like MCT2E can be used.you can read this post to see how to isolate the microcontroller from High power circuit.