# Transformer works on PWM at 50Hz?

I have an ardunio setup which is giving me output of 5V and 1A at 50Hz with pulse width modulation. I want to use this as input to the step up transformer and generate output of 60V. considering transformer formula Vp/Vs=Np/Ns I will need to have Ns=12*Np.

My questions:

1.Will the transformer will work on PWM at 50Hz?(if yes,will there be power loss?)

2.Can I use 60V as input to other step up transformer and generate output of 120V?Or would it be better to add just one another transformer?

• If $\frac{Vs}{Vp} =n$, then $n = \frac{60V}{5V} = 12$ Jan 5, 2016 at 20:38
• roger that sir! confused with my acid lead battery 6 volts Jan 5, 2016 at 20:46

I looked at the code reference and, as the comments say, it's going to generate a kind of sawtooth - not a sinewave.

void loop() {
for(up=-1; up <= 255;up++) {
analogWrite(out,up);
if(up==255) {
up=-1;
}
}
delay(20);
} What you are expecting is the blue sine-wave. What that Arduino code will give is a short sawtooth (ramping up to 255 and back to -1) followed by 20ms of nothing. It won't even give 50 Hz correctly.

1. If you did get a sine wave out it would give you a 2.5 V DC output with a 5 V peak-to-peak sinewave on top of it. The DC will bias the transformer which expects the input voltage to be symetrical about 0 V (and not 2.5 V).

2. 5 V p-p = 1.7 V RMS so even if you got rid of your DC you still have a very low voltage to work with.

3. (You think) you have $5V \times 1A = 5 W$ to work with but $5 V_{p-p} = \frac {5}{2 \cdot \sqrt 2} = 1.7 V_{rms}$ and $1 A \cdot 1.7 V_{rms} \to 1.7 W$. Be aware that even if you got this to work efficiently and stepped up the voltage to 120 V the absolute maximum output would still be 1.7 W which is about 14 mA at 120 V.

I suspect that you hope to use your Arduino to power something that would normally run at 50 Hz. I think the answer is "no".

What you are trying to make is an inverter. Have a look on the web for inverter designs. You will find some very cheap designs but they will have terrible non-sine waveforms and poor voltage regulation. Anything better will require specialist and more expensive components.

Edit after Arduino code update.

void loop() {
for(up=0; up <= 255;up++) {
analogWrite(out,up);
delay(20);
}
for(down=255; down>=0;down--) {
analogWrite(out,down);
delay(20);
}
}


Your updated code will give an output like this. The updated code result.

Now your code now steps up by 1 step and waits 20 ms before doing the next step. It will take $255 \times 20ms = 5.1s$ to get to 255 and another 5.1 s to come back down to zero. That's one full cycle in 10.2 s or < 0.1 Hz.

• No it won't work in a transformer.
• As stated, even if it worked and was 100% efficient it could only give 14 mA. You're looking for 44 mA so there is no chance of it working.
• It's still not AC. It's a rising and falling DC. The current never changes direction.

It still has a DC offset in it.

• yes that was wrong code. i have updated with new code but now i not getting 50Hz. It's around 1/8 Hz. Do transformer works on 1/8 Hz? yes, inverter it is but with arduino. I have AC LED bulb 50Hz 120V, 0.44A. i was wondering if i can glow the LED with ardino. Jan 5, 2016 at 21:50
• I edited my answer. Jan 5, 2016 at 23:09
• yes, it's between 0-5V. It does not change it phase(half rectifier) to negative(-5). i was wrong i thought 0V was the negative point. 1. And i have set delay to 1ms but still it is giving around 2Hz. as it is the minimum delay i cannot generate more than 2Hz. 2. Without the delay LED is blinking so fast i'm not able to read the frequency. Jan 6, 2016 at 8:10
• With 1ms delay you will take 255 ms to reach 5V. If you still want to play with the 'sine' wave routine then replace the 'delay' command with a time-wasting loop. You'd have to play around with it to get the timing right. You might be able to analyse your waveform using the microphone input on your PC. Use a couple of resistors to divide your 5 V down to about 0.1 V (a 50:1 divider). See oscilloscope-using-laptop-microphone-input for suggestions but heed the warnings! Jan 6, 2016 at 10:39
• yes, need to add some time-wasting loops. considering paleotechnologist.net/?p=1808 the frequncy without delay is 121kHz for digital signal. As i have analog PWM it would be around 121000/255 =474Hz. Need to check oscilloscope for windows. 1. i don't understand the LED which i have it's need minimum of 3V to glow. as the above code is starting voltage from 0,1,2,3,4,5. The LED should be off till 0-2.99V ? right? Jan 6, 2016 at 11:23

If you want to generate 50 Hz power, then PWM at 50 Hz isn't really PWM, it is just a square wave at the intended frequency.

Driving the transformer with a square wave is not optimal. You can think of the square wave as containing content at 50 Hz and other content at harmonics. Only the 50 Hz content will contribute to what you ultimately seem to want. The harmonics will cause extra current in the transformer without any benefit. This extra current will waste power, heat the transformer, and also drive it closer towards saturation than just a 50 Hz input would.

You can use PWM at many times the desired 50 Hz output to drive the transformer with what it will see as a sine wave. With PWM in the 10s of kHz or more, the inductance of the transformer will filter the train of pulses to their average. If you vary the duty cycle according to a sine, this average will be a sine, and the transformer will essentially be driven with a 50 Hz sine wave.

You can use another transformer to step up 60 V to 120 V. However, each time you run this thru a transformer, you will lose some of the power to heat in the transformer, and the impedance will go up. How much of that is acceptable is something you have to decide.

• Actually i wanted AC at 50Hz but i'm still working on this with arduino to get Low pass filter. Jan 5, 2016 at 20:08
• Did not understood the harmonics part as It is digital signal the harmonics point will be at 0 volt ? right?(if there is 0 volt then there will be no current in transformer coil=no heat) Jan 5, 2016 at 20:10
• A square wave can be represented as a sine wave at the fundamental frequency (50 Hz in your case), plus many even harmonics (100 Hz, 200Hz,....) at decreasing amplitudes, all added together. Jan 5, 2016 at 20:22
• @PeterBennett: A square wave is made up up of the fundamental and odd harmonics only. Jan 5, 2016 at 20:29
• @PeterBennett: Surprisingly, A triangle is also made up of the fundamental and odd harmonics, but the amplitudes of the harmonics drop off more sharply as frequency increases than they do for a square wave, Jan 5, 2016 at 20:57
1. The PWM you generate has probably a DC component that saturate the transformer
2. As Olin say, you have a lot of harmonic -> a lot of losses in transformer
3. With 5V/1A, you have 5W max, with your setup you'll have roughly 50% efficiency -> 2.5W for your 120V load is enough?

For pb 1 and 2, you can add a (big) capacitor in series with the transformer (DC bloc and LC filter with the transformer L) but don't expect to have 5Vpp at the transformer primary. Better is use two outputs in phase opposition (to have a 0 DC component) that drive directly the transformer (but you'll still have losses due to harmonics).