An Arduino power inverter


If you’ve got a few solar panels lying around, or even if you want some 120/230 V AC power from a few 12 Volt batteries, you’ll need a power inverter. Sure, you can drop on down to any big box store and pick one of these up, or you can be like [Michael] and build your own (Danish, translation).

[Michael] found himself in the possession of a few halogen light transformers and decided to make use of them by building a DC to AC power inverter. The inverter is fairly simple – just the transformer, a few MOSFETS, and an ATMega0168 for software control that includes a ‘soft start’ feature that prevents power surges on startup.

The circuit is simple enough to etch at home, although a soldermask and a nice insulated enclosure would probably be ideal for this application.

29 thoughts on “An Arduino power inverter

      1. Nevermind the author of your linked circuit admits that it “can be tricky to get going”. The fact that the recommended tantalum caps cost as much as, or more than a MCU. The tendency of any cheaper substitution to explode due to the high currents required to drive the bipolar transistor bases. Lower efficiency and more heat. And complexity goes way up if you want to add any additional features. How exactly would you propose adding the soft start that [Michael]‘s circuit includes, hmm?

        Face it, it’s the 21st century. You might as well be ranting that it doesn’t use vacuum tubes. If you prefer to avoid MCUs, a cheap SG3524 or such should do nicely, without being archaic.

        1. I didn’t find it any difficult to get running, and it’s just an example of an astable multivibrator. It can be changed to work with MOSFETs just the same with the addition of two resistors and a bit of re-calculation. No need for tantalum caps then.

          I don’t see the point of the soft start feature unless you’re running from a really tiny battery or trying to use a massive transformer (not the case here), so the MCU is little more than a fancy square wave signal generator.

          It’s not about the price of the parts, but having a simple, elegant and beautiful solution instead of slapping a microprocessor, or some specialized IC where one isn’t needed. That makes the circuit repairable in the absence of a source for these special parts, like, if your inverter breaks down in the middle of nowhere on your camping trip.

          That’s a feature you don’t get with a microcontroller.

          1. You do have a good point about specialized parts. I prefer to avoid them also. If I can do something fairly easily with discretes, and maybe a “jellybean” IC or two like the LM324 or LM339, then that’s what I’ll use. They’re common and useful, plus cheap enough to stock plenty of extras on hand for new projects or repairs.

            But I no longer consider MCUs a specialized part. In fact they’re probably the least so. Even cheap MCUs can now replace a huge list of special purpose ICs, and often multiple ones simultaneously. Stocking extras of these is possible as well.

            Assuming you’re away from your stash of parts, like in your camping trip scenario, I’m not sure it would be that much easier to find a replacement power NPN than an MCU. Radio Shack maybe, though I find them regularly lacking in basic parts like these. And if there was one nearby, I’d just “rent” an inverter from them, enjoy the camping trip, and return the inverter later. ;)

          2. You can find large transistors from things like car radios, old computers, etc. junk laying about because the specs aren’t that critical. The first time I built the circuit was out of old AT power supplies from a trash heap.

            The problem with MCUs is that it’s not enough to have the right part at hand, you also need a compatible computer and a programmer, the right software and the correct program before you can swap the part. Do you know ten years from now that you still have those things readily available?

    1. Is that actually necessary in this case? Sure, the body diodes aren’t terribly efficient. But I though external diodes are only required for high-speed switching, to avoid shoot-through in H-bridges and such due to the body diodes’ slow recovery; which certainly isn’t an issue at 60hz.

  1. Since he has the micro in their already, I wonder why he didn’t go for a true sine wave PWM output to drive the MOSFETs?

    1. I’m curious: what exactly does sine wave output get you? AC motors, but otherwise I can’t figure out what would care.

      1. There are a lot of inductive loads out there, and feeding them a square wave is ill-advised. It can end up overheating transformers too. It’s just not a great idea in general.

      2. Not to mention its easier to deal with EMI with sinewave outputs.

        Capacitive loads will also drain excessive amounts of current with square waves like that.

        With the processing power of the microcontroller on it, why NOT have sinewave outputs?

          1. Is it really not fast enough to provide sines from an LUT? Or if you’re obsessive you could probably just hardcode the values if you have a constant frequency.

      3. Mostly EMI purposes…also with iron transformers there will probably be audible noise from the harmonics of the square wave…

        And it’s been said before, if the MCU is already there, why not utilize it’s full potential? ;-)

      4. Code Red – True sine wave inverters use a transformer that is specifically designed for higher frequencies. This transformer is designed for 50 / 60 Hz and is not suitable for a true sine wave output.

        RJ – Fallen – This transformer is normally designed for 12V 4 Amp output, or about 48 Watt (VA). given that the original primary has to provide power for both the output AND the transformer losses then reversing the transform would reduce it’s possible power conversion. To be safe I wouldn’t expect more than 35 Watts in this configuration. Most loads below 35 Watts are not inductive. Loads that require a sine output are normally large loads like fridge compressors.

        AnarKIT – AKA – Higher frequencies (EMI) are most often the result of smaller transformers designed for use with Switch Mode Power Supplies that have a lower flux density and higher flux saturation point. This transformer will be coming much closer to flux saturation at much higher flux densities. Flux can’t go from zero to saturation instantly in the same way your car can’t go from 0 to 100 Km/h in zero seconds. So while the input to the transformer may be a square wave, the higher frequencies will be strongly attenuated resulting in an output that is no closer to a square wave than it is to a sine and with minimal EMI.

        The limit to potential here is that a 50 / 60 Hz transformer is being reversed. Given the expected loss on the transformers energy transference and the resulting reduction in power expectation, I think this is an excellent circuit using ‘off the shelf’ cheep components.

        1. I don’t understand the answer you give to Code Red: what if we put and LC filter before the trransformer to get rid of the pwm harmoinics and feed an almost clean sine wave to the transformer? I bet this would be better than the current scheme in terms of shape and current waveform going through the panel.

          1. I am really rusty on transformer theory so can someone please correct me were I am wrong.

            Problem number 1 with a LC filter is that (if you do the math) you will need a very large non-polar capacitor which defeats the cost implications of this unit as well as taking up a lot of space. This is assuming you use the primary as the L (inductor).

            Some transformers have an extra winding that is in parallel with a capacitor which is like an active LC filter.

            From memory these transformers are a bifilar wound transformer with flux shunt and a long core.

            The flux shunt weakens the magnetic coupling between the primary and secondary so that variations in secondary load current don’t impact as much on the primary. While this might sound like a good idea for an inductive load (which is why you want sine) it achieves the coupling reduction by converting the irregularities to heat. So with an inductive load on this type of transformer it is likely to cook. (overheat).

            The reason for the (magnetic) flux shunt is that this transformer has a low turns per volt ratio which means less copper and less cost and of course less efficiency especially at higher frequencies.

            So as an answer, yes you could use a LC filter or even drive PWM directly into the transformer but to do so without overheating problems with this type of transformer you load limit would drop to about 5 Watts to perhaps 10 Watts at most. LC filters also have problems with load variations.

            It is simply the wrong type of transformer for a sine inverter.

          2. PS: I have seen the more modern halogen light transformers that are actually a Switch Mode Power Supply. They may may be a good starting point for sine inverter.

  2. I wonder what the max. output is. Given that the IRF’s are rated at 14A max, driving 12V which is 168W. At the 220AC side given 168VA, you will not even get one ampere out of it. Is that correct? Or am I missing something? Besides that if you are going to run 14A through PCB traces, the width should be enormous (+- 15mm)? Is it even possible to design a decent inverter, for example 500W or 1000W with this kind of schematic? I think the cost for all the components would be enormous? Although I do like the simplicity of the desing.

  3. If you look at the schematics he is at least using the serial port for programming which means he has a bootloader in there, he is also calling it an Arduino in the description so i guess it is one.

  4. I hope no one tries to connect that to the grid, I was shocked until I realized it was meant for islanded operation. I’d try to do PWM using a timer from the microcontroller (the default 400hz pwm is probably too low) and I believe it would be good to have an inductor in series somewhere to avoid damaging the solar panel too much (LC before the transformer would be a good idea if properly tuned).j

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s