Arduino inverter

How do I make an Arduino inverter? I want an inverter that can take 12v-120v with a frequency of 60Hz, and pure sine wave. I really just need a code that can put out a 60Hz pure sine wave, and with feedback. I want it to be able to handle as much power as possible, 7000 watts would be all i need to power my house. If this isn't possible 3000 watts will do.

Any waveform you make with a digital device like an Arduino will not be a Pure Sine Wave.

Where is the 600A of 12V coming from?

The power source is a couple marine batteries from Walmart witch can put out 850 amps each. But this is not my main concern, I need to get a 60Hz pure sine wave first. I guess 600 amps is extreme, I can live with 3000 watts. I want to use an irfz44n and I can stack them if I need to.

for 7000 watts I'd say buy a real inverter....

I made an edit to my reply, and I'm making an inverter because I'm 13 and have no money to buy one, but I'm interested in them.

I think you need to understand the specs better, those batteries are likely 850 CCA, or cold cranking amps, the current that can be used for a starter motor for a very short duration. You need to look at the AH (ampere-hour) rating, which is an indication of the battery storage capacity. ampere-hour rating is roughly the amount of current that the battery can supply for one hour (generally the testing is done by measuring the current over a 10 hour discharge period at a current of 1/10 the AH rating, there will be more lost to inefficiencies over a shorter time period).

do you have the money to build one that will work for your specs ? it won't come cheap...

a link to your batteries would also be useful

of course don't even think of connecting this to your household main if it is connected to the grid

I know that and have decided to not do 600 amps.

yeah I know about the grid and you have to turn off the main breaker.

I also have some of the components like a large heatsink and large transformers.

You will certainly spend more money (and waste more in design and testing) than it would cost to buy several pre-built inverters. If the cost of the inverter is a problem, then you will never be able to afford the batteries needed to run the inverter for any length of time.

In most places, you are required to have an electrician install a transfer switch, just turning off the breaker is not sufficient (at least as far as doing it legally, and avoiding the possibility of electrocuting someone working on the power lines).

in many countries you need permission from the utility company and applying for grid interconnection. There is a fee for this and also possibly some other requirements (auto transfer switch, local red switch for emergency shutdown by firefighters, ...)

  1. I already have the batteries. 2. Were not gonna do anything with the grid T can manually connect it to a certain device. 3. If all I need is a transformer heatsink a few components, and the irfz44n's I think the price will not be that much.

In an internet search engine one could type the words "arduino inverter" and get quicker answers. Now it is just a matter of scale.

Describe your transformers, including the various windings and the actual weight of your biggest transformer that you want to use in the inverter.

The transformers I'm not sure about specs because I salvaged them from other devices. but I know they are 12-0-12 transformers and are a little smaller than a microwave transformer, but not as heavy.

Then you are all set for about 1 amp out of the primary when you drive the 12-0-12 with a sine wave at perhaps 3 amps. How many of these transformers do you intend to use? You will need to properly phase the output so as to combine the currents.

They were used in ups's that I got at a flea market. They were rated for 400 watts but the transformer looks 3x bigger than a normal 400 watt inverter transformers. I think the transformers could handle more current than they were being used for because the ups's were limited by space for other larger components. Oh yeah I have 2, and they are not identical.

The you will have to custom fit each circuit to match each transformer. Just two transformers will not give you near the watts you asked for.

So, 49A switching capability.

Are the 12-0-12 transformers like a center-tapped 24V transformer? How much current does a half-winding draw if you connect it to your 12V battery?

I think the first step is to generate a 60 Hz 'sine wave' with PWM and use two pins to alternate between grounding one half of the (now) 'primary' and the other half to get positive and negative half waves. I have a sketch for that. It uses a potentiometer on A0 to adjust the amplitude of the sine wave so you can tune the output voltage.

/*
  Demonstration of bipolar sine wave PWM
  Written by John Wasser

  Uses Timer1 for 16-bit PWM.
  Alternates between pulses on Pin 9 and Pin 10 to get positive and negative half cycles.

  50Hz gives you (F_CPU/50) clock cycles per cycle.  That's 320,000 on a 16 MHz UNO.
  You want as many pulses per cycle as possible but also the maximum TOP to get the
  best PWM resolution.  The maximum TOP is 65536 but that only gives you <5 PWM pulses.
  As you cut TOP in half, the number of pulses doubles. If we choose 256 pulses per cycle
  we get a TOP value of 1250 but since Phase Correct PWM counts both up and
  down the actual TOP has to be cut in half to get the right frequency.  Still, 625 levels
  of PWM is pretty good.
*/

