In this instructable you will be learning to make a DIY power inverter using a microcontroller. So go along to the next step and we'll get started.

Step 1: Materials

For this instructable the materials you will need are: A 9v battery, a 9v battery holder, a arduino or a Atmega 328 microcontroller(the chip for the arduino) with the arduino uno bootloader pre loaded, some wire and a computer. sorry no picture for this step my camera was not working.

Step 2: Build Your Circuit

In this step we will actually be building the circuit. So, First, we will connect the battery to the microcontroller. first, take the positive lead of the battery and connect it to the vcc or vin pin on the atmega. Then, take the negative lead and connect it to the ground or neutral pin on the atmega. You now have power to the chip. Next, connect your output. To do this take one wire and connect it to the D6 pin on the atmega. Next, take a wire from the ground pin to serve as a ground for your output. You can also connect these wires to a screw terminal but that is optional. A schematic for this step is included above.

Step 3: Program the Atmega

in this step we will code our chip to mimic the alternating current of AC current to the output pin.

step 1: plug your chip into your computer with the arduino or a programming board.

step 2: open the arduino software on your computer. software here-- direct download

step 3: copy this code into the software:

const int output = 6; //declares pin 6 as "output"

void setup(){

pinMode(output, OUTPUT); //tells the microcontroller that "output" is and output. }

void loop(){

delay(16.66666666666667); //waits 16.66666666666667 milliseconds

digitalWrite(output, HIGH); // turns on "output" delay(16.666666666666670; // waits another 16.66666666666667 milliseconds

digitalWrite(output, LOW); // turns off "output

} //loop repeates until stopped

step 4: upload the code to the chip.

Step 4: DONE!

you have just created a DC to AC inverter! congrats. now you can use this circuit on everything from EL wire to motors.

<p>Ummm... no. It's not inverter. It doesn't even create AC. If you connect it to the speaker, it might be used as beeper, but nothing more. For EL wire, beside of that it's not AC, the frequency and voltage are too low. For motors - Beside of not AC and voltage, output current of atmega is too low. <br>Oh, I've nearly missed it. Have you ever tried to build this?<br>If so, why haven't you written that you've burned your atmega?<br>And on the schematic, why are you showing that it's atmega328P, while code you're showing is for Arduino? Please, check everything you write twice, to not to make such stupid mistakes. Or learn more before posting anything to the internet.</p>
First of all, they did not say it provides outlet-level power, just AC. It doesn't have to be high power to be considered alternating current. You also clearly have no idea What you are talking about when it comes to motors. The atmega328 can provide 40mA on each of its output pins. I've seen motors driven with less than 400uA, so this can be 100 times more than enough depending on what kind of motor you want to drive. The one thing that IS blatantly incorrect about this circuit is attempting to power an atmega328 chip with 9V, which is extremely bad for it without a regulator, but you did not even mention this. Finally, please keep in mind that we try to be civil and helpful on Instructables, so if you are going to provide incorrect information please at least try to be nice about it.
<p>I'm trying to be nice all the time, but I can see, that you can't see the difference between changing current and alternating current. With this schematic, when you connect oscilloscope with current or voltage meter, you'll se +5V -&gt; 0V -&gt; +5V -&gt; 0V and so on. That's changing current, not alternating. It will be alternating, when the voltage would be +5V -&gt; 0V -&gt; -5V -&gt; 0V -&gt; +5V -&gt; 0V. You see the difference?<br>Cheers ;)</p>
<p>Feeding that output through a transformer will provide a true A/C voltage. It will not be a clean sine wave but it will be AC.</p>
Hmm, I've never tried feeding a square wave into a transformer. Assuming a near ideal transformer (little to no low pass filtration) the output should just be a pulse train, not really what we are looking for. A simple low pass filter would probably do the trick quite well.
<p>Are you making a joke? Why would it have to be 10V peak to peak instead of 5V to be alternating current? AC can be any voltage, it is still AC. If you are referring to the fact that the output is not centered around zero, in most applications it will not matter because since you are using a battery the ground can be floating anyway. If it really was an issue, just put a simple clamper circuit on the output.</p>
<p>But on the schematic there's no center point. I know that you could make 2.5V voltage and make it as AC zero, you know that too. But he doesn't know this, and probably still thinks, that when voltage is just switching is AC, but it's not. It's just switching voltage. You now understand what I'm talking about? I'm sorry about that little argue, but I hardly don't like when someone is misinformed and is showing this bad information to more people, making them misinformed. If someone is misinformed should inform himself before learning others the bad things.<br>Cheers</p>
<p>Again, feeding the output through a transformer will produce AC Current. Using a center tap secondary will give you your center point if you insist on it. If the windings ratio is the same, it will cut your voltage in half across either half of the secondary. You can assign any of the three terminals to ground depending on your need but most common is to connect the center tap to ground.</p>
<p>And just to be clear, you told that I've not mentioned about 9V put to atmega pins. I've did:<br>&quot;Oh, I've nearly missed it. Have you ever tried to build this?</p><p>If so, why haven't you written that you've burned your atmega?&quot;</p>
<p>lol right!</p>
<p>From the datasheet of Atmel Atmega 328 :</p><p> Operating Voltage:<br> 1.8 - 5.5V</p><p>So do not follow this instructables .</p><p>This is how NOT to write instructables .</p><p>Ignorance and stupidity at the maximum.</p><p>About the so call software copy paste work as usuall but does not resolve your brain Vinny Rubino .</p>
<p>also that delay doesn't work!(it works but the 0.6666666667 is pointless) + 9V kills your atmega ! try what you make before posting, don't post when you don't have enough knowledge ! </p><p>DON'T TRY THIS ! unless you want to kill a poor little atmega :(</p>
<p>what made you think thats inverter? its a pwm signal, not inverter....</p><p>pwm singal keeps turning on and off , where ac keeps changing + with -</p><p>ac is like : |+-| |-+| |+-| |-+||+-| |-+||+-| |-+||+-| |-+||+-| |-+||+-| |-+|</p><p>dc is like : |+-| | off | |+-| | off ||+-| | off ||+-| | off ||+-| | off |</p><p>these are really different , if you connect ac to a breadboard pin (not 220v 0_0) and connect 2 leds in diffrent directions both turn on !, if you connect pwm to the same place one led only blinks or gets dim (depending on frequency</p>
Also, delay() converts your float value into an integer (long).

About This Instructable




More by vinny rubino:DIY AC to DC power inverter 
Add instructable to: