# Using arduino and transistor for motor control

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.

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

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.

• 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. Apr 29, 2019 at 0:35
• Is it possible to use the PWM duty cycle to control voltage?
– John
Apr 29, 2019 at 1:52
• Again, that's not how it works. Motors are controlled by the duty cycle not by producing a reduced steady state. Apr 29, 2019 at 1:55
• 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. Apr 29, 2019 at 4:50