Electronic – Arduino limit PWM voltage

arduino

I am thinking to use arduino to generate square wave of various duty cycle and frequency.
the square wave is going to be fed into transistor amplifier.

What options do I have for programmatically controlling the output of transistor?

Best Answer

The arduino has an analogWrite(pin, level) function that takes care of the details of the on-chip PWM hardware. Programmatically, you just give analogWrite the pin number you're writing to, and a value 0 to 255 to control the duty cycle. If the hardware is such that the transistor saturates at one logic level from the PWM pin, and cuts off at the other, it should deliver proper PWM controlled power to your load. Be aware that the RMS value of PWM goes by the square of the duty cycle; 70% on 30% off equates to half power.