program for three phase inverter

i purchase ardunio 2560 .i want to program on three phase voltage source inverter for 180 degree conduction mode.

(deleted)

.i want to program on three phase voltage source inverter for 180 degree conduction mode.

Permission granted.

ardunio 2560 programing for three phase voltage source inverter using 180 conduction mode.provide the program

(deleted)

Heh, heh.

Not getting too favourable a reception perhaps?

The deal is - you do the “leg-work”, and if there are little problems along the way and you can explain why there are problems, then we can offer suggestions as to how to overcome these.

Now, if someone has written a sketch for what you are looking, then you need to find it using firstly - since you propose to use an Arduino - the search function on the top right of this page (15 hits at this point in time for “three phase inverter” other than your own posting). Failing that, the magic Google.

And failing that - as may well be the case - then you need on the one hand, to start running example “sketches” on your Mega 2560, practice modifying them in order to get different results in the form you predict from such modifications and start writing your own sketches.

And on the other hand given that you know what a three phase inverter does, you then need to sit down and prepare a specification for the driver signals required as well as the monitoring and safety circuits and design the interface between Arduino ports which can supply no more than 20 mA at approximately 5V logic levels and your drivers (and protective circuits).

Then, given that you have developed some skill in writing the “sketches”, you can write one to your specification and test it out (probably using some LEDs and a mechanical stroboscope or an oscilloscope) at which point it might be appropriate to post that putative code here - in full and using the “code” mark-up - for review.

At that point you will probably want to have built your inverter circuitry and obtained an Arduino Pro Mini to use instead of the Mega 2560 in the final implementation.

ardunio 2560 three phase pwm program

rksharmabits:
ardunio 2560 three phase pwm program

Use a “for (x = 0; x < 360; x++)” loop, do "sin (x-120), sin (x), sin(x+120), convert x from radians to degrees, then use the resultant three values (appropriately scaled) to either control 3 PWM outputs (for a slow pseudo sine wave output) or a digital output for on/off signals, each 120 degrees apart (i.e. 3 phase).

You have to try to write some code. The above is just the concept.

pwm and 3 phase are incompatible. I assume you want a 3 phase 60/50 hz inverter. Since the Arduino has no DAC's, you cannot generate an AC voltage. You can use pwm to generate a DC voltage, but AC is a bit trickier.

YOu might want to get 3 DDS's to generate your signals.

KeithRB: pwm and 3 phase are incompatible. I assume you want a 3 phase 60/50 hz inverter. Since the Arduino has no DAC's, you cannot generate an AC voltage. You can use pwm to generate a DC voltage, but AC is a bit trickier.

YOu might want to get 3 DDS's to generate your signals.

Why would you say that?

PWM can generate a nice sine waveform, and by doing three 120 degrees apart, you have 3 phase motor drive.

I've already done exactly this with 3 pwm outputs, 3 power MOSFETS and a 3 phase hard drive spindle motor.

The OP never mentioned anything about "AC" or "DC", nor did he mention voltage or frequency.

And, using some Cirrus/Apex power op amps, you could easily generate 3 phase, 60 hz, 120/208 power. Of course, you would need to skip some steps in the sine loop and not use "analogWrite", but it can be done.

Lastly... thanks for the laugh! The OP should use a DDS that probably costs upwards of $10,000 USD with an Arduino! :)

KeithRB:
pwm and 3 phase are incompatible.

Absolutely they are… Google “Sinusoidal PWM”. How else do inverters work.

Not with the standard pwm command.

Inverters work a bunch of ways, including DACs and plain vanilla analog oscillators.

But yes, I should have been more nuanced in my answer.

Do you really need sine waves? Some inverters use square waves (although some loads are unhappy with that).

I'm working on a single-phase inverter. It uses T2 to drive an ISR to output the steps of a sine table as PWM to alternate phases.

I don't see any reason you couldn't adapt the same approach to three-phase.

polypagan: Do you really need sine waves? Some inverters use square waves (although some loads are unhappy with that).

That's an interesting question.

Motors, being inductive, probably do not mind squate waves too much though most people woudl presume otherwise. They will of course, buzz loudly.

A capacitive load - that will be a problem.

The big problem with a square wave inverter is - what is the Voltage? Different types of load "see" different voltages.

Here are some scraps of (unfinished) code from my DC-AC Inverter (single-phase).

from setup()

  // Constants ripped from FrequencyTimer2 library.  Thanks!
  // disable timer overflow ISR
  TIMSK2 &= ~_BV(OCIE2A);  // clear OCIE2A interrupt mask
  TCCR2A = 0x42;
  TCCR2B = 0x03;
  OCR2A = 0x40;  // was 0x81;
  TCNT2 = 0;
  ASSR &= ~_BV(AS2);

The sine table:

