I am currently a PhD student at UC Berkeley, following a 6-year journey working at Apple after my undergrad years at Cornell University. I grew up in Dhaka, Bangladesh where my interest in electronics was cultivated, resulting in the creation of this blog.
Are we make a live call on skype? Do you speak and understand urdu? sorry, I am Khalid Rajpoot from Karachi, Pakistan I need some help on Spwm Inverter for dsPic33fj16 Pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeee inkar nahi krna. My Email ID is ( kmr4uall@gmail.com ), I wait your reply email
You have done the great work. i am also trying to make off line UPS using DSPIC33FJ12MC202. I have done most of the work in it. I am using PWM module for it with full bridge. My inverter is giving 220V AC without load. But when I connect load at O/P, volts goes down to 60V from 220V. I think with load volts should not be get down with any load. My transformer rating is 12V to 220v. Please help me how to solve this problem.
Hi, Thanks for the reply. Can you pls give me ur Email ID?? So that I can send you the schematic of MOSFET driving circuit as well as some other important files.
This is a nice tutorial on dspic SPWM. Question is, if it is possible to create in a simple 16F series why DSPIC? On 16F Sires we take average amplitude and Correct with PI feedback control, which works fine for most domestic use. If dspic is there, it needs Point by Point sampling and compensate the duty with respect to volt and current ( Microchip App note AN1279) . This is a nice approach using Pwm module in dspic33f and would be fruitful if we get something practical :). Thanks for sharing ur hard work on Public.
DSPIC is faster and more powerful than PIC16. So, if you generate sine wave with dsPIC, you can do more things than you can with a PIC16. For example, you can create a cleaner sine wave. You can do more control with the dsPIC, such as having it as a central controller controlling everything to greater precision. You can have quicker and smoother feedback. You can implement PID. You can change amplitude and frequency on the fly. If you were going for a 2-stage (DC link) inverter, the dsPIC could handle both sides (DC-DC and DC-AC) as well as other control/monitoring circuits. You can see the benefits of using the dsPIC. Now it's up to the designer to decide if that is required. If so, then the dsPIC can be used. If not, then the designer can stick with PIC16 or PIC 18.
Moreover, with prices dropping, the dsPIC is not that much more expensive, but offers greater flexibility and processing power.
Dear Tahmid Thanks for ur kind replay. i was wondering about feedback control with PID. Did u try it with Dspic? It would be very helpful if u attach a code sample for that. Thanks
dear tahmid, Its really a great work and very helpful. Actually i am new in microcontroller. i want to generate code using dspic33ep. I already modify the code and got 50hz signal. But there is a problem with 20khz signal. I am not sure why its not working. Can you please help me regarding this problem. I am really trying to fix but i couldn't. If you want i can post the code. It will be great help for me if you have some time. thank you
Hi Tahmid, Great work. I have doubt in indexing of array (in the the code) sin_table[Result]. when value of Phase goes beyond 16-bit then it will become 0. when Value of Phase reaches 65500 then value of result variable is 500. In next increment Phase value will overflow and Result value will be 0.
So with this condition it will index 511 location.
Hello Tamid, you are doing amazingly great. I seriously need your assistance. I am trying to follow your thread for pure sine-wave, but I am using pic18f2520. I however got 100Hz, 229Vac but I have tried all possible means within my understanding to reduce my frequency, instead my voltage reduces while my frequency become unstable. I am very sure my configuration is not right. Find below my configuration, your counsel would help. const float dutyCycle[100]={
Following errors appears in proteus simulation: [DSPIC33LP OC1] PWM (No Fault): New PWM duty cycle is zero. Pin remains low until (at least) start of next period. [U1]
[DSPIC33LP OC1] PWM (No Fault): New PWM duty cycle never ends as OC1R>PRy. Pin stays high until start of next period. [U1]
dsPIC is my choice for critical and big projects. it's more powerful! but for simple projects, i've using 16F and 18F series! tahmid have good projects!!!!!
Dear Tahmid
ReplyDeleteYou r really amazing thank you for sharing
Regards
Veera...!
u r awesome Tahmid... Well job Keep it up ....
ReplyDeleteHi Tahmid,
ReplyDeleteAre we make a live call on skype? Do you speak and understand urdu?
sorry, I am Khalid Rajpoot from Karachi, Pakistan
I need some help on Spwm Inverter for dsPic33fj16
Pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeee inkar nahi krna.
My Email ID is ( kmr4uall@gmail.com ), I wait your reply email
You can ask your questions on a forum like www.edaboard.com
DeleteYou can give me the link so that I can take a look at it.
I'm sorry but I can't give enough time now to Skype. Work load at university is quite high.
Regards,
Tahmid.
Hi Tahmid,
ReplyDeleteYou have done the great work.
i am also trying to make off line UPS using DSPIC33FJ12MC202.
I have done most of the work in it.
I am using PWM module for it with full bridge.
My inverter is giving 220V AC without load.
But when I connect load at O/P, volts goes down to 60V from 220V.
I think with load volts should not be get down with any load.
My transformer rating is 12V to 220v.
Please help me how to solve this problem.
Regards
Dhaval
hi Dhaval
Deletecan you upload your ups files
We need to see the circuit diagram at least to try and guess where the problem may be.
DeleteI think the problem is in the MOSFET drive section. However, without more details (schematic, code, etc), I can't really tell what's wrong here.
Without feedback, the output voltage will drop with load, but not this much.
Regards,
Tahmid.
Hi,
DeleteThanks for the reply.
Can you pls give me ur Email ID??
So that I can send you the schematic of MOSFET driving circuit as well as some other important files.
Regards
Dhaval
I prefer you upload it online somewhere so that others can see it and benefit from it and the discussions here.
DeleteHowever, if you feel uncomfortable making your files public, you can email them to me at inferno-rage@hotmail.com
Regards,
Tahmid.
hi tahmid
ReplyDeletei have question how can we produce 50 hz sine wave in pic
Go to this page: http://tahmidmc.blogspot.com/p/blog-page.html
DeleteLook under the section "SPWM and sine wave generation and inverter"
There are articles/tutorials there covering sine wave generation using PIC
This is a nice tutorial on dspic SPWM. Question is, if it is possible to create in a simple 16F series why DSPIC? On 16F Sires we take average amplitude and Correct with PI feedback control, which works fine for most domestic use. If dspic is there, it needs Point by Point sampling and compensate the duty with respect to volt and current ( Microchip App note AN1279) . This is a nice approach using Pwm module in dspic33f and would be fruitful if we get something practical :). Thanks for sharing ur hard work on Public.
ReplyDeleteDSPIC is faster and more powerful than PIC16. So, if you generate sine wave with dsPIC, you can do more things than you can with a PIC16. For example, you can create a cleaner sine wave. You can do more control with the dsPIC, such as having it as a central controller controlling everything to greater precision. You can have quicker and smoother feedback. You can implement PID. You can change amplitude and frequency on the fly. If you were going for a 2-stage (DC link) inverter, the dsPIC could handle both sides (DC-DC and DC-AC) as well as other control/monitoring circuits. You can see the benefits of using the dsPIC. Now it's up to the designer to decide if that is required. If so, then the dsPIC can be used. If not, then the designer can stick with PIC16 or PIC 18.
DeleteMoreover, with prices dropping, the dsPIC is not that much more expensive, but offers greater flexibility and processing power.
Regards,
Tahmid.
Dear Tahmid
DeleteThanks for ur kind replay. i was wondering about feedback control with PID. Did u try it with Dspic? It would be very helpful if u attach a code sample for that. Thanks
I haven't tried it yet.
DeleteAs'salam o Alaikum!
ReplyDeleteSyed Tahmid Mahbub,
I am Muhammad Javed.
I sure that you have test this inverter, on load its output voltage is stable or not?
And Please give me the complete drive circuit?
Regard,
Muhammad Javed
dear tahmid,
ReplyDeleteIts really a great work and very helpful. Actually i am new in microcontroller. i want to generate code using dspic33ep. I already modify the code and got 50hz signal. But there is a problem with 20khz signal. I am not sure why its not working. Can you please help me regarding this problem. I am really trying to fix but i couldn't. If you want i can post the code. It will be great help for me if you have some time. thank you
Hi
ReplyDeleteI have a doubt in the calculation. Please help me understand!
PWM_Freq = 25KHz
Tpwm = 40us
Tpwm * No of Values in the sine table = 10ms (Half cycle of 50Hz sine wave)
Thus I got the number of values to be 250
But how could a table value of 256 be afforded?
I don't get this. According to the calculation the frequency gets 48.8Hz. Is this precision okay or my calculation is wrong?
Hi Tahmid,
ReplyDeleteGreat work.
Wondering if there is any dead-time in this code!
Hi Tahmid,
ReplyDeleteGreat work.
I have doubt in indexing of array (in the the code) sin_table[Result].
when value of Phase goes beyond 16-bit then it will become 0. when Value of Phase reaches 65500 then value of result variable is 500.
In next increment Phase value will overflow and Result value will be 0.
So with this condition it will index 511 location.
Please clear this doubt.
Hi Tahmid,
ReplyDeleteI am not able to view this file. Could you upload it again
Page is not displaying the implementation method. It is only displaying comments. Please fix it.
ReplyDeleteOpen it in Google docs. It will then open in pdf.
DeleteThis is awesome, dude thanks. I have been looking for a tutorial like this for days.
ReplyDeleteHello Tamid, you are doing amazingly great. I seriously need your assistance. I am trying to follow your thread for pure sine-wave, but I am using pic18f2520. I however got 100Hz, 229Vac but I have tried all possible means within my understanding to reduce my frequency, instead my voltage reduces while my frequency become unstable. I am very sure my configuration is not right. Find below my configuration, your counsel would help.
ReplyDeleteconst float dutyCycle[100]={
0,7,15,23,31,39,46,54,62,69,77,84,92,99,106,113,120,127,133,
140,146,153,159,165,171,176,182,187,192,197,202,206,211,215,219,222,226,229,232,235,237,
240,242,243,245,246,247,248,249,250,250,249,248,247,246,245,244,243,242,240,237,235,232,
229,226,222,219,215,211,206,202,197,192,187,182,176,171,165,159,153,146,140,133,127,120,
113,106,99,92,84,77,69,62,54,46,39,31,23,15,7
};
void InitTimer2()
{
T2CON = 0x0C;
TMR2IE_bit = 1;
PR2 = 249;
INTCON = 0xC0;
}
void pwms_init()
{
trisc1_bit =0;trisc2_bit =0;
portc.f1 = 0;portc.f2 = 0;
CCP1CON=CCP2CON=0;
CCP1CON = 0x0F;
CCP2CON = 0x0F;
CCPR1L = CCPR2L = 0;
ajiri = 0;
}
void Interrupt()
{
if(TMR2IF_bit)
{
TMR2IF_bit = 0;
if(ajiri==0)
{
gate3=1;gate2=0;gate1++;
if(gate1<100)
{
CCPR2L=0;
CCP2CON.DC1B1=CCP2CON.DC1B0=0;
CCP1CON.DC1B0=CCP1CON.DC1B1=1;
CCPR1L=dutyCycle[gate1]*adder;
}
if(gate1==99)
{
gate1=0;ajiri=1;gate3=0;
}
}
if(ajiri==1)
{
gate2=1;gate3=0;gate4++;
if(gate4<100)
{
CCPR1L=0;
CCP1CON.DC1B0=CCP1CON.DC1B1=0;
CCP2CON.DC1B1=CCP2CON.DC1B0=1;
CCPR2L=dutyCycle[gate4]*adder;
}
if(gate4==99)
{
gate4=0;ajiri=0;gate2=0;
}
}
}
}
Following errors appears in proteus simulation:
ReplyDelete[DSPIC33LP OC1] PWM (No Fault): New PWM duty cycle is zero. Pin remains low until (at least) start of next period. [U1]
[DSPIC33LP OC1] PWM (No Fault): New PWM duty cycle never ends as OC1R>PRy. Pin stays high until start of next period. [U1]
I've using dsPIC33FJ32GP204 and dsPIC33FJ32GP202 give the same warnings and errors
DeletedsPIC is my choice for critical and big projects. it's more powerful! but for simple projects, i've using 16F and 18F series! tahmid have good projects!!!!!
ReplyDeleteThanks for your post it is very interesting for me!
ReplyDeleteThis is very useful information for me. Thank you very much!
ReplyDeleteA very good article. Thanks to the author.
ReplyDelete