const unsigned int LineFrequency = 60;
const unsigned int PulsesPerHalfCycle = 128;
const unsigned int TOP = (((F_CPU / 2) / LineFrequency) / (PulsesPerHalfCycle * 2)) - 1;

volatile uint16_t SineTable[PulsesPerHalfCycle]; // Sine values from 0 to TOP for the first PI radians

void FillSineTable(uint16_t scaleFactor)
{
  for (uint16_t i = 0; i < PulsesPerHalfCycle; i++)
  {
    float angle = (PI * i) / PulsesPerHalfCycle;
    noInterrupts();
    SineTable[i] = sin(angle) * scaleFactor;
    interrupts();
  }
}

void PWM16Begin()
{
  // Stop Timer/Counter1
  TCCR1A = 0;  // Timer/Counter1 Control Register A
  TCCR1B = 0;  // Timer/Counter1 Control Register B
  TCNT1 = 0;   // Reset the counter
  TIMSK1 = (1 << TOIE1);  // Timer/Counter1 Interrupt Mask Register: Enable Overflow Int.
  TIFR1 = 0;   // Timer/Counter1 Interrupt Flag Register
  ICR1 = TOP;
  OCR1A = 0;  // Default to 0% PWM on Pin 9
  OCR1B = 0;  // Default to 0% PWM on Pin 10
  digitalWrite(9, LOW);
  pinMode(9, OUTPUT);
  digitalWrite(10, LOW);
  pinMode(10, OUTPUT);

  // Set clock prescale to 1 for maximum PWM frequency
  TCCR1B |= (1 << CS10);

  // Set to Timer/Counter1 to Waveform Generation Mode 10:
  // Phase Correct PWM with TOP set by ICR1
  TCCR1A |= (1 << WGM11);
  TCCR1B |= (1 << WGM13);
}

// Overflow interrupt is triggered at BOTTOM and the Output Compare
// Registers (OCR1A and OCR1B) are buffered until TOP (the middle
// of the next pulse)
ISR(TIMER1_OVF_vect)
{
  static boolean positiveHalfCycle = true;
  static uint16_t pulseCount = 0;

  // Load both Compare registers, even though only one is active at a time.
  OCR1A = OCR1B = SineTable[pulseCount];

  pulseCount++;
  if (pulseCount >= PulsesPerHalfCycle)
  {
    // Half Cycle is Over.  Start the other half cycle
    pulseCount = 0;

    if (positiveHalfCycle)
    {
      // Positive Half Cycle just ended
      TCCR1A &= ~(1 << COM1A1);  // Turn off Pin 9 (OCR1A) PWM
      digitalWrite(9, LOW);
      TCCR1A |= (1 << COM1B1);  // Turn on Pin 10 (OCR1B) PWM
      positiveHalfCycle = false; // Starting negative half cycle
    }
    else
    {
      // Negative Half Cycle just ended
      TCCR1A &= ~(1 << COM1B1);  // Turn off Pin 10 (OCR1B) PWM
      digitalWrite(10, LOW);
      TCCR1A |= (1 << COM1A1);  // Turn on Pin 9 (OCR1A) PWM
      positiveHalfCycle = true; // Starting positive half cycle
    }
  }
}

void setup()
{
  Serial.begin(115200);
  while (!Serial && millis() < 5000) {} // Give USB up to 5 seconds to connect
  delay(200);  // Give Serial Monitor time to connect and reset the Arduino
  Serial.println();

  FillSineTable(0);  // Start with the amplitude set to 0

  PWM16Begin();  // Start the AC output on pins 9 and 10.

  Serial.print("LineFrequency = ");
  Serial.println(LineFrequency);
  Serial.print("PulsesPerHalfCycle = ");
  Serial.println(PulsesPerHalfCycle);
  Serial.print("TOP = ");
  Serial.println(TOP);
}

void loop()
{
  static uint16_t oldScaleFactor = 0;

  // Adjust PWM amplitude with an analog input.
  uint16_t scaleFactor = (TOP * analogRead(A0)) / 1024;

  if (scaleFactor != oldScaleFactor)
  {
    Serial.print("scaleFactor = ");
    Serial.println(scaleFactor);
    FillSineTable(scaleFactor);
    oldScaleFactor = scaleFactor;
    delay(100);
  }
}