I was wondering how that'd work.
I think the PWM freq and the mains freq are mixing.
Don't know about that "polarity reversal". If it's hooked up right then there's nothing to reverse. The 12V supply's ground and the arduino ground and the transistor ground are all in common (connected together)?
So, then, you need a clean, stable DC source for the control volts.
Like I mentioned last week, that could be based on filtering the PWM.
If you can devote several arduino output pins, you could effect a "crude" DAC [ http://www.asdlib.org/onlineArticles/elabware/Scheeline_ADC/ADC_DAC_ladder.html
You could buy a DAC IC and run that from the arduino.