// full cycle of 59.9 Hz = 16.6944908 msec.
// half cycle = 8.347245409 msec.
// divide each half cycle into NSTEPS parts
// #define NSTEPS 32
// #define DELAY 260    /* step time is 260 microseconds for rate of 60.096
// next multiple of 4, 264 => 59.1856 Hz

#define NSTEPS 32
const unsigned char sineTable[NSTEPS] = { 
  0, 22, 48, 70, 95, 120, 139, 161, 181, 196, 212, 223, 235, 244, 250, 254,
  254, 250, 244, 235, 223, 212, 196, 181, 161, 139, 120, 95, 70, 48, 22, 0 };

The ISR does PWM on pins 5 or 6 (alternating):

// these variables may NOT need to be declared volatile unless used outside of ISR
// currently they are only accessed for debuggery
// it might prove wise to set them when the ISR is disabled or before re-enabling.
volatile char index;  // table index
volatile char PWMpin=5;  // which phase are we doing?
const char mask=NSTEPS-1;  // NSTEPS must be a power of two!
/* For clarity,
 *
 * if it were not important to get in and out
 * of the ISR quickly, it would be written like this.
 *
 * analogWrite(PWMpin,sineTable[++index&=mask]);
 * if(index == 0) {
 *  if(PWMpin == 5) PWMpin = 6;
 *  else PWMpin = 5;
 *  }
 */

ISR(TIMER2_COMPA_vect) {
  index++;
  index &= mask;       // use %= if is NSTEPS is not a power of 2
  analogWrite(PWMpin,sineTable[index]);
  if(index==0) {            // zero-crossing reached?
    toggle13();    // testing only!
    PWMpin ^= 3;            // tricky: 5 ^ 3 = 6, 6 ^ 3 = 5
//    digitalWrite(13,OFF);   // testing only!
  }

}

// mask/unmask interrupt
inline void Ienable() { 
  TIMSK2 |= _BV(OCIE2A); 
}
inline void Idisable() { 
  TIMSK2 &= ~_BV(OCIE2A); 
}

The rest is housekeeping: Is the switch on? What's the temperature of the power transistors? Need fan? Too hot? Shutdown? Is the battery voltage too high or low? Stuff like that.

Of course the PWM outputs are low-pass filtered and used to drive linear power transistors, each of which sinks current through half of a center-tapped transformer (designed as the secondary, although it's the primary here), with the center tap (fused) to the battery positive terminal. The secondary outputs the voltage rating of the transformer "primary", so long as the "secondary" is rated for, say 25.2V or so.

There's no regulation, so as the battery voltage sags and boosts, the output will vary as well. Most loads are pretty forgiving, within limits.

I have a bit more testing to do on this. I'll post a sketch in the appropriate section when I get it working.

PWMpin ^= 3;

That is an interesting way of doing it. Nothing wrong, but another way would simply be:

PWMpin = 11-PWMpin; //11-6 = 5, 11-5=6

Also, if you are going to the trouble of setting up the registers for PWM yourself, you might as well save a lot of time in the ISR by ditching analogWrite() and directly writing to the PWM registers.

Finally, this would be more advisable:

  TIMSK2 &= ~_BV(OCIE2A);  // clear OCIE2A interrupt mask
  TCCR2A =_BV(COM2A0) | _BV(WGM21);
  TCCR2B = _BV(CS21) | _BV(CS20);
  OCR2A = 0x40;  // was 0x81;
  TCNT2 = 0;
  ASSR = 0;

It is functionally the same, but far easier to read if you need to change it later.

polypagan: Of course the PWM outputs are low-pass filtered and used to drive linear power transistors, each of which sinks current through half of a center-tapped transformer (designed as the secondary, although it's the primary here), with the center tap (fused) to the battery positive terminal. The secondary outputs the voltage rating of the transformer "primary", so long as the "secondary" is rated for, say 25.2V or so.

Not entirely advisable, but as long as you go for a transformer rated for higher than you are using by at least a few %, you should be fine.

Good points, Tom Carpenter!

Both about the symbolic defines for Timer2 registers and (I think) transformer rating. My hunch is that as long as the fuse on the CT is small enough to protect the transformer I won't have problems. Since (if I ever actually build this) it will be for my 30W solar power system, I don't think it'll be tough to find a beefy enough transformer... although I have been a bit disappointed at what's available for a decent price!

As you can see, although I've been having fun with this inverter project, it is quite impractical given the price of commercial inverters! By the time you add up the Arduino (Pro Mini ~$5), transformer, power transistors, heatsinks, fan, circuit board, you're way out of the ballpark for a low-power inverter.

I did, however have the idea of combining my datalogger code (written for Uno with Adafruit datalogger shield) with a Charge Controller sketch I'm working on. The DC-AC inverter code would fit on an ATtiny85 (without the housekeeping, just one digital go/no-go input, which could be reset...) slave. There might even be horsepower left over for a panel positioner/sun-follower!

Cheers!