Learn more...
HOME
KITS
TUTORIALS
PROJECTS
ABOUT
STORE
FORUMS
MEMBERS
Electric motors are a key way of converting electrical power (voltage and current) into mechanical power (torque and speed), and because electric motors are simple and reliable machines, they can be found all over, in many different shapes and sizes. Just considering a normal (gasoline-powered) car, there are a great number of electric motors: the powerful starter motor and alternator alternating windshield wiper motors intermittent-use power windows and door locks the blower fan that moves hot and cold air into the cabin the tiny motors inside the CD player And I'm sure you can think of others. But from an electronics perspective, motors are slightly tricky loads to control -- they're not just a resistor! Even for a single applied voltage, their current varies with loading, starting, and stopping, and the energy stored in the magnetic field of the windings means that they are inductive, which can present a danger to other circuit components if it isn't handled properly. While a full analysis would have to look simultaneously at the motor and the attached mechanical system, in this video tutorial we're just going to address the electrical side of the system. This includes some experiments you should try with a DC motor, a model of the system from an electrical perspective, building a MOSFET-based switching circuit, and finally two demos of a microcontroller-operated motor. This video and webpage specifically addresses a brushed DC motor, and although the specifics are not fully applicable to brushless (BLDC) motors, stepper motors, or AC motors, the big ideas about motor modeling and control will be useful in those areas as well. Here are some photos and drawings related to the video (click to enlarge):
Motor Experiments
Here is an overview of the nine quick motor experiments / observations made during the video. We highly suggest you try these yourself with a small DC brushed motor to get a better feel for what's going on. 1. Spinning the motor makes a voltage. This is called the back-EMF (EMF stands for electromotive force, which is just a voltage), and the voltage is proportional to the speed of rotation, and it happens because the permanent magnets are moving relative to the coils of the motor. This is how a permanent magnet motor can be used in reverse as a generator. 2. Spinning the motor can light an LED. If an LED is attached and you are able to spin the motor fast enough in one direction to get to the forward voltage of the LED (about 2 volts), the LED will light. You are then turning mechanical energy into electrical energy and then into optical energy as photons. 3. Inertia keeps the rotor spinning. A spinning object such as the rotor likes to keep spinning, and is only slowed down by friction. 4. When shorted, the rotor is harder to turn. This may seem strange, but if the motor is electrically shorted, it's harder to turn the shaft, because the back-EMF generated by the spinning causes a current to flow. This current produces a torque which opposes the motion of the rotor. (It must be in this direction for energy conservation to work!) Also, the motor no longer spins much after the driving force applied by my hand is released, because its motion is quickly impeded by the motor torque. This experiment may be the least familiar or intuitive to you out of the nine -- give it a try! 5. The winding resistance of the motor can be measured. With a multimeter, we can measure the motor resistance, which for our motor was about 9 ohms. But the big idea of this video is that the motor is not just a resistance -- there's other effects going on too, so making decisions only considering the resistive part may lead to trouble. 6. The operating current under no load is small. With a multimeter, we measured an operating current of about 0.06 amps when driven from a 9V source, even though the previous measurement of 9 ohms might have suggested 9V/9 ohms = about 1 amp. That's because when the motor is spinning, there's a large back-EMF voltage, so the actual voltage drop across the 9 ohm resistor is much smaller. In this case, it's about (9 ohms)*(0.06 amps)=0.54 volts, which means that only 6% of the power going into the motor is being dissipated in the winding resistance, and the rest is going into friction or electromagnetic losses. 7. The current required when starting the motor is larger. When the motor is first started from rest, there's zero back-EMF, so the current is many times larger than the operating current. 8. The stall current, when the shaft is locked, is very large. If the motor shaft is physically prevented from spinning, we see the stall current, which is really just the operating voltage divided by the winding resistance. This is the largest current the motor will ever see, and it is an important number to consider when designing the motor control circuit. 9. A spark can be seen when the motor is switched on/off. Because energy is stored in the magnetic field due to a current, it's common to see sparks when the motor is switched on/off, because the energy in the magnetic field has to go somewhere when the current stops. Sparks mean high voltages -- hundreds or thousands of volts -- and this can be fatal for other circuit elements like transistors and microcontrollers. Go give them a try! Particularly for the experiments where current is applied, make sure that you only use a small motor disconnected from any gearing or mechanical loads so you don't hurt yourself.
Applying a voltage at the gate selects one of these curves. With the microcontroller driving it, we're only able to choose the VGS=5V curve, leading to a maximum current of about 0.75 amps. For more information about the MOSFET as a switch, see The NerdKits Guide. For another example of using the 2N7000, see our Servo Squirter tutorial.
For this case or for driving bigger motors, there are two more things you want to consider. First is the maximum allowed VDS, which applies when the MOSFET is off. When the switch is open, the drain terminal rises to match the motor power supply voltage. For the 2N7000, the datsheets suggests a "Drain-Source Breakdown Voltage" of at least 60 volts. This means we should not use the 2N7000 for higher-supply-voltage cases, and it's also typical to allow a safety factor, so perhaps 30-40V would be the maximum useful voltage where we can use the 2N7000 as a switch. The second is power dissipation in the MOSFET itself, equal to ID*VDS. For the 2N7000 at 0.75 amps and VGS=5V, the figure above shows a VDS of about 2 volts, meaning that the 2N7000 is dissipating (0.75 amps)*(2 volts)=1.5 Watts. (In the triode region for small VDS, this curve gets approximated by a "Drain-Source On-Resistance RDS" as a function of VGS.) This 1.5 Watts might seem small compared to a 100 Watt light bulb, but for all that heat to be dissipated out of such a tiny transistor package would cause a huge temperature rise. Going from the 2N7000 datasheet, the "Thermal Resistance, Junction-to-Ambient" is more than 300C/W, implying that for a 1.5 Watt power dissipation, the transistor would have to be roughly 450C above room temperature. This would clearly just melt the plastic of transistor! It's better to keep temperature rise at most 50C or less if possible. However, it is OK to allow the transistor to momentarily pass through such a power dissipation region, because the transistor won't heat up instantly (see the 2N7000 datasheet for more info). So if the motor very briefly draws 0.75 amps while it's starting, we're OK, but if it gets stuck or stalls, we're in real trouble! A more powerful "Power MOSFET" and a good heatsink are a must for higher-powered designs, and even for a small motor like this, an unintended stall will cause parts to overheat and become damaged. If you need to guarantee that your circuit will survive a stall (even if the motor itself might not), design it with this in mind. If you want to control higher-powered loads, here are some other typical MOSFETs you might consider, with a table of important values: Part Number Max. Current at VGS=5V [amps] RDS at VGS=5V [ohms] Breakdown VDS [volts] Notes 2N7000 0.8 1.7 60 Used in this video. IRF520 2.0 0.4 100 IRF730A 0.2 6.0 400 High breakdown -- used here. FQP50N06 15 0.09 60 Low on-resistance, high current. There are thousands of varieties out there that have different tradeoffs, typically between cost, current capability, gate capacitance, and a few other factors. Also, these are only on the n-channel side -- you may occasionally want p-channel MOSFETs for you application to put a switch on the high-voltage side of the load (but would have to think about voltage levels from your microcontroller).
as you will at full duty cycle. In order to get true speed control you have to either completely work out the dynamics of your motor and friction and load, and how it would react to the input pulse of of different widths (which would be hard), or do some sort of closed loop control where you measure the speed of the motor and adjust your PWM duty cycle in real time to get the speed you want. We have an explanation of how we generate a PWM pulse using the microcontroller in our Servo Squirter video tutorial. You should also be aware that using PWM puts far greater stresses on the motor control circuit elements such as the MOSFET and flyback diode (in comparison to just switching fully on and off), because the MOSFET will be passing through its high-loss "not-a-perfect-switch" region many times per second, and also because the flyback diode will be forced to quench the inductive kick many times per second.
Source Code
Although we highly recommend you experiment with motors on your own, you can download the source code from our demo. In the same piece of code, two modes of operation are demonstrated: 1. Pushbutton toggle on/off mode. A pushbutton (included with the USB NerdKit) is connected with its "C" terminal to ground and its "NO" terminal to pin PB4. The code "debounces" the input, filtering out unintended button transitions, and then toggles the state of the motor, which is just a digital output on pin PB3. 2. Temperature feedback speed control PWM mode. The LM34 temperature sensor (also included with our microcontroller kit) is read by the analog-to-digital convertor (ADC) of the microcontroller, and this value is used to adjust the PWM duty cycle. A PWM digital signal is output on pin PB2. The gate of the 2N7000 MOSFET is then connected to either PB2 or PB3, depending on which mode is being demonstrated. The LCD is also used for user feedback about the state of the system in both modes.
Comments
Like
Add a comment...
Log In
Log in to Facebook to post your comment
Yashasvi Kumar Jul 27 i want to make an rc car that can control atleast 5 motors for my science project just send its circuit diagram and the name of the components pls. send as early as possible i have to make it in a month send to yashasvikumar7@gmail.com
Arniel Domingo Jul 16 good job i hope you can do more projects with videos
T.j. McKinney Jan 22 i'm trying to control arduino and an rc car from a custom made webpage that i want to create. can you help me? email me at thegoodrobot@yahoo.com anyone can reply to this. thanks! 1-22-11
Gregory Blank Jan 8 Great teaching and informative. This is the way to learn or in my case re-learn electronics!
Search
pow ered by
NerdKits Home Kits Projects Library About Store Members Area Feedback
Videos Capacitive Proximity Sensor C Programming: printf and scanf Motors and Microcontrollers 101 Interrupts & PS/2 Keyboards USB Servo-Guided Water Squirter Valentine's Day LED Heart iPhone-controlled R/C Car and many more...
Community Forums Basic Electronics Customer Testimonials Microcontroller Programming NerdKits Newsletter Archives Project Help and Ideas Sensors, Actuators, and Robotics Support Forum and everything else...