motor drivers they're the backbone of electromechanical devices controlling speed direction and torque in the motors of everything from home appliances to that mini drone you've always wanted to build since microcontroller output pins simply can't supply enough current to drive Motors directly motor drivers step in providing the necessary power handling protection and control features to safely and efficiently Drive Motors but finding the perfect motor driver for small RC projects can be headache however there's a solution and that is to make your own custom motor driver modules in this video we'll build them from scratch using discrete components like these mosfets and learn how they work along the way depending on your Project's needs you can configure motor drivers for unidirectional control like those used in drones and planes to spin propellers one way or bidirectional control ideal for RC cars or wheeled robots that need reverse and steering functionality take this single Channel unidirectional driver as an example is the same type I used in my RC paper airplane project to power its micro Corless Motors to make it you'll only need one SI 2300 n Channel mosfet a 10 kilohm pul down resistor a switching diode for flyback protection and a piece of perf board for a better visual of how the three surface mounted components are placed on the four pads of a perf board feel free to follow this little sketch I came up with in the description below find the link to download all wiring diagrams and see the list of components used throughout the entire project so let's start by propping a piece of board up with some helping hands choosing any four grouped pads on the board using tweezers to pick in place components and begin soldering the end Channel mosfet into place some other nend channel Alternatives you may use include the SI 2302 and Si 230 for next let's add a diode for flyback protection with polarity in mind so its anode terminal connects to the mosfet's drain pin we'll go ahead and solder it in with some more tin afterward let's solder in the 10 kilohm surface mounted SMD pull down resistor across the mosfet's gate and Source pins by applying heat to one side at a time so it gets seated in place with all three SMD components soldered on the board the layout should match the reference sketch now we can solder the wires a black wire to the source pin for ground red to the diodes cathode for power and yellow or another color to the mosfet's gate for signal from here we can cut out the small circuit leaving us with a tiny four pad perfboard motor driver to which we can now solder a tiny coess motor with the right polarity across the diode so I'll attach a propeller allowing you to see the motor shaft's rotation then we can power the driver with a small volt voltage from a power supply through the power wires and then run the motor by sending some voltage through the driver's signal wire now we will test this micro motor driver more later in the video but allow me to give you a quick rundown on its specs to know how to carefully handle one you can supply it from 2 to 12 volts from say 1 to three cell battery packs run most small motors at a maximum of 3 amps drive it with most microcontroller signals fit it into really small spaces while weighing almost nothing leave it on without consuming any current without applied signals with only one limitation which is that it drives Motors in Only One Direction which is enough to make it work like an ESC for Motors in drones planes and so on also if you want to drive Motors that draw a lot more current you'd build a scaled up version with through hole components like A4 watt 10 kohm resistor 1n 4148 fast switching diode and an irf 3205 n Channel power mosfet schematically the connections would remain the same and the mosfet in this driver would be able to handle up to 20 or more amps for bigger Motors back to our small drivers let's say you want to drive four Motors in a DIY mini drone you can make a compact 4channel version of the same motor driver to save space and keep weights to a minimum to make it you need four times as many of the same components a perf board with with a 2x8 space of pads the same wires only with an extra three for the other signal pins and some thin solid copper wire so we can begin by placing all of the mosfets first and soldering in one at a time followed by placing all of the diodes on the board and checking that they sit with the right polarity using a multimeter in diode testing mode as you see one was around the wrong way as the multimeter didn't beat to it now we can solder them in followed by the pull down resistors to pull all of the mosfet Gates Low by default then we can come in with some3 mm enameled copper wire which has had its enamel stripped with a knife and tinted up with the soldering iron the objective here is to connect all of the diode cathode pins together with wire hopping from one to another forming the power rail when doing this ensure no part of the wire touches the wrong pads afterward we'll do the same thing but to connect all of the mosfet Source pins together forming the ground rail feel free to leverage the lower pads for the wire to solder onto with that we can extend the ground and power rails via their unique wires and give each mosfet gate pin a wire each of different colors now when handling these mosfets make sure you're wearing an anti-stat static wrist strap grounding you to the Earth at all times to avoid zapping the components with your body's builtup static electricity yes it's real as I've internally damaged a few mosfets this way in the past you can find these wrist straps on stores like Amazon and videos online on how to use them also when soldering get rid of those toxic fumes with a solder fume extractor around you at all times anyway from here we can trim the board sand it down to make it lighter in weight and it it is complete to connect up four Motors it's really the same as with a tiny driver board where they connect across each diode only that the positive motor wires connect up to a common point which is the power rail while the negative wires go to each of their mosfet drain pins then we can hook it up to a power supply and test each motor through supplying a voltage to each individual signal wire for the specs of this motor driver all is the same except for the dimensions weight and number of channels with its four channels it is ideally used in RC vehicles such as small drones and planes with four Motors now if you want to drive a motor in both directions you'd use a single Channel hridge motor driver this bidirectional driver is perfect for driving Motors in RC cars like my micro RC Hot Wheels car or wield robot like one of my RC Battle Bots let's take a look at how to make it on a perf board laid out we have all of the capacitors diodes resistors and transistors that it needs and in front is the component layout sketch to further help you know how to place them on the pads in accordance with the correct wiring we'll secure a few of these at a time to prevent surrounding components getting misaligned when soldering starting with the two end Channel mosfets with their flyback dial and their cathodes pointing towards the mosfet drain pins then we'll solder in the two P Channel mosfets turned around 180° with their dodes again pointing forward we'll throw in a 10 kohm pulldown resistor for each mosfet followed by two 100 ohm gate resistors connecting to a couple of npn transistors for controlling the p mosfets with added 1 kohm current limiting base resistors each at the top left corner We'll add in the power indicating LED with its 270 ohm current limiting resistor followed by a 10 microfarad capacitor to stabilize fluctuations in the board's power supply now we'll start adding jumper wire connections using using some of the3 mm enameled copper wire cutting six short pieces with stripped ends we need these for bridging unconnected ground and power connections as well as adjoining corresponding side signal connections to leave us with only two signal lines to toggle one per Direction [Music] since all of this might seem confusing to you at first glance it's best to follow its schematic with matching Connections in general I highly advise reviewing your connections for whichever driver you choose to make with its corresponding schematic Linked In the description so to finish up we can add wires for power ground and wires for two signals which when either is toggled determines which direction the motor drives to cut her out let's score around the perimeter of the circuit and snap out the board with the help of some Cutters now that our h-bridge driver board is made let's connect up a motor with its wires to the two blobbed areas in between the p and N Channel mosfets Bridging the H part of the circuit no pun intended so when you apply a signal to one of the two input wires the motor spins in One Direction and when the other wire has a voltage applied the motor spins the other way you can tell this based on which way the propeller is blowing the air we can do the same test but on a microm metal geared motor so you can easily tell the switching of directions here it's turning clockwise and now counterclockwise with the other input pulled High looking at its specs the key differences with the H bridge is that it takes a minimum of 3 volts to work takes a maximum current of two amps both ways it's bigger weighs only 1 G consumes 9 milliamps when idle due to the LED and uses a combo of n andp mosfets along with BJT transistors as a whole enabling the motor to be driven both ways by the signals of a microcontroller this makes the driver ideal for powering RC vehicles that need to move forwards backwards and turn as well as in robotic actuators if you struggle to find the matching SMD transistors to build this driver feel free to take note of the available Alternatives and if you want to amp things up these are the components one would need to build an H bridge that can handle up to 20 or more amps of current for some heavyduty brushed motors before we learn about these motor drivers further let's take things up a notch by turning them into proper pcbs for this I'm using flux my go-to PCB design software that keeps the process simple and efficient I'm designing four motor driver pcbs for different RC setups two unidirectional drivers single and four Channel forms and two h-bridge drivers single and dual Channel versions I'll start by grabbing the necessary components directly from flux's built-in Parts library then wire up the schematics following the same connections we used for the perfboard drivers now that the schematics are all done I can move on to the layout since PCB design isn't something I do daily fluxus AI co-pilot SL assistant steps in to make the process easier here it's helping me create a more compact PCB friendly component layout with space for connection pads and shorter traces and now that it's time to wrap the traces flux's new AI Auto layout feature handles it in one click it automatically routes the entire PCB keeping everything clean efficient and within the design rules it is a huge time saer when I need to speed things up I've been using flux for over 6 months months now and it's become the one ecat software I use for my projects flux is free to get started with and using its AI assistance it's perfect whether you're just starting out or already have experience check out the link in the description to try flux for your next project all the designs are complete and you can download the Gerber files for all four motor driver boards from the project files folder Linked In the description three of the designs are PCB versions of the perfboard drivers we built earlier while the fourth is a dual Channel version of the single h-bridge driver this lets you drive two Motors bire similar to a commercial dual h-bridge module but made with discrete components next let's turn these designs into pcbs using jlc pcb's manufacturing service the ordering process is super simple first upload the Gerber files Linked In the description to get an instant quote then select your board parameters go for two layers your preferred board quantity I'm going for 10 of each thickness 1 to 1.6 mm depending on how sturdy you want them and even choose your favorite PCB color easy right for my boards the only thing I'm changing between one another is the thickness once that's set add them to the cart and confirm which designs you want I'm going for all four and place the order from here you can track the order status in real time while jlc PCB gets to work [Music] and they're here already overall I'm quite pleased with their reliable service and most importantly the end result I get to enjoy for the project jlc PCB consistently delivers top-notch quality boards starting at just $2 for 1 to eight layer pcbs ever need six layers free via in pads are included with production done in as fast as 48 hours over 5 million customers worldwide including me relying them for our circuit boards will you be the next one hit the link in the description sign up to get $60 in coupons and bring those motor drivers or other projects to life with jlc PCB making PCB versions of the drivers is a smart move because it saves time and avoids the hassle of soldering components onto perf boards all day long I'll briefly take you through the process so I have here all four pcbs with the components that need to go on them to prevent the boards from moving all over the place we need to secure each with some taped down larger pcbs or perf boards surrounding each once secure one by one let's start applying a bit of solder paste to each and every one of the pads where a component attaches to from here we can pick and place the corresponding components with a pair of tweezers [Music] so once all components are well Seated on their pads with the paste we can gently unstick the surrounding boards and head over to the hot plate now this is a PCB Reflow Hot Plate I bought recently for melting surface mounted components onto boards we're going to let this thing first heat up to 200° C which is well above the past's melting temperature of 138° once heated we'll bring over the solder fume extractor only then we can carefully place the first first board on the hot plate and watch as it melts the solder beneath the components while the components move around in the heat we have a chance to align them further and prevent improper solder joints from forming once we're happy with how the components sit we can remove the board from the hot plate and let it cool repeating this for three more boards just like that we have four complete PCB motor drivers we'll only test the one we haven't yet seen in action which is the Dual H Bridge soldering on wires for ground power the four signal inputs one pair for each motor we can now use this driver and instead of just testing it on a couple of Motors let's see it integrated in a finished project my RC combat robot death roll I'll replace this stock dual HPD driver for the custom one connecting to the robot source of power outputs from the Arduino Uno R4 Wi-Fi and the motor wires we've got forward backward and turning control of the two Motors thanks to the custom dual Channel H bridge and yes it also takes pwm signals to drive Motors at different speeds now you've seen how to make all of these different drivers but what will help you succeed in making your own and custom types of motor drivers in the future is understanding how they all work each of these motor drivers we made work based on a three pin component called a mosfet AKA metal oxide semiconductor Field Effect transistor yes that's quite the long name so that's why we simply call it the mosfet which is a type of transistor that acts like an electronic switch for controlling current flow in this analogy I'd like you to think of water as the flow of electrical current for those of you still learning electronics think of the mosfet or transistor as a water tap you have three elements at play the inlet where there's a surplus of water waiting to be released the outlet where water runs out for you to use and the Taps control element the knob above which determines how much water gets released least and the mosfet works the same way it has three terminals the gate is like the knob it controls the flow based on how much voltage you apply the drain is like the inlet connected to the power supply and the source is like the outlet returning power to ground while allowing currents to flow through a load such as our tiny motor when you apply a voltage signal to the gate like turning the knob on the tap the mosfet allows currents to flow from the drain to the source powering the motor essentially the mosfet acts as an electronic switch that turns the motor on or off depending on the signal you send to the gate with a tap you control how much water is let out based on how much you turn the knob above you turn a little bit little comes out a lot more a lot comes out but with the transistor you apply something called pwm or pulse width modulation to the gate pin it is based on the on andof switch periods or duty cycle that you get little or loss of current flowing through a mosfet if you look at the circuit you'll see that the motor connects to the mosfet's drain pin and the power supply while the source is connected to ground when a microcontroller or other signal Source sends a voltage to the gate the mosfet turns on creating a path for currents to flow through the motor the motor spins because it's drawing power through the mosfet from the battery or power supply but here's the important part using a mosfet on its own to drive Motors is not not a good idea without adding protective components that's where the flyback diode and pull down resistor come in Motors are inductive loads which means they generate voltage spikes when you suddenly cut off their power and without protection these reverse currents called flyback currents can damage the mosfet and to prevent this we add a flyback diode across the motor terminals with the stripe of the diode pointing towards the power supply this diode provides a safe path for those reverse currents protecting the mosfet and prolonging its life the mosfet's gate its control pin can sometimes be left in an uncertain State when no signal is applied causing unpredictable Behavior adding a pul down resistor typically 10 kiloohms pulls the gate to ground when no signal is present ensuring the mosfet stays off this ensures the motor only runs when you actively send a signal to the gate now that we've covered the basics of transistors and unidirectional motor drivers that use them let's step it up with the more versatile bidirectional h-bridge motor driver specifically the one we made previously an h-bridge motor driver is called an H Bridge because the circuit's layout resembles the letter H at its core it uses four transistors two P Channel mosfets and two n channel mosfets to form the legs of the H the motor sits in the middle as the horizontal Bridge so here's how it works just like in our unidirectional driver the mosfets and the h-bridge all act as electronic switches controlling the flow of current to the motor the P channel mosfets are connected to the positive Supply voltage while the end channel mosfets are connected to ground to make the motor spin forward one p Channel mosfet and the opposite end Channel mosfets turn on creating a current path from the power supply through the motor and to ground to reverse the motor the opposite pair of mosfets the other P Channel and N Channel turn on flipping the current's direction through the motor however it's important to note that the two transistors on the same side of the H can never turn on simultaneously as this would create a short circuit across the power supply and we don't want that to prevent this we use control logic or a microcontroller to manage which mosfets turn on and off at any given time like in the code it's better to add a small delay between switching directions not to jam the flow of current preventing a short circuit but usually in most applications this is already done for you but wait how do we control these mosfets one thing to keep in mind is that P Channel mosfets need a low voltage at their gates to turn on as they work inverse to end Channel mosfets since we want to make it convenient for the microcontroller to toggle all of the mosfets with only High signals we use npn transistors as intermediaries for the P mosfets these added transistors act as pull down switches to pull a p Channel gate low when triggered by a signal from the microcontrol in conjunction they Now operate similar to how an N Channel mosfet would be toggled by default so the npn transistors work alongside the P mosfets to ensure proper operation and this now allows us to simplify the number of inputs from four to only two with a couple of crossed connections so toggling one input High drives the motor one way and using the other input drives it the other way here's a practical example of H Bridges RC vehicles for an RC car or wheeled robot like one of my RC Battle Bots the h-bridge motor driver allows you to control its movement want to drive forward the H Bridge sends current in one direction through the motors need to reverse it flips the current flow making the robot go backward want to make a turn the robot uses its two H Bridges making the motors turn in opposing directions this bidirectional control makes the H Bridge a key component for driving Wheels tracks or even steering mechanisms in RC vehicles before driving motors with your custom drivers for RC projects make sure you pick a motor with the right power specs and stall current that won't exceed the maximum operating current of your driver don't rely solely on data sheets test the stall current yourself using either a multimeter or a power supply with a display that also shows and measures current start by powering the motor to measure its no load current then gently stop the motor shaft with pliers to see the stall current larger Motors naturally have higher stall currents and anything over 2 to 3 amps can cause the mosfets on these tiny drivers to overheat and burn out on the left side you can see smaller brushed motors that both driver types can handle at full capacity on the right we have larger brushed motors which exceed what these drivers can manage underload use this as a rule of thumb When selecting motors for your custom drivers and always test to ensure they're good match the motors that work best with our custom drivers are available on dfrobot domcom they've also sent me their new fire Beetle 2 board and esp32 S3 microcontroller we'll use for a quick demo to show how it pairs with our DIY motor drivers for a complete RC system this esp32 board with its long clip on camera Works flawlessly with my favorite Wi-Fi based motion capture and remote control app by s60c on GitHub which I've used in many of my other other remotely controlled projects alongside realtime video feed the app recently got the addition of thumbs slider controls for driving Motors and RC cars and track vehicles making it ideal for interfacing with DF robots Motors I have here and the h-bridge motor driver we built simply connect the motor driver's inputs to any two of the 26 IO pins on the esp32 S3 we'll wire up power and ground ensuring both the driver and the esp32 share a common ground after powering the board via USBC supplying power to the driver and loading the app on my phone we can drive the motor in both directions at adjustable speeds using the slider the fire Beetle 2 has impressively low latency for a Wi-Fi based board providing near instant feedback from the motor with its optional external antenna this board is also great for longrange control this demo gives you a clear idea of how to integrate these motor drivers with Wi-Fi remote control for your next RC Project Beyond Motors and Boards like the fire Beetle 2 DF robot offers a huge variety of modular Tech from robotics parts to AI Hardware helping diyers like you and I bring their ideas to life check out the link in the description to shop for your projects Parts at dfrobot tocom for those of you who encounter issues getting your drivers working I got you a troubleshooting cheat sheet to get you unstuck hear me out out if your driver board overheats you're likely overloading it with a motor whose stall current exceeds the driver's limit so use one within its range another cause might be a shorted mosfet from installing the protective diode backward next time use a Multimeter to check its polarity if the motor isn't responding to your input a faulty signal might be the issue so check your signal Source or if a gate resistor that's too strong is the cause make sure it's between 5 and 20 kiloohms another reason could be a fried mosfet from improper handling just replace it add better protection and move on but if your motor runs continuously without any signal the mosfet's drain to source region might have short circuited so you'll need to replace it this could also be due to a floating gate check if your pull down resistor is properly pulling the gate to ground without any loose connections to wrap up here's the cost breakdown for each motor driver we made based on components bought on Amazon incl including only the components used without the cost of board material the unidirectional single Channel driver costs just 15 cents the unidirectional quad Channel driver comes in at 45 and the single Channel H Bridge driver totals a172 pretty cheap right but if you want to go as far as repurposing use components for the drivers consider salvaging the components from old TV boards mobile devices and computer boards as they may contain most if not all of what you need not only does building custom motor drivers save money but it also gives you the flexibility to customize size and functionality plus you'll gain a deeper understanding of how they work making troubleshooting and future projects easier once you you consider buying one instead if you're short on time working with higher power motors or need Advanced features like overcurrent protection commercial motor drivers are still a solid option but especially for smallscale RC projects custom micro motor drivers are a win in my book for a deeper dive into these drivers check out my tutorial blog on the elector Labs project platform it's packed with images extra tips and a handy summary of key information about these circuits click the link in the description to read more I'm excited to hear how you bring your next RC Project to life using one of these boards and if you're looking for inspiration you might like building my mini Arduino fpv drone that utilizes one of these drivers click on its video right here above and I'll catch you there [Music]
2025-01-05 02:15