Continue to Site

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.

[SOLVED] Pic 16f876a Pure Sinewave inverter

Status
Not open for further replies.
Hello At
I have therefore connected an alternating voltage (50Hz) of about 5v to points 4 and 7 (via an R), ]and the output lamps have light up equally.
[/size]
it seems good .:D:D:D:D

I will now test the other half (A) of the bridge
Pierre
 

Hello At

Then test the other half (A) of the bridge. If that's ok test the full bridge, connect 4 and 7 parallel to 12 and 9, take One lamp and connect it between A and B.
With 50Hz on 4-7 and 12-9, it should not flicker, but light-up brightly with 50Hz.
It burns on 12vAC t/t square wave. If you connect a diode in series with the lamp it will visually flicker at 25 Hz.

the full bridge test is OK: light-up brightly with 50Hz and flicker at 25 Hz with a diode in series with the lamp.
What type af transfo can I use : I have a 12V /220V 12VA in stock ?
Can I use this type to check the battery current ?
Pierre
 

doc007 said:
What type af transfo can I use : I have a 12V /220V 12VA in stock ?
Can I use this type to check the battery current ?
Pierre
Hallo pierre,
If it is a 12W trafo, you can load it with a 7W lightbulb (from a sewing machine or so) on the 220 side. It should draw about 1A from the battery then, I think. Also measure the DC resistance from the 12v coil, this wil give you the maximum current if something goes wrong.
Let's hear what you can measure, can you take a look at the waveforms too? (probably square on the 220v side).
At.
 

Hello At,
All my lamps 220V have 40 W or more.I will go tomorrow to buy one of 7 W.

The DC resistance from the 12v coil is 3.4 ohms.

As soon as I have the lightbulb, I announce you the battery curent and the waveform on the 220 side.
Pierre
 

doc007 said:
The DC resistance from the 12v coil is 3.4 ohms.
Pierre
So your max batt.current could rise up to about 4 Amps max, but if the trafo does not saturate (only 7W) it could draw only 1A. Which means that your fet's should stay intact with this test.
 

Hello AT

At wrote
Which means that your fet's should stay intact with this test.
Can this test be dangerous for my fet 's ?
If so can I make the following test not with 50 Hz on 4-7 and 12-9 but with U11 connected and my trafo and the lamp of 7 W ?

Pierre
 

doc007 said:
Can this test be dangerous for my fet 's ?
If so can I make the following test not with 50 Hz on 4-7 and 12-9 but with U11 connected and my trafo and the lamp of 7 W ?
Pierre
Both test's are ok, the max. current is low, so the fet's can handle that.
At.
 

I have accomplished the 2 tests :

First test :50 hz on 4-7 and 12-9
battery current without activity : 40 mA
When lighting lamp 7 W : 0.60 A
output : square wave

Second test : U11 connected
current battery when lighting : 0.66 A
output : also a square wave

Pierre
 

doc007 said:
First test :50 hz on 4-7 and 12-9
battery current without activity : 40 mA. When lighting lamp 7 W : 0.60 A
output : square wave

Second test : U11 connected. Current battery when lighting : 0.66 A
output : also a square wave

Pierre
Looks good, can you connect a second lamp parallel, so that you consume 14W, the trafo which is 12W can get a bit warm then, will the current go to 1,2 Amps?
Strange that U11 does not cause a pwm sinewave output, this needs more investigation.
Is the freq. 50Hz? Can you see a high freq. component in it (20kHz or more)?
At.
 

Hello At
I have the solution of my only 0.60A . My trafo is in reality a 2 x12 volts 12 W.

Therefore 1 x12V = 6W. This explain perhaps the only 0,6 A .

I will verify my output signal this afternoon
Pierre

Added after 4 hours 30 minutes:

Hi AT

The Frequenz of the square wave is 50Hz.

Periodically I see a high frequence during about 1/2 sec. It seems to draw a sine wave of 50 Hz centered on 0V

Pierre
 

Hello Friends,

I have not yet found the reason of the problem of my output ( square wave and not sine wave.)
I search in the soft and I have found an anomaly about a/b.
If I am wrong can you please answer to me.

After the init sequence in the main: PortC,3 seems to be low .
In the first interrupt we are going to pwm_start to make the first positive hemi-wave ( A ).Here is the first test from a.
For this measure, PortB,1 ( MUXB)is put low.
Therefore we have MUXB low and MUXA and C also low.In this conditions we are reading or pin 2 or pin 5 or pin 12 from MC 14053.In our case it is pin 2 ----> b . Therefore we are reading the b voltage and not the a ?????

Pierre
 

doc007 said:
I have not yet found the reason of the problem of my output ( square wave and not sine wave.)
Hallo Pierre,
Are you using an output filter (for the U11 generated signal), to restore 50Hz and get rid of the HF? Does your output look like the signal in the following article?
**broken link removed**
What went wrong with the earlier used Fet's, did you check that out?
I have not looked into the software until now. I was interested in your efforts to convert it to ASM.
Succes, At.
 

Hello At

Here is a very bad photo of my output with the output filter
 

Hello Taner

Your system is 12 volt DC to 230 Volt AC Inverter, but I need to build a 120 volt i/p DC to 230 Volt o/p AC sign wave inverter. In this regards please tell me what are the consideration I have to do in your existing system?

One more thing, please go through the sample code of your program below.

