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.