DIY : DON’T Make Your Own Square Wave Inverter – Hackster Blog
After many comments requesting that he make an inverter to transform DC power to an AC output, YouTuber GreatScott! has finally relented and constructed one. As he notes early in the video, he doesn’t think this is a good idea, but built it for educational purposes.
Upon some preliminary research, he decided to use a pair of n-channel and p-channel MOSFETs in an H-bridge configuration for his circuit. This allows him to turn a DC input into AC output by selecting which MOSFETs are switched on. For control, he used an Arduino Nano board, running a program that simply loops through three functions: all off, current flow in one direction, then current flow in the other. It then repeats the cycle, approximating a sine wave with these current flows, as well as pauses in between, values for which are measured off of a store-bought unit.
While he was able to get an efficiency upwards of 80% with this device, it also required a few diodes and a capacitor to be added to account for voltage spikes, and even with that the output varies depending on the load. His suggestion is that if you need an inverter, you simply buy one, as this type of circuit can work poorly and even be dangerous if not made properly!