Electronic – arduino – Sin signal from PWM

arduinocurrentfilterpwmsignal

  • I wrote a program in order to use Pulse Width Modulation to simulate a sinusoidal signal.

  • Added a low pass filter to get rid of the noise and the traces of it being a discrete signal.

  • Added a half wave rectifier in order to delete the negative part of the signal, however it only deleted 20% of it instead of the intended 50%.

Questions:

  1. Why is this happening, how do I get rid of the other 30%? Does it have something to do with the high frequency of the PWM?

  2. What could I do to increase the output AC voltage from 3V to 10V or 100V? (I do know voltage multipliers) but I'm looking for another way.

  3. Can this be used to power up circuits without damaging them?

  4. How can I add 10A of current to my final AC output?

enter image description here

enter image description here

Best Answer

To answer all your questions:

  1. See the explanation by @JonRB, in short saying: You are making a wave going from 0V to 3V with the arduino, because the arduino does not possess a negative rail to work with. So you need to make the signal relative to a ground, in stead of its current DC offset of about 1.5V

How do you do that?

You can do two things:

  1. A: You can generate a virtual ground, at about 1.5V and relate all your measurements to that and have your diode conduct into a resistor connected to that virtual ground to make it act as a rectifier. Note, however that you'll still lose about 0.7V off the signal, because that's the voltage the diode drops, or "needs to work".
  2. B: You can decouple the DC away from the signal with a capacitor:

schematic

simulate this circuit – Schematic created using CircuitLab

The resistor is there to pull the capacitor on the other side to a DC level of ground. The capacitor doesn't allow DC voltages to impose anything on the other side, but to a moving signal it becomes a frequency-dependant impedance. Note, that this will dampen lower frequencies, because the impedance of the capacitor is higher at lower frequencies. The larger your capacitor is the better lesser it will inhibit lower frequencies, so if you can get 10uF or 47uF. If you want 50Hz to be the lower limit (for audible for example) the drawn values will easily suffice.

  1. You need an amplifier for that. For such large increases you should look into audio amplifiers or power amplifier design manuals. But I'd advice the latter only if you have a very firm grasp of signals, frequencies, transistors, op-amps, capacitors and inductors. Alternatively you could increase the voltage you are switching with your PWM stage. For this you need an external power source at the voltage you want your peak-peak swing to be and a decent transistor half-bridge (BJT, MOST or IGBT) rated at the working voltage and currents.

  2. That depends on the circuits you want to power and what for. I'm getting the impression that you want to build some sort of Power Frequency Driver/Chopper. I am not going to re-itterate a full how-to on building those, but you should really consider googling those if you want to not do something very dangerous (in terms of damage or health). Also note this is a difficult and long road compared to hooking up an Arduino to a set of filters.

  3. See point 2: Amplification before or after AC filtering.