Sam looks at the differences between Motor Drivers and Motor Controllers
Hey guys, how're you going my name's Sam from Core Electronics and today I'm going to be taking a bit of a look at motor drivers versus motor controllers? It's a question we get all the time so let's take a look.
So first of all what do we mean by motor driver, well, if you've ever done anything like a robotics project where you've needed to control a motor or a heavy-duty load you will know that you can't drive them directly from the pins of a microcontroller, an Arduino pin for example is rated at output 25 milliamps and an absolute maximum draw of 40 milliamps which isn't really going to drive anything most motors are going to draw far more than that especially during startup or stall currents. So we need a way to drive that larger load from the small signal of our micro controller and amplify that to be able to control a much larger load, so we use motor drivers and the motor driver acts like a bit of a gateway where it accepts this smaller input and can control a much larger load using using a special type of transistor called MOSFETs or FETs for short as discrete components or often as a you know an integrated IC you know where they've got all that built onto the chip to you know to save the extra work.
So a motor driver is responsible for driving the motor, and a motor controller is a motor driver with a control interface stacked on top of it. That's the you know the TLDR that the short version motor driver requires you know the logic to be handled it requires to be driven from the microcontroller and you have to make sure you operate it in the correct way look up what signals you need to send and when all that sort of stuff whereas a motor driver takes that drive functionality and adds a digital interface on top where it takes care of all of that and it just presents some control interfaces such as USB and analog pin, serial, UART, SPI, i2c, an RC input to pulse width modulation whatever it is, it makes it really easy to drive so that you can sort of drop it into an existing system and get started with it straight away you might want to control it from your computer by USB whatever it is but a motor driver needs that logic you know needs that drive capability done for it. It just handles the power side of things. So that's the too long didn't read version now let's take a little bit more of an in-depth look.
I want to start off with looking at how most motor drivers work and the most common way to control the motor is by using an H-bridge, so let's take a look, I've got some schematics in the article here but we'll go ahead and draw them out and I'm drawing up quite simply I'm leaving out a few you know necessary components that you'll need to protect the FETs to make sure you drive know probably all that stuff but this is a simple schematic of the elements involved in an H-bridge. So you can see we've got some FETs and we've got p-channel and n-channel FETs so I'll go ahead and draw those out here these are going to be some simplified drawings. I'll make sure I'm doing this the right way and then for our N channel ones we're going in this way, so I have kept the flyback diodes in this drawing now some FETs will have those built in others won't but they're an important part of the diagram more important than you have the left out resistors and things like that because otherwise you know you can damage a lot of stuff.
So here are our FETs which control the switching and these guys act like electrical switches you can turn them on or on from a smaller electrical signal and they can control a much larger signal so you can get ones that are rated from you thirty volts and a few amps right up to you know a standard sort of power FET package as a discrete component will handle you know say sixty volts at maybe 30 amps handle quite a lot of juice you may need to heat sink dissipates some heat, but they can handle it. So these are our switches I've got the diodes in there I'm going to leave them out for this drawing just so we can get more of a feel of how it's going to work. Alright, and then from our here this is going to be our ground that's going to be Vcc, then these are our control pins, of course, a little different but it's okay and then coming from here, these guys join together and we have our motor. Big M4 motor. Now when these are in their off state there they're off state when they're not been turned on they won't conduct any electricity across these two pins here we won't go into the workings of you know of how FETs work, this is just a simple explanation so think of them as switches it helps you to conceptualize when they're off no electricity can flow when they're on electricity can flow, a current can flow.
So in the off state the motors not connected to you know voltage or ground we need a potential across the motor to our electrical current to flow, so how we do it is we turn on these FETs in pairs so we can turn these two on and if we cover up those two then you can see that current can flow down here, we will have a positive side that's most connected to to a positive voltage across here it will be connected through to ground because these have a very low resistance when they are on and the turn in the direction. Then if we reverse the direction of motor we need to reverse the direction of current flow so switch the voltages around on the on the contacts so if we cover up those two so these are being turned off on these to expose ones that then turn on then current can flow this side that would be a positive, down through to ground, motor would turn on other direction. So that is that's the two drive conditions, you can see them perhaps a bit more clearly in the tutorial there.
Now braking, to perform braking on a motor you connect both sides of the motor to an equal potential or an equal voltage, so you could turn on turn those two off and both sides of the of the motor would be connected to a zero volts, or you could turn those two on both sides connected to whatever your Vcc is, lets say 12 volts and it would break which means you know it comes to an abrupt halt. Whereas if you want it to coast, I don't have that example of that because to coast it you just turn all of them off, it's not connected to anything in the momentum of the of the rotor it's simply keep turning until it comes to a halt. With braking there are few things we don't want to do well there's a couple of things that the main one is you don't want to turn on one side of your H-bridge completely, and this is where motor drivers can fall short because if you're building one out of discrete components or using a simple low-level H-bridge chip it might not have short-circuited protection so if you try and turn these two FETs on, current is going to flow down here cool but that's a very low resistance through this FET as well so it will go straight to ground you get this short circuit which can damage one or more components in your circuit, and likewise the same goes for that side, you can't do it. Whereas the motor controller you know is designed to protect against that there won't have a valid command for you know shorting out your power supply, which is a sensible option.
So that's a bit about motor drivers, so I've got one here, this is very small teensy motor driver, you can see how big it is compared to the pen and it's a very simple one it's got some pins on there's it is by Pololu, a fantastic product and the other thing as well is that motor drivers are rated at a certain specification and we'll cover that when we talk about controllers, you know this guy here can't handle as much current or voltage you know will have a lower voltage rating and can't handle as much current because it's a smaller low packaged chip you can see it's all integrated into the one IC there rather than discrete components whereas this guy this is a motor shield, it's still a motor driver but it's designed for an Arduino board as a shield has some beefy ICs that's still not super high power I think these from memory can handle one or two amps so still not a high-powered motor driver that can take a little bit larger board obviously a lot of blank space.
Now on to motor controllers I've got a controller here, it's one of the jerk motor drivers from Pololu it is the jrk 12 v12 which going off their numbering system for their models I believe means it can handle 12 volts at 12 okay to 12 amps at 12 amps continuous is where you get that 12 and at 6 to 16 volts of operating voltage so I think they've just sort of made it 12 v 12 not sure when that first 12 comes in but that's the specs, you can go look that up on the product page now the motor controller obviously has can see it's got a few more bits and pieces on it it's got a much larger IC it's got a USB connection that implies some sort of digital you know logic functionality and the controller as I said it packs all of that drive functionality of the motor driver in and also provides these interfaces so I'll go back to the product page then we can take a look at the exact interfaces it has but generally you know as far as motor controllers go PWM as I said analog signal, USB, serial, I2C, SPI, whatever UART, an RC connections the most common ones and you can you can pick which ones you want to use whatever application it is to that they're more expensive there's a bit more going on on the board than just a standard motor driver would be but as I said fantastic if you just want to drop in and control a motor from your computer to test something out or you've got everything else built you don't want to have to go and write all the code to handle you know the motor driving you know functions and logic you just want to say yet when I want to turn it on I want to send some serial data to it and that's as simple as it is, which is really really cool.
They both have their place as I said it depends on what you're using if you using a platform like Arduino something like that you're more likely to have perhaps some spare IO pins you can drive the driver with and save yourself a few dollars for you projects as well but it just depends on what using for your projects there's no better or worse option, much alike the whole Arduino versus Raspberry Pi debate just depends on personal preference depends on the project depends on what you're using it for.
So we talked a bit about matching specifications and this is important you know it might seem like common sense perhaps but it can be a bit you know until you've actually destroyed a board, then you learn, but until you do that, perhaps it might be a bit confusing about which numbers you can go over which ones you can't you've got continuous current you've got peak current all this stuff simply put don't exceed the specifications of the device you're using if it has a voltage rating don't go over the voltage rating. You can drive motors at a lower voltage than they're rated voltage perhaps sometimes a higher voltage or you can require significantly shorten the life of your motor by risking burning out the coils in it but make sure that you've matched the specifications of you know voltage rating to the intended voltage of the motor that you're driving and also the current, so continuous current means that can constantly draw that amount of current while it's operating. Peak current means that if your motor hits a bit of a bump that would cause the motors to draw a bit more current, if you robot was going over bumpy terrain and it would for a short period of time draw a larger amount of current which would obviously have to be handled by the chip, and they'd have that in there so you know those short ripples and spikes and brief moments are okay but just because I'll go back here so it says 12 amps continuous, 30 amps peak doesn't mean you should say well it is going to be drawing 30 amps for a minute should be alright, the chip will get very warm and you may get some magic smoke coming out of it a sure sign that you have destroyed it usually speaking.
So I guess, to sum up, which one is right for you like I mentioned that's very specific but here are some questions as to ask yourselves, these are in the tutorial a bit of Q&A.
So motor drivers require a little consideration for ensuring it will work as intended, you can drive, you can communicate with it you can use it they're designed to be as much of a drop in the product as possible. Motor drivers require more thought when implementing them as you need to create software or hardware functions to drive the FETs correctly ensuring that the incorrect control signals aren't given that could result in shorts, so we've talked about using digital logic in your program but you can actually create a logic gate circuit or things like that to reduce four control wires down to perhaps two or just one if you only need to go forwards and backwards you can create logic using hardware or software, bear in mind you know H-bridge design, if you do want to design one yourself there's plenty of articles a good articles out there I might do one at some point but don't take this you know because all you need you definitely need more than four FETs. Seriously so motor drivers are usually cheaper than controllers, as they are simpler devices, makes sense, motor controllers also provide feedback and error detection and other features which usually aren't found on you know basic motor driver boards, so they can let you know how much current your motor is drawing whether there's an error perhaps that stall and it's in lockup it can monitor things like that and give you that as feedback which moves drivers usually can't. Plain old motor drivers, something I like about them if they give you absolute control so they give you a bit more scope in development obviously you know generally a more compact simple aboard you can also choose exactly how your motor is operating create a custom function so perhaps it might not be you know you might not be able to implement the motor controller you want to with a basic motor controller with the motor driver usually can because it's up to you so that's a bit about motor drivers versus motor controllers hope you guys found that interesting if you still got some questions to get the conversation started, comments below, we'd love to hear back from you. Happy Making Guys!