Motor speed controller tutorial - PWM how to build

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this is a simple pulse width modulation speed controller for a dc motor which uses one of these a 555 timer and i'm going to show you how the circuit works how to design one and even turn it into a professional-looking printed circuit board you can even download a copy of my circuit board and build your own i'll leave a link in the video description down below for that the heart of our system is the 555 timer this is an integrated circuit component which means inside it are a number of smaller components all combined into one package that makes our jobs as designers much easier we will see how this component works as we start to build this circuit now we're going to be using altium designer for this project who have kindly sponsored this video all of our viewers can get a free trial of their software and i'll leave a link in the video description down below for you so do check that out we start a new project and create our schematic and also our pcb file we then need to start adding components we can use the inbuilt tool but i'm going to be using an add-on which i think makes it a little easier we find the component on the supplier's website i'm going to be using mouser but you can use whoever you wish i found the 555 timer so i take the part number and paste this into the library loader and click search it finds the component so i click add to design the 555 timer can handle a maximum load of around 200 milliamps we are going to be controlling one of these dc motors from a 12 volt supply and we see that at 12 volts it draws a current of around 1.4 amps and that's with no load applied this is already more than our 555 timer can handle so we will need to use a mosfet which is a type of electronic switch by the way we have covered how dc motors work in detail in our previous video links down below for that i'm going to use an irf said 24n mosfet and that's because it can handle the voltage and current and it also has a low drain source on resistance so we find that component and we add it to the circuit the motor will be connected to the mosfet drain pin and the source pin connects to ground the mosfet will normally block the flow of current so the motor doesn't rotate however if we apply a small voltage to the gate pin it will allow some current to flow the higher the voltage applied the more current is allowed to flow and so the motor rotates faster the 555 timer will provide the voltage to the mosfet gate pin from pin 3. to vary the voltage and control the speed of the motor it will send this as pulses each pulse lasts a period of time during this period there will be a segment where the signal is on so voltage is applied and a segment where the signal is off so no voltage will be applied the mosfet will therefore experience the average voltage for each time period the wider the on pulse the higher the average voltage will be this is pulse width modulation and you can see the calculations for this later on in the video the current to the gate pin is tiny but we will place a 1 kilo ohm resistor between the mosfet gate pin and pin 3 of the 555 timer this will protect the component by limiting the current if the mosfet were to malfunction and allow current to flow out of the gate a charge of electrons will build up at the mosfet gate pin and we need to discharge this to turn it off so we place another one kilo ohm resistor and connect this to ground which provides a discharge path i want to connect the motor and power supply externally from the circuit board so i will now add a terminal for the input and another for the motor connection i also want an inbuilt switch to turn the controller on and off so i find a suitable switch and i add this too now we will connect the input terminal to ground and then connect the power supply to the switch we then connect the switch output to the motor terminal then connect the motor terminal to the mosfet drain pin the electrical motor contains coils of wire so we can consider it an inductor when inductors are powered they store energy in their magnetic field when the power is cut this magnetic field collapses and the inductor pushes electrons through the circuit this causes a very large and sudden surge in energy which can damage our circuit so we add a flyback diode which provides a path to safely circulate and diminish the energy for this we will use a 1n4007 diode which can handle the large peak current so we add that to the circuit we have covered inductors diodes and transistors in detail in our previous video links down below for those now we can connect pin 8 from the 555 timer which is the component's power supply and we connect this to the positive then we connect pin 1 to ground inside the timer we have 3 5 kilo ohm resistors between pin 1 and 8. the voltage reduces one-third after each resistor as we have 12 volts at pin 8 the voltage will reduce to 8 volts after the first resistor and then down to 4 volts after the second resistor the 555 timer uses these as a reference connected to the resistors are two comparators the comparator has a positive and a negative input as well as a single output the first comparator is connected to the resistors through the negative input the positive input is connected to pin 6 the threshold pin comparator 2 is connected to the resistors via the positive input its negative input is connected to pin 2 the trigger pin the comparators are now connected across two different voltages so it can compare them if the positive input voltage is higher than the negative input it outputs a high signal or a positive voltage if the negative input voltage is equal to or higher than the positive input voltage it will output a low signal or zero voltage we will connect pin 2 and 6 together so that the voltage is the same the output from the comparators connect to another internal component called the flip flop the first comparator connects to the input named reset the second comparator connects to the input named set there is also an output named not q when the flip flop receives a high signal from comparator 1 it outputs a high signal when the flip-flop receives a high signal from comparator 2 it outputs a low signal if both comparators provide a low signal the flip-flop remains unchanged and continues this will then pass through another component called an inverter which simply inverts the signal it is given if this seems confusing then don't worry it will all make sense in just a moment as we go through the circuit if we apply a small voltage for example 3.9 volts to pins 2 and 6 comparator 1 outputs a low signal and comparator 2 outputs a high signal this sets the timing interval to begin the flip-flop outputs a low signal the inverter outputs a high signal as we increase the voltage for example to 6 volts comparator 1 and 2 will output a low signal the flip flop remains unchanged the timing continues but at 8 volts comparator 1 outputs a high signal and comparator 2 outputs a low signal the output of the flip flop now reverses and the output is high this resets the timing the output of the flip-flop remains the same until the voltage decreases to around 4 volts where comparator 1 outputs a low signal and comparator 2 outputs a high signal this starts the timer again so we see that as the voltage on pins 2 and 6 increases and decreases the output of a 555 timer changes so to control the voltage and therefore the time interval we connect pins 2 and 6 to a capacitor when we connect a capacitor to a power supply it instantly reaches the battery voltage but if we connect it via a resistor the resistor slows down the charging time the larger the resistor the longer it takes to charge the voltage up so to charge our capacitor we will use a fixed 1 kilo ohm resistor and a 100 kilo ohm potentiometer the potentiometer is a variable resistor so we can therefore vary the capacitor charging time we will need to also discharge the capacitor in order to restart the timer so we will add two diodes to create a separate charge and discharge path the current in this part of the circuit is very small since the resistors are in the kiloohm range we will use two 1n4148 diodes which have a forward current of around 300 milliamps which will be fine for this application the capacitor will be a 10 nanofarad ceramic capacitor we will see why in just a moment so we add these components to the circuit then we connect the diodes to the fixed resistor and the diodes to pins one and three of the potentiometer then we connect the capacitor to ground as well as to pin 2 and 6 of the 555 timer and also to pin 2 of the potentiometer pin 7 is the discharge pin which is connected to our timing capacitor inside the 555 timer the output of the flip flop connects to the gate pin of an internal transistor this controls the flow of current from the capacitor to ground when the flip-flop output is low the transistor is off so the capacitor charges and the voltage begins to increase when the voltage increases enough so that the output of the flip-flop is high the transistor is turned on which discharges the capacitor so the voltage reduces when it reaches 4 volts the capacitor begins to charge again when it reaches 8 volts it will then discharge you can learn how capacitors work in our previous detailed video links down below for that we also have pin 5 which is the control voltage we can use this to override comparator 1. we don't need that for this circuit so we connect this to ground via a 0.1 microfarad ceramic capacitor grounding this pin prevents accidental override and the capacitor will filter out any noise or frequency we also have pin 4 the reset pin which we will connect to the positive of the circuit we could use this to override and reset the flip flop by interrupting the power supply to the reset pin we don't need that for this circuit so it is connected to the positive okay so when charging the current flows through the resistor the diodes the left side of the potentiometer to the capacitor the flip-flop output is low so the discharge transistor is off pin 3 outputs a high signal once the capacitor charges to 8 volts the flip-flop output becomes high which turns on the transistor and the capacitor therefore discharges through the right side of the potentiometer and the diode pin 3 outputs a low signal the transistor remains open so that the capacitor discharges until it reaches 4 volts where the flip-flop reverses again this turns the transistor off which starts the timing again this cycle repeats continuously the capacitor charges and discharges creating a sawtooth wave and the 555 timer outputs a square wave which is pulse width modulation we can calculate the performance like this the capacitor charges through r1 and the left side of the potentiometer so the charge time is calculated with this formula if we assume the potentiometer was at 50 percent then we get 0.35 milliseconds the capacitor discharges through the right side of the potentiometer so the discharge time is calculated with this formula this gives us 0.34 milliseconds each cycle is the on and off time combined so 0.35 plus 0.34 gives us 0.69 milliseconds the frequency is 1 divided by the cycle time which gives us 1428hz hertz the duty cycle is calculated like this so the output is on for around 50 percent of the time we use the 10 nano farad capacitor because it gives us a very high frequency and the dc motor works best at high frequency if we use a very large capacitor for example 100 microfarads the frequency drops to 0.14 hertz and each cycle takes seven seconds to complete so you can use other size capacitors but consider how this will impact the motor's speed okay so i will now build a simple prototype on a breadboard to check it all works it seems to be fine and i can adjust the speed so we will finish the pcb design we add the annotations then we import the components to the pcb design file and we spend some time rearranging the components around the board once ready we then outline the board and convert this to the keep out then we define the board shape we add some text on the terminals so that we know the polarity of the circuit when we go to use it we will then use the auto route feature to connect everything together once it is complete we will increase the width of the routes which carry a large voltage and current an increase to one millimeter should be fine we will probably need to move some of the routes to a better location so do check your design over you can then look at your design in 3d also once satisfied we create our polygon and then finally we can export our java files so now we're ready to have our circuit board printed we're going to be using jlc pcb to print our circuit board who have also kindly sponsored this video they offer exceptional value with five circuit boards from just two dollars do check them out i'll leave a link in the video description down below for you don't forget you can also download my design files again links in the video description for that so we simply log in and then upload our java file after a few seconds it generates a preview of the circuit on screen we can then customize the design with the different colors and materials etc but i'm going to leave these as default and save it to the cart then we head to the checkout we fill out our postage details and then select our postage option i personally want this very fast so i select the express postage option which is more expensive you can choose the slower methods to save on costs then we submit the order and pay a few days later our circuit board arrives in the post the board looks great i'm really very happy with the result so we start soldering the components to the board i start from the center and work my way out i'm using a holder for the 555 timer which will stop the components from being damaged by heat and allows us to easily replace the components if faulty with tricky components like this we can use some tape to hold it in place while we solder it so we solder all the components into place and then after a few minutes we should have a perfect looking circuit board now for the test we connect the bench power supply and the motor to the board i switch the board on to power it and then as i adjust the potentiometer the motor shaft begins to rotate the rotational speed can be increased or decreased very easily so we have a very basic pulse width modulation dc motor speed controller check out one of the videos on screen now to continue learning electronics engineering and i'll catch you there for the next lesson don't forget to follow us on facebook instagram linkedin as well as the engineeringmindset.com
Info
Channel: The Engineering Mindset
Views: 897,591
Rating: undefined out of 5
Keywords: dc motor speed controller, how to make dc motor speed controller, motor speed controller simple, pwm, speed controller, dc motor, freewheeling diode, pulse width modulation, rpm control, modulation, potentiometer, 555 timer, pwm dc motor speed control, speed control of dc motor, variable resistor, pulse width modulation tutorial, how pwm works, what is pwm, duty cycle, pulse width, motor controller, 12 volt dc motor speed controller, electrical engineering, pwm avr, ic, mosfet
Id: UPTU6nYSaMo
Channel Id: undefined
Length: 17min 32sec (1052 seconds)
Published: Sat Jul 24 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.