Amplifying of a PWM signal generated from arduino uno

I have generated a pwm signal using the following code:

int PWM_Pin=3;
void setup() {
  pinMode(PWM_Pin,OUTPUT);  /*declare D3 pin as an output pin */
}
void loop()
{
  analogWrite(PWM_Pin,31);//Duty cycle:12% frequency:490Hz
  delay(125);//Duty cycle of Square wave=50%
  analogWrite(PWM_Pin,0);
  delay(125);//Duty cycle of Square wave=50%
}

This gives an o/p pwm signal of 5v. How do I amplify it to 9-14v?

An op-amp with a gain of two will give you a 10V output. You will need a 12V power supply.

I did try using an OPAMP but noticed that the entire signal is being shifted to a higher voltage and not only the positive part of the signal. I only want the "ON" part of the PWM signal to be increased from 5v to 9-14v. Is that possible with an OPAMP? If it is can you please tell how to use it to get the desired result?

This will give you 10V out

Use a motor driver setup using a transistor.

1 Like

Is this a homework or quiz question?

Add a 9V battery to the Arduino GND and take its - pole as output GND.

Its a project i am working on.


Is this what you mean?

Use this circuit for a motor. "M" can be anything you are controlling with PWM, or replace M with a resistor and take the voltage output from the drain "D" terminal.

Your circuit does not at all match the goal :frowning:

May be, depending on the missing labels.

Nonsense. Especially considering the vagueness of the "goal".

1 Like

I think that removes the ambiguity of the use of the word “amplify” in post #1 and what you posted in post #8 is what the OP needs, but I guess we have to wait for the OP to confirm my interpretation.

Is the higher voltage PWM just a logic signal or is it powering something (how much current)?

This still is unclear. We need to know what voltage is considered HIGH and what voltage is considered LOW.

1 Like

I'm thinking a simple NPN transistor to switch the higher voltage driven by inverted PWM.

analogWrite(3,255 - pwmVal);
1 Like

There are a lot of ways to do that. What current do you need and what is the load?

No matter what circuit you use the off part will never be exactly 0V. So what is the highest voltage for the off part that is acceptable.

You would need a 9-12v power supply, which is connected to the drain (or source) of the mosfet.

Gate of the mosfet should be connected to the GPIO where your PWM is generated.

GPIO must be pulled up or down depending on a mosfet you use (P or N)

Since your signal is digital . not analog, you can use hardcore class D amplifier, e.g. MOSFET transistor. If your PWM frequency is high, choose transistor with lower capacitance

PS: what you are asking for is not “amplifying“. It is a “level shifting”. Amplifying assumes that noise would be amplified too, which is probably not what you want

Hello, sorry for the late reply. Let me explain what I have and what i need.


I was able to get this signal using the following arduino code:

int PWM_Pin=3;
void setup() {
  pinMode(PWM_Pin,OUTPUT);  /*declare D3 pin as an output pin */
}


void loop()
{
  analogWrite(PWM_Pin,31);//Duty cycle:12% frequency:490Hz
  delay(125);//Duty cycle of Square wave=50%
  analogWrite(PWM_Pin,0);
  delay(125);//Duty cycle of Square wave=50%
}

Basically i was asked to generate a PWM signal having 12% duty cycle, 490Hz frequency and the voltage being in the range of 9-14v. The PWM was to be generated only in the ON part of the square wave, hence the wave in the screenshot. But since arduino pins have a voltage of 5V. I wanted to know if there is a way to increase the voltage of the waves to the range of 9-14v. Hope i have explained it clearly :slightly_smiling_face:

You have.

You can do this: