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.
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).
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.
(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.