Can I generate a PWM signal for a Mosfet driver using a saw tooth wave and sine wave through Arduino ?

  • You could add a DAC chip. Or use some resistors to create an R-2R resistor ladder. – Gerben Aug 30 '16 at 16:27
  • PS I think most inverters use regular PWM (at a higher speed), and smooth the output. Using mosfet in a none-saturated is inefficient, and will make them run hot. – Gerben Aug 30 '16 at 18:10
  • Read the datasheet of your inverter: What should the PWM signal look like? What frequency? Duty cycle? If you add this information to your question, it would be possible to provide a useful answer. – Edgar Bonet Aug 31 '16 at 7:52

Yes you can very easy generate an PWM Output with an Arduino:

void setup()


  pinMode(pwmPin, OUTPUT);   // sets the pin as output


void loop()


  analogWrite(pwmPin, yourWantedValue);  // analogWrite values from 0 to 255


On most Arduino boards (those with the ATmega168 or ATmega328), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support analogWrite() on pins 9, 10, and 11.

The Arduino Due supports analogWrite() on pins 2 through 13, plus pins DAC0 and DAC1. Unlike the PWM pins, DAC0 and DAC1 are Digital to Analog converters, and act as true analog outputs.

Visit quote origin for more Information.

| improve this answer | |
  • Note that the PWM frequency is quite low: 490 or 977 Hz depending on the pin. The OP should check the datasheet of the inverter to make sure those frequencies are OK. – Edgar Bonet Aug 31 '16 at 7:56

Currently, none of the boards have a DAC on them, with the exception of the arduino Due. Thus, Unless you have the Due board, it is not possible. If you have a due board, and are interested in generating wave functions, then check out here: https://www.arduino.cc/en/Tutorial/DueSimpleWaveformGenerator

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.