Go Down

### Topic: ARDUINO AS GRID TIE INVERTER (Read 2723 times)previous topic - next topic

#### kikiloaw

##### Dec 18, 2016, 03:49 pmLast Edit: Jul 22, 2018, 03:34 am by kikiloaw
I PLANED TO MAKE AN SOLAR GRID TIE INVERTER
BUT THE PROBLEM IS THAT I DONT KNOW HOW TO SYNC IN PHASE THE SINE WAVE TO THE GRID.
THIS CODE PRODUCES SINE WAVE.
ANYONE CAN HELP ME?

Code: [Select]
`#include <avr/io.h>#include <avr/interrupt.h>#define SinDivisions (200)// Sub divisions of sisusoidal wave.static int microMHz = 16; // Micro clock frequencystatic int freq = 60;     // Sinusoidal frequencystatic long int period;   // Period of PWM in clock cycles.static unsigned int lookUp[SinDivisions];static char theTCCR1A = 0b10000010; //varible for TCCR1Avoid setup(){  double temp; //Double varible for <math.h> functions.    period = microMHz*1e6/freq/SinDivisions;// Period of PWM in clock cycles    for(int i = 0; i < SinDivisions/2; i++){ // Generating the look up table.    temp = sin(i*2*M_PI/SinDivisions)*period;    lookUp[i] = (int)(temp+2);       // Round to integer.      }  // Register initilisation, see datasheet for more detail.  TCCR1A = theTCCR1A; // 0b10000010;        /*10 clear on match, set at BOTTOM for compA.          00 compB disconected initially, toggled later to clear on match, set at BOTTOM.          00          10 WGM1 1:0 for waveform 15.        */  TCCR1B = 0b01112001;        /*000          11 WGM1 3:2 for waveform 15.          001 no prescale on the counter.        */  TIMSK1 = 0b10101001;        /*0000000          1 TOV1 Flag interrupt enable.        */    ICR1   = period;   /* Period for 16MHz crystal, for a switching frequency of 100KHz for 200 subdivisions per 50Hz sin wave cycle. */  sei();             // Enable global interrupts.  // Set outputs pins.  DDRB = 0b00010110; // Set PB1 and PB2 as outputs.  pinMode(13, OUTPUT);}void loop(){;/*Do nothing . . . forever*/}ISR(TIMER1_OVF_vect){    static int num;    static int delay1;    static char trig;        if(delay1 == 1){/*delay by one period because the high time loaded into OCR1A:B values are buffered but can be disconnected immediately by TCCR1A. */      theTCCR1A ^= 0b10100000;// Toggle connect and disconnect of compare output A and B.      delay1 = 0;             // Reset delay1    } else if(num >= SinDivisions/2){      num = 0;                // Reset num      delay1++;      digitalWrite(13,trig);    }    // change duty-cycle every period.    OCR1A = OCR1B = lookUp[num];    num++;}`

#### Robin2

#1
##### Dec 18, 2016, 04:41 pmLast Edit: Dec 18, 2016, 06:19 pm by Robin2
I think you should ask your electricity utility. I suspect they will say NO WAY

Connecting a solar system to the grid risks electrocuting the utility staff.

IMHO if you have to ask on this Forum then you do not have the required level of competence to build a grid-tie system

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

#### jremington

#2
##### Dec 18, 2016, 05:08 pmLast Edit: Dec 18, 2016, 06:42 pm by jremington
Not to worry. The OP is likely to electrocute him or herself before this project could get as far as endangering power line workers.

#### Robin2

#3
##### Dec 18, 2016, 08:23 pm
And I presume it is seriously illegal to connect generating equipment to the grid without the prior approval of the utility.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

#### MarkT

#4
##### Dec 18, 2016, 08:54 pm
This is a complete no-go area for amateur construction, the risks are to life and limb.

However as a thought exercise its OK - for instance how do you ensure a electricity supply worker can't be
electrocuted by the inverter when they are fixing the circuit on your road?  How does one detect this situation?

Commercial units have to pass rigorous safety analysis and testing as back-feeding onto a tripped distribution
line is potentially a killer to the employee fixing the fault, and brown-outs can start fires in motors.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### kikiloaw

#5
##### Dec 19, 2016, 10:41 am
i have already a way to detect the main grid absence.,
the only problem i only have is syncing to the grid in phase

#### mauried

#6
##### Dec 19, 2016, 11:08 am
Whats your method of detecting main grid absence?
I suspect that you really arnt thinking this through.
How are you implementing anti islanding?
Wheres the rest of your circuit?

#### jackrae

#7
##### Dec 19, 2016, 02:28 pm
You don't state which country you intend blacking out but if you want to see what's required in the UK you might care to spend a couple of minutes browsing this

#### kikiloaw

#8
##### Dec 24, 2016, 07:11 amLast Edit: Dec 24, 2016, 08:04 am by kikiloaw
sorry to bother you guys., since theres a problem  implementing anti islanding..

i had seen tim nolans grid tie inver., but i want you to help me to modify the circuit to high wattage instead making my own.,,

#### jremington

#9
##### Dec 24, 2016, 07:33 amLast Edit: Dec 24, 2016, 07:35 am by jremington
Quote
i want you to modify the circuit to high wattage instead making my own.
Surely you are joking.

#### TomGeorge

#10
##### Dec 24, 2016, 09:15 am
HI,
What is the advantage of your own grid-tie inverter if the power utility is not going to pay you for power put into the grid?
As previously indicated, there are regulations and build standards and approvals needed to connect anything to the grid.

Can you tell us your electronics, programming, arduino, hardware experience?

Tom...
Everything runs on smoke, let the smoke out, it stops running....

#### kikiloaw

#11
##### Dec 26, 2016, 05:18 pm
hi tom
i am not planning to  build it my own since there many things to consider., and my knowledge is not that good either

i have personally sent you a message.,
can you take a look.?

#### Paul_KD7HB

#12
##### Dec 26, 2016, 05:39 pm
hi tom
i am not planning to  build it my own since there many things to consider., and my knowledge is not that good either

i have personally sent you a message.,
can you take a look.?
curious what the message said!

Paul

#### jremington

#13
##### Dec 26, 2016, 07:44 pm
Quote
i am not planning to  build it my own since there many things to consider., and my knowledge is not that good either
Why are you bothering us, then?

Go Up