Controlling a motor with PWM

I'm building an ROV for the MATE ROV competition with a high school team this year.  For this year's competition, we've decided to control our bot via an Arduino Mega, and we're using PWM to potentiate the thrusters.  As the person designated to electrical, I fortuitously have no idea how to set up an intermediate step from the Arduino to our thrusters.  I've looked into H-Bridges with both Relays and Transistors, and defaulted to the transistor. How would I choose what transistor to use though? I've tried several (all BJTs) and they're giving me nothing but problems.  Should I switch to a FET? Should I use a P type and an N type, or only one?  What specs should I purchase them with?  Do I ask too many questions? Help! 

(I'm trying to control a 12V 6A motor with a 5V Pwm signal. Thanks!)

sort by: active | newest | oldest
framistan6 years ago
I once repaired treadmill electronics boards that used PWM to power the treadmotor. You will have some design problems such as When the motor FIRST starts up... you want it to "soft" start... kind of slowly go up to speed... rather than suddenly. Also, when the motor is running if someone would step on the treadmill and place a LOAD on the motor, then the motor will BOG DOWN to a slow speed UNLESS you have a BOOST circuit. The boost circuit was a LOW value resistor of about 0.01 ohms. connected in series with the motor. Voltage across the sense resistor would indicate when someone stepped on the treadmill and would activate another op-amp to give an extra boost of PWM so the motor would not bog down. Another problem to consider, is what if the motor ever gets JAMMED. The treadmills had a circuit that detected excessive amperage for 5 seconds would shut down the PWM for safety.
There are loads of gotchas in H bridge design, Sean's spotted one, Andy alludes to another, the third is that it needs a good understanding of analogue electronics to shift the voltage levels at the gates.

Andy is actually wrong, you can switch on a Mosfet VERY quickly, but only if you know what you are doing, likewise you can turn them of fast too.

To short circuit the design process, up to a few amps you can cheat, and get the whole caboodle in a single chip, expecially for driving little motors.

Unless you really have to design your own, don't.

Specify your current and voltage requirements, and we can help better.
Well, I didn't actually say anything about the gotchas, although they're there...Yeah, I don't see why you'd need an h-bridge for such a simple driver. 12V 6A ain't diddly. As long as the switch is fast, the base frequency is moderately low (say, 1-10KHz), and the FET beefy, one should be fine with a single FET doing the control.

The main thing to worry about ime when driving an inductive load (like a motor) with a single FET, is the kickback from the motor when current is removed, but that can be solved in a relatively straight forward manner by using a simple reversed diode (or several paralleled) to add protection to the internal kickback diode built into HEXFETs like the IRF40Z or a similar protective scheme. The reversed diode(s) give a current path for the inductively generated kickback voltage (Inductors are like flywheels author, they don't like to have current removed instantaneously!) A couple of paralleled 1N4003s would do the trick rather nicely (200V, 30A surge if I recall correctly)
There isn't an inductive kick problem if you do the switching "right", so instead of switching alternate legs - How shall I describe this- top left/bottom right, top left /bottom right...you switch top left/bottom right, top left/top right. then top left bottom right.

That's effectively synchronous rectification, and its highly efficient, since you are using the tiny rds on as your switches and not diode drops.

I'm aware. My point was that if he/she desires to use a single device to do the switching, then a diode or two in addition to that provided inboard on the HEXFET might be a good idea. I still don't believe that an H-Bridge is needed for this application.
Well, Its the cleanest way for this app I think, if he uses off the shelf ICs. The project after all is the ROV and not "how do I build a motor controller".

What would you do ? Relay and PWM over one transistor +flywheel diode ?

True on the "how to build a motor controller" point.

Although it might be a good idea to do so, No enable relay is "necessary". As long as there's no input to the Fet, (and it's input is designed to default to zero V) it will be an open circuit until it gets command from the arduino.. So, I'd just use the Arduinos' logic to avoid driving the FET and provide a path to ground to kibosh any tendency to git-up-n-go on it's own.

Single N-channel FET on the low side of the motor, or if one is worried about accidental short circuit turn-on, (a real possiblity in robotics) a high-side located P-Channel, although they tend to have a higher on-resistance in equivalent packages and require negative logic.

The additional diodes just provide a heftier kickback path.

All the rest can be handled through coding. The trick of course is making the code efficient so it remains fast. Does the arduino have any inbuilt PWM routines?
I would use the relay to reverse the motor rather than as an enable.

Yes, there are PWM routines.

Ah...yes, understood. Good point
Hi, Steve. I think he did specify is requirements in his final parenthetical: (I'm trying to control a 12V 6A motor with a 5V Pwm signal. Thanks!).
I'm sure I looked ! Has the OP added it to the question ?
Nope. That was his/her original query, as far as I recall, hence my comment about using a logic-level input FET as a possibility (to minimize part count)
Hmmm...don't know. I'm pretty sure it was there the first time I read this, but by then there were already some answers.
seandogue6 years ago
One additional note. When using PWM, one does not have to use 12V. In fact, one might want to consider using a slightly higher value and maximizing the on time to some percentage rather than 0-100%. The increased power supply voltage, if handled correctly, can improve response time at startup by increasing torque.

For instance, once upon a time, when I was working at NASA GRC, I created a PWM hotwire igntior that ran directly off a 28VDC battery and used code to govern the operation.

The ignitor would burnout @ slightly over 2V.

If one were to input 2V, the hotwire would definitely get the job done, but since we only had 2.2 seconds of low-g time to work, hitting the ignitor with an initial burst of near full power, followed by a rapid reduction in the on-time percentage resulted in a much quicker response of the otherwise sluggish hotwire.
seandogue6 years ago
IMO, HEXFets are a good choice. If you're using a 12V DC motor, I do not believe you even need to use an H-Bridge. Erm...perhaps.


I'd suggest using a conservative selection, ie, choose a component that exceeds your needs by at least a factor of two. Why? Because you will avoid accidentally burning it out when you push it right to the edge.

FETs are voltage controlled, rather than current driven like Bipolars, so drive current from your arduino or intermediary drive circuitry isn't going to be a big problem. 
There are also logic-level FETS, (designed to be driven directly by logic level signals) although I can't remember the part numbers. The nice thing about logic-level devices is that no intermediary circuitry is required. Granted, in my experience, driving FETs and or HEXfets is not all that complicated with or without a logic level input...There are also drawback to using them, in that most of the more robust parts are not specified in a logic level input device.

Remember that as long as you choose a part that well-exceeds your quiescent load current when using a low RDS(on) device like a HexFet, most of the heating for PWM mode will occur during the actual switching time (from 0V-to-12V and from 12V-to-0V, so rise time is important, since it will generate problems if not considered. Of course, providing solid cooling for the HexFet (or other fet or transistor) is also essential and should not be taken lightly.

Best wishes.
Oh, I did want to stress the importance of a fast switching waveform. The arduino may or may not be up to the task itself, so you *may want to consider feeding the PWM signal from the arduino into some intermediary chip that has a fast output. I do not know the switching characteristics of the arduinos' output stage(s). I do know that under load, a FET will heat rapidly for slow transition drive waveforms, especially in rapid succession, since it becomes more and more of an issue the more transitions per second...
ISTR that the switch-on time of a FET is much lower than the switch-off time, meaning that in a bridge configuration you can have a low-resistance path from supply to ground through the upper and lower FETs if not allowed for in the driver circuit (or software).
True, rise and fall times aren't equal. I was commenting on the basics (and the Arduino itself likely has different rise/fall times as well. these all have to be taken into account. It's not rocket science, so I wouldn't want to make it seem really difficult, just that it takes a bit of thinking about the issues. an O-Scope really helps for the empirical side...