DIY AC to DC Power Inverter
Intro: DIY AC to DC Power Inverter
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.
15 Comments
MarusI 6 years ago
On set LOW status for any digital pins is 0V (GND)..
For AC:
#define F_PIN 2
#define N_PIN 3
void setup() {
}
void loop() { // called every 50 times per second
digitalWrite(F_PIN,LOW);
ditigalWrite(N_PIN,HIGH);
delay(10);
digitalWrite(F_PIN,HIGH);
ditigalWrite(N_PIN,LOW);
delay(10);
}
And, for good square, use capacitors or analog semnal from Arduino.
domints 9 years ago
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.
Oh, I've nearly missed it. Have you ever tried to build this?
If so, why haven't you written that you've burned your atmega?
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.
kag432 9 years ago
domints 9 years ago
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 -> 0V -> +5V -> 0V and so on. That's changing current, not alternating. It will be alternating, when the voltage would be +5V -> 0V -> -5V -> 0V -> +5V -> 0V. You see the difference?
Cheers ;)
GaryDKlein 8 years ago
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.
kag432 8 years ago
kag432 9 years ago
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.
domints 9 years ago
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.
Cheers
GaryDKlein 8 years ago
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.
domints 9 years ago
And just to be clear, you told that I've not mentioned about 9V put to atmega pins. I've did:
"Oh, I've nearly missed it. Have you ever tried to build this?
If so, why haven't you written that you've burned your atmega?"
kamhagh 9 years ago
lol right!
DanutZ2 9 years ago
From the datasheet of Atmel Atmega 328 :
Operating Voltage:
1.8 - 5.5V
So do not follow this instructables .
This is how NOT to write instructables .
Ignorance and stupidity at the maximum.
About the so call software copy paste work as usuall but does not resolve your brain Vinny Rubino .
kamhagh 9 years ago
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 !
DON'T TRY THIS ! unless you want to kill a poor little atmega :(
kamhagh 9 years ago
what made you think thats inverter? its a pwm signal, not inverter....
pwm singal keeps turning on and off , where ac keeps changing + with -
ac is like : |+-| |-+| |+-| |-+||+-| |-+||+-| |-+||+-| |-+||+-| |-+||+-| |-+|
dc is like : |+-| | off | |+-| | off ||+-| | off ||+-| | off ||+-| | off |
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
meidel 9 years ago