Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PWM inverter circuit issues PIC

Status
Not open for further replies.

James A

Newbie level 3
Joined
Oct 25, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
Hello to everyone,
Guys I designed a pic based PWM inverter using the CCP1 and CCP2 and then use the low pass filters to obtain the PWM outputs in sine. I used the micro c to program the pic16f887 and obtained my required sine wave in simulation, however I am new to designing and I think I made a mistake in using the CCP pins as I checked the internet for similar design for confirmation and found none I hope someone here could provide some perspective.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
unsigned short duty_cycle=255;
unsigned short duty_cycle1=0;
void initial()
{
ANSEL=0;
ANSELH=0;
 
PORTA=0;
PORTB=0;
PORTC=0;
TRISA=255;
TRISC=0;
PWM1_INIT(5000);
PWM2_INIT(5000);
}
 
 
 
 
 
void main() {
 
 pwm1_set_duty(duty_cycle);
 pwm2_set_duty(duty_cycle1);
 pwm2_start();
 pwm1_start();
 
while(1)
{
   while (duty_cycle>0)
{
   duty_cycle-=15;
   pwm1_set_duty(duty_cycle);
   }
   while (duty_cycle1<255)
{
   duty_cycle1+=15;
   pwm2_set_duty(duty_cycle1);
   }
 
  while (duty_cycle1>0)
{
   duty_cycle1-=15;
   pwm2_set_duty(duty_cycle1);
   }
    while (duty_cycle<255)
{
   duty_cycle+=15;
   pwm1_set_duty(duty_cycle);
   }
  }
  }


and the simulation results along with the circuit diagram are given below
1.PNGCapture.PNG
In the graph the one below is required and the above one is being produced from dc by the circuit.
Btw, my adviser thinks this wont work.
 
Last edited by a moderator:

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,208
Helped
4,958
Reputation
9,938
Reaction score
4,781
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
129,146
I think you are completely off course!

The idea of using PWM is that you use the digital signal to drive the power stages so they are fully on or fully off (= max efficiency) then filter it to a sine wave afterwards.
Just using PWM to produce low level sine waves isn't wrong if you want a signal genarator but it isn't good for an inverter application.

Brian.
 

Tahmid

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,792
Reputation
3,576
Reaction score
1,651
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,543
You are constantly changing the duty cycle by a fixed amount. You need to implement SPWM and the duty cycle needs to be changed, not by a fixed amount, but variably so that the generated sequence of pulses represent a digital implementation of a sine wave. Thus, the values must vary sinusoidally. Also, in the main code, you haven't called the initial() subroutine.

You can find a tutorial here that describes how to generate a sine table and implement SPWM: https://tahmidmc.blogspot.com/2011/01/generation-and-implementation-of-sine.html
You may also find these helpful:
https://www.edaboard.com/blog/1800/
https://www.edaboard.com/blog/1803/
https://www.edaboard.com/blog/1798/

Hope this helps.
Tahmid.
 

James A

Newbie level 3
Joined
Oct 25, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
Thanks a lot for the reply,
If I were to use high power transistors instead of 2n2222 like IGBTs would that help. Plus are there any nice capacitors and resistors which can handle in excess of 500W.
P.S. The op amp is just being used to take difference I was having problems while taking difference and observing it in oscilloscope so i just used a differential circuit. Practically it should not be there.

Regards
James A
 

Tahmid

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,792
Reputation
3,576
Reaction score
1,651
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,543
Practically, you should be feeding drivers from the output signals from the microcontroller. The drivers should drive a full-bridge converter stage (using IGBTs or MOSFETs). The output of the full-bridge converter stage should be filtered using LC filter, not RC filter.

Hope this helps.
Tahmid.
 

James A

Newbie level 3
Joined
Oct 25, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
Thanks a lot for the reply,

But I don't have an issue with the signal generated. Power rating and capacitor capability and availability of the required components in the circuit is the problem. Could you hep with that.

Regards
James A

- - - Updated - - -

Further more could you elaborate the usage of LC filter, rather than RC not really good at that stuff. :)

Regards
James A
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top