We build an inverter for this purpose. The basic principle is that we need to build a circuit where the electricity flows one way and then back the other.
For a basic inverter, we start with a DC power source. Attach the high voltage end to two switches in parallel.
Connect the output of one switch to the top of a coil of wire. Connect the output of the other switch to the bottom of that coil of wire. Connect the center of that coil back to ground. That coil is an inductor.
Close – but not connected – to that coil is another coil. The paired coils form a transformer.
If you set the switches to opposite positions (one on, one off), every time you flip both switches, the current flowing through the coil will switch and you’ll get a corresponding current through the paired coil.
Since flipping both switches also switches the direction of the current, this is translated through our transformer to the far coil and we get something akin to a square wave on the other end of the transformer.
Since transistors are really just electronically controlled switches for our purposes, we can just attach them to a timing circuit to ensure they switch on schedule to produce AC at the other end.
If you’re not particularly concerned about power, you could also make a simpler circuit with a single transistor. You simply have it turn a DC voltage on and off at a timed interval – think of rapidly flicking a light on and off – and your steady DC voltage becomes an AC waveform (albeit one that you’d need to fiddle with quite a bit to get into the shape/power that you want).
Latest Answers