I am currently a computer engineering student trying to build a simple circuit to vary voltage by using a transistor and a arudino uno. The motor draws between 12v and 28v with a current of about 280mA. I want to control the voltage using the arduino thru the use of PWM from the arduino. So in theory a 50% duty cycle of the arduino will give me half the voltage from collector to emitter. I tried using PWM without any capactiors and it ended up making the motor whine and might end up damaging it.

The BJT that I will be using is the TIP120 with a beta of 1000.

Here's the schematic, I originally tried using a 1nF capacitor across the motor to try to smooth out the voltage during the off cycle of pwm. But that still made the motor whine so I tested a bunch of different capacitors and about 10uF made it quieter but both the power supply and the motor both whined. enter image description here

At its current configuration the signal across the motor looks something like this (when using a 50% duty cycle) enter image description here

How would I be able to get a consistent line at 12v? or any other voltage as set by the duty cycle.

PS the inductor is the motor and the values are not correct. Just used as a reference.

  • \$\begingroup\$ You should not even be trying to get a constant voltage across the motor - that is not how PWM works. Leave some small capacitors (much less than your 10 uF) to supress radio frequency interference, and boost the PWM switching frequency above the audible range. \$\endgroup\$ Commented Apr 29, 2019 at 0:35
  • \$\begingroup\$ Is it possible to use the PWM duty cycle to control voltage? \$\endgroup\$
    – John
    Commented Apr 29, 2019 at 1:52
  • \$\begingroup\$ Again, that's not how it works. Motors are controlled by the duty cycle not by producing a reduced steady state. \$\endgroup\$ Commented Apr 29, 2019 at 1:55
  • \$\begingroup\$ Motors have substantial mechanical inertia, and when frequently kicked by PWM pulses, they rotate smoothly. In a sense motors are good filters and don't need true DC voltage. Your "whinning problem" is a side effect of either partially lose windings in motor's rotor, or magnetostriction of rotor core, and the noise should be gone if you manage to make your PWM frequency above 5-10kHz. \$\endgroup\$ Commented Apr 29, 2019 at 4:50

1 Answer 1


If the PWM frequency is high enough, the ripple in the current through the motor will only be a few percent, though the voltage you see across the terminals will still be swinging from the supply voltage (less the transistor drop) to the diode drop (which will be negative when measured in the same sense as the supply voltage).

Your issue is likely that the frequency you are using is too low. Switching losses, which increase with frequency, but reduce with the speed of transition of the transistor from full conduction to no conduction, will push you to have the lowest frequency that will give a tolerable ripple, and is usually in the 20-30kHz region to avoid audible effects, though some motors which have very low winding inductances will need much higher frequencies or additional chokes in series with the windings.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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