sine wave inverter feedback.

Thread Starter

T.A

Joined Dec 22, 2016
40
Hello guys

I have been been working on designing a sine wave inverter using PIC16F887 microcontroller using fullbridge configuration.. The part of the design that seems stressful is implementing feedback in the code.

please i need explanations on how to go about it.

This is an excerpt of the sine wave table.
This is what happens;

The table is a two dimensional array; sinearray[row][column].
The row index ranges from 0 - 6 and the column index ranges from 0-49.

when the value of the row index is between 0-3, the sine wave and the frequency is okay but when the row index start approaching 4 -6,
the sine wave becomes distorted and the frequency is drastically reduced.

what can i do about this, any suggestion or an alternative approach ?
 

Thread Starter

T.A

Joined Dec 22, 2016
40
The code is a bit long. just not to bore you with it, i decided to extract the sine wave table. Is there any other part you want me to show you ? or i should just post the whole code here ?
 

ErnieM

Joined Apr 24, 2011
8,171
You might tell us why you have a two dimensional array to hold what is normally held in a one dimension array.

You might tell us what you do with this data. Code, flowchart, hardware, all can play a part.

As is, I would guess you bought the wrong color resistors. You have yellow ones and you should use the blue ones.
 

Thread Starter

T.A

Joined Dec 22, 2016
40
Thanks for your reply.

ok, let me explain better.

i have implemented the design on the veroboard
i used a tranformer 7v-240v
i used a battery of 12vdc, it gave an output of 300v, i scope it, it gave a good sine wave.

without the feedback, the inverter works well, but when the feedback is introduced, the wave becomes distorted

The same problem about the feedback that persists on the software design is the same problem that is appearing on the hard ware.

so i believe if i can get it right on the software design, the hardware design wont give any problem again.

i guess i should post the source code.
 

Thread Starter

T.A

Joined Dec 22, 2016
40
i also notice

if i did something like :
CCPR1L = sinearray[5][dutycycle] ; i get a good wave

if i do something like :
unsigned char index1 = 5;
CCPR1L = sinearray[index1][dutycycle] ; i get a distorted wave

why ????
 

tcmtech

Joined Nov 4, 2013
2,867
If its distorting the waveform then obviously its not proportionally adjusting the PWM duty cycle across the whole sine wave cycle.
 

MrChips

Joined Oct 2, 2009
23,962
i also notice

if i did something like :
CCPR1L = sinearray[5][dutycycle] ; i get a good wave

if i do something like :
unsigned char index1 = 5;
CCPR1L = sinearray[index1][dutycycle] ; i get a distorted wave

why ????
Can you view the disassembled output and see the difference?
 

BobTPH

Joined Jun 5, 2013
3,507
I am going to make some assumptions. You are using different rows in your 2-D table depending on feedback of the amplitude of the output in order to stabilize it under changing load.

A possible source of distortion would be if the index for the row is changing in the middle of the cycle. It should be restricted to the same row for each cycle and changed only when the next cycle starts.

Bob
 

Thread Starter

T.A

Joined Dec 22, 2016
40
Trying to view the diassembly output, but getting no source code at address 0x135.
why ???
 

tcmtech

Joined Nov 4, 2013
2,867
Fair chance you may not get any being most of us here have no idea why you are trying to do what you want the way you want.

Questionable coding and design approach on your parts does not improve answers on our part.
 

Thread Starter

T.A

Joined Dec 22, 2016
40
Fair chance you may not get any being most of us here have no idea why you are trying to do what you want the way you want.

Questionable coding and design approach on your parts does not improve answers on our part.
Thanks. I will be glad if you can give me a better coding approach. if you know better, kindly share your experience with me.
i wrote the code all by my self from the scratch, i have never designed a sine wave inverter before.
you can discard my code and let me see yours, study it and make corrections on mine.
i believe this is what forum like this is about.
 

tcmtech

Joined Nov 4, 2013
2,867
Sorry but not my area. I don't do microcontroller work or coding other than industrial PLC work and even that's rare these days.

As for building a sine wave inverter I use off the shelf prebuilt output driver boards that can be had from Amazon or eBay for way less than I could make my own for.

https://www.amazon.com/Yosoo-inverter-driver-EGS002-EG8010/dp/B00ZR1U2UK

~$20 here but I picked up some on ebay for less than half that when I wanted to try refitting an old cheap power inverter over into a sine wave output one.
 

Thread Starter

T.A

Joined Dec 22, 2016
40
Thanks for your replies.
I have rearranged and modified the code.
The feedback is working properly but there is an issue.
Any time i load it small load like table lamp, small fan , the output wave and voltage is good, but when i use larger loads, like soldering iron, laptop, the output voltage becomes attenuated and distorted. what can I do ?
 
Top