output_low(PIN_C3);
set_adc_channel(stdby_chan); // check vref value;
delay_us(10);
for(i=0; i<32; i++) {
volt_ref=read_adc();
volt_ref_temp+=volt_ref;
if(i==31) {
volt_ref_avg=volt_ref_temp>>8;
volt_ref_delta=volt_ref_avg-29;
volt_ref_temp=0;
}

You have taken 32 samples and to make average voltage the code should be
volt_ref_avg=volt_ref_temp>>5; but in your program I found volt_ref_avg=volt_ref_temp>>8;
I don’t understand the valid reason. Please explain.

Thanks and regards
Jags

Added after 21 minutes:

doc007 said:
Hello Friends,

I have not yet found the reason of the problem of my output ( square wave and not sine wave.)
I search in the soft and I have found an anomaly about a/b.
If I am wrong can you please answer to me.

After the init sequence in the main: PortC,3 seems to be low .
In the first interrupt we are going to pwm_start to make the first positive hemi-wave ( A ).Here is the first test from a.
For this measure, PortB,1 ( MUXB)is put low.
Therefore we have MUXB low and MUXA and C also low.In this conditions we are reading or pin 2 or pin 5 or pin 12 from MC 14053.In our case it is pin 2 ----> b . Therefore we are reading the b voltage and not the a ?????

Pierre


hi Pierrer,
You are absolutely right, and I would like to tell you that if you go through out the code this type of mistake you may found several places in the code.
Me also don,t understand.

jags
 

Hello Taner

Some mistake found in analog reading section of your code, these are listed below.

Schematic reference.
(PIC16F876A)
RC0 = #OE (# = BAR)
RC1 = #A/B
RC2 = PWM
RC2 = MUX_A
RB1 = MUX_B

AN0 = b/a
AN1 = Volt/Stdby
AN2 = curr_h/l
AN3 = V_BAT
AN4 = V_OUT

(MC14053)
A + C = MUX_A
B = MUX_B
X0 = curr_h
X1 = curr_l

Y0 = b
Y1 = a

Z0 = Volt
Z1 = Stdby

X = curr_h/l
Y = b/a
Z = Volt/Stdby

MOSFET

Q1 & Q5 junction = B
Q3 & Q7 junction = A


As per above reference I can draw the table below

MUX_B MUX_A Z Y X
0 0 Volt b curr_h
0 1 Stdby b curr_l
1 0 Volt a curr_h
1 1 Stdby a curr_l

MOSFET section

#A/B B A
0 PWM GND
1 GND PWM

Defination

#define ab_chan 0
#define stdby_chan 1
#define i_chan 2
#define acc_chan 3 // V_BAT
#define v_chan 4 // V_OUT


According to the above schematic reference I can make some comments as below.

Every where you read volt_a but the MUX switch for volt_b and vice versa.

Example:
Void sine_pwm_start(void)
{
……………
……………
output_high(PIN_C1); // #a/B = 1
output_low(PIN_C0);
output_low(PIN_B1); // MUX_B = 0 (switch for b)
set_adc_channel(ab_chan);
delay_us(10);
read_adc(ADC_START_ONLY);
delay_us(20);
volt_a=read_adc(ADC_READ_ONLY);//you read volt_a but MUX switch for b

}

If we swap the MUX pin Y0 & Y1 then the error will be fixed.

In case of curr_h & curr_l reading some where it is correct and some where wrong.
Correct area:
void sine_pwm_start(void) function
void sine_pwm_norm(void) function -> case 1: (positive sine half wave)
void sine_pwm_stdby(void) function -> case 2: (positive sine half wave)

Example:

Void sine_pwm_start(void)
{
……………
……………
output_high(PIN_C1); // #a/B = 1
output_low(PIN_C0);
output_low(PIN_B1); // MUX_B = 0 (switch for b)
……………
……………
output_low(PIN_C3); // MUX_A = 0 (switch for curr_h)
set_adc_channel(i_chan);
delay_us(10);
read_adc(ADC_START_ONLY);
delay_us(20);
curr_h=read_adc(ADC_READ_ONLY);// you read curr_h its OK


}



Incorrect area:
void sine_pwm_norm(void) function -> case 0: (negative sine half wave)
void sine_pwm_stop(void) function
void sine_pwm_stdby(void) function -> case 1: (negative sine half wave)

Example:

Void sine_pwm_stop(void)
{
……………
……………
output_low(PIN_C1); // #a/B = 0
output_low(PIN_C0);
output_high(PIN_B1); // MUX_B = 1 (switch for a)
set_adc_channel(ab_chan);
delay_us(10);
read_adc(ADC_START_ONLY);
delay_us(20);
volt_b=read_adc(ADC_READ_ONLY);// you read volt_B but MUX switch for A

……………
……………
output_low(PIN_C3); // MUX_A = 0 (switch for curr_h)

set_adc_channel(i_chan);
delay_us(10);
read_adc(ADC_START_ONLY);
delay_us(20);
curr_L=read_adc(ADC_READ_ONLY); // you read curr_L but MUX switch for curr_h


}

I don’t mean that you are wrong. Please explain me and let me quit from the confusion.

Added after 41 minutes:

Hello Taner

Please explain me the purpose of Curr_h & Curr_l terminal of the current sensing circuit.
In which condition should I check Curr_h instead of Curr_l and vice versa.
You have not connected any resistance across secondary of the current sensing transformer. But why??? This current sensing method is new for me. Please explain in details.

Thanks & regards
jagspaul
 
  • Like
Reactions: kabiru

    kabiru

    Points: 2
    Helpful Answer Positive Rating
Hi

I am more and more persuaded that my problem is soft and not hard.
In effect when my inverter is working ( led green light ) I have absolutly no modulation of the PWM.
Pierre
 

Hi Pierre
Did you connect oscilloscope at uC PWM out pin?? If not connect it when your inverter is running (giving output voltage) and take snap of the picture and send us.

jags
 

Jags said
[quote
Did you connect oscilloscope at uC PWM out pin?? If not connect it when your inverter is running (giving output voltage) and take snap of the picture and send us.
][/quote]

Yes
very bad photo PWM inverter runnig